waz-sync 0.0.2.4 → 0.0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/waz_sync/tasks.rb +41 -0
- data/waz-sync.gemspec +1 -1
- metadata +3 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
namespace :waz do
|
2
|
+
task :app_env do
|
3
|
+
if defined?(RAILS_ROOT)
|
4
|
+
Rake::Task[:environment].invoke
|
5
|
+
if defined?(Rails.configuration)
|
6
|
+
Rails.configuration.cache_classes = false
|
7
|
+
else
|
8
|
+
Rails::Initializer.run { |config| config.cache_classes = false }
|
9
|
+
end
|
10
|
+
elsif defined?(Merb)
|
11
|
+
Rake::Task[:merb_env].invoke
|
12
|
+
elsif defined?(Sinatra)
|
13
|
+
Sinatra::Application.environment = ENV['RACK_ENV']
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Sync your assets to Windows Azure, usage : rake waz_sync:sync folders=images,stylesheets,javascripts (you can skip folders arg)"
|
18
|
+
task :sync => :app_env do
|
19
|
+
|
20
|
+
folders = ENV['folders'].split(/,/)
|
21
|
+
|
22
|
+
if folders.blank?
|
23
|
+
folders = ["images", "javascripts", "stylesheets"]
|
24
|
+
end
|
25
|
+
|
26
|
+
azure = WazSync.new()
|
27
|
+
folders.each{|folder|
|
28
|
+
|
29
|
+
container = azure.find_or_create_container(folder)
|
30
|
+
|
31
|
+
Dir.glob("#{Rails.root.to_s}/public/#{folder}/**/*").each do |file|
|
32
|
+
if File.file?(file)
|
33
|
+
filename = file.gsub("/public/#{folder}/", "").gsub("#{Rails.root.to_s}", "")
|
34
|
+
p filename
|
35
|
+
azure.send_or_update(container, file, filename)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
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.
|
4
|
+
gem.version = '0.0.2.5'
|
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
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.0.2.
|
9
|
+
- 5
|
10
|
+
version: 0.0.2.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Guillaume MONTARD
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- LICENCE
|
33
33
|
- README.rdoc
|
34
34
|
- lib/waz_sync.rb
|
35
|
+
- lib/waz_sync/tasks.rb
|
35
36
|
- rakefile
|
36
37
|
- waz-sync.gemspec
|
37
38
|
has_rdoc: true
|