waz-sync 0.0.2.5 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/waz_sync/tasks.rb +21 -4
- data/waz-sync.gemspec +1 -1
- metadata +2 -3
data/lib/waz_sync/tasks.rb
CHANGED
@@ -17,25 +17,42 @@ namespace :waz do
|
|
17
17
|
desc "Sync your assets to Windows Azure, usage : rake waz_sync:sync folders=images,stylesheets,javascripts (you can skip folders arg)"
|
18
18
|
task :sync => :app_env do
|
19
19
|
|
20
|
-
|
20
|
+
STDOUT.sync = true
|
21
|
+
|
22
|
+
folders_tmp = ENV['folders']
|
21
23
|
|
22
|
-
if
|
24
|
+
if folders_tmp.blank?
|
23
25
|
folders = ["images", "javascripts", "stylesheets"]
|
26
|
+
else
|
27
|
+
folders = folders_tmp.split(/,/)
|
24
28
|
end
|
25
29
|
|
26
30
|
azure = WazSync.new()
|
31
|
+
|
27
32
|
folders.each{|folder|
|
28
|
-
|
33
|
+
|
34
|
+
puts " ==> Syncing #{folder}"
|
35
|
+
|
29
36
|
container = azure.find_or_create_container(folder)
|
30
37
|
|
38
|
+
i = 0
|
39
|
+
Dir.glob("#{Rails.root.to_s}/public/#{folder}/**/*").each do |file|
|
40
|
+
i+=1
|
41
|
+
end
|
42
|
+
|
43
|
+
j = 0
|
31
44
|
Dir.glob("#{Rails.root.to_s}/public/#{folder}/**/*").each do |file|
|
32
45
|
if File.file?(file)
|
33
46
|
filename = file.gsub("/public/#{folder}/", "").gsub("#{Rails.root.to_s}", "")
|
34
|
-
|
47
|
+
print "\r ==> #{(((j.to_f/i.to_f)*10000).to_i / 100.0).ceil}%"
|
35
48
|
azure.send_or_update(container, file, filename)
|
36
49
|
end
|
50
|
+
j+=1
|
37
51
|
end
|
52
|
+
print "\n"
|
38
53
|
}
|
54
|
+
|
55
|
+
STDOUT.sync = false
|
39
56
|
end
|
40
57
|
|
41
58
|
end
|
data/waz-sync.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = 'waz-sync'
|
4
|
-
gem.version = '0.0.
|
4
|
+
gem.version = '0.0.3'
|
5
5
|
gem.date = '2012-04-20'
|
6
6
|
gem.description = %q{A simple client library aim to sync assets to Windows Azure CDN, using a modified version of the great waz-storage gem}
|
7
7
|
gem.summary = %q{Client library for Syncing assets to Windows Azure CDN}
|