waz-sync 0.0.2.5 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/waz_sync/tasks.rb +21 -4
  2. data/waz-sync.gemspec +1 -1
  3. metadata +2 -3
@@ -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
- folders = ENV['folders'].split(/,/)
20
+ STDOUT.sync = true
21
+
22
+ folders_tmp = ENV['folders']
21
23
 
22
- if folders.blank?
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
- p filename
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.2.5'
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}
metadata CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- - 5
10
- version: 0.0.2.5
8
+ - 3
9
+ version: 0.0.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Guillaume MONTARD