-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrakefile
35 lines (28 loc) · 920 Bytes
/
rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
task default: %w[run]
task :run => :appcache do
puts "Copiando os arquivos para o servidor"
`touch main.appcache`
`scp -r -P 2222 assets *.html *.css *.js main.appcache [email protected]:/var/www/rodrigolop.es/panini/`
end
task :appcache do
revision = 1
cache_filename = 'main.appcache'
if File.exists?(cache_filename)
manifest = File.read(cache_filename)
revision = manifest.lines.to_a[1].split(/:/).last.strip.to_i + 1
end
puts "Nova revision: #{revision}"
File.open(cache_filename, 'w') do |cache_file|
cache_file.puts('CACHE MANIFEST')
cache_file.puts("# Revision: #{revision}\n")
cache_file.puts("\nCACHE:")
Dir.glob('**/*') do |fname|
unless [cache_filename, 'rakefile', 'README.md'].include?(File.basename(fname))
cache_file.puts(fname) unless File.directory?(fname)
end
end
cache_file.puts("\nNETWORK:")
cache_file.puts("*")
end
puts `cat #{cache_filename}`
end