cloud_storage_sync 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ tmp/*
6
+ .rvmrcvendor/ruby
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm ruby-1.9.2@global
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Tractical, http://tractical.com/
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ # Cloud Storage Sync
2
+
3
+ Synchronises files between your Rails application and your favorite CDN provider.
4
+
5
+ Currently supported providers:
6
+
7
+ * Amazon s3
8
+ * Rackspace Cloud Files
9
+ * Google Storage
10
+
11
+ ## Installation instructions
12
+ The first thing you should do is install the gem.
13
+
14
+ gem install cloud-storage-sync
15
+
16
+ Now, to tell the gem your configuration options you need to do it through the initializer. The gem offers a rails generator to create this initializer which includes documentation on how to use it and what parameters are needed for each of the services currently supported.
17
+
18
+ The generator creates the file [https://github.com/tractical/cloud-storage-sync/blob/master/lib/generators/cloud_storage_sync/templates/cloud_storage_sync.rb](example) and you run it like this:
19
+
20
+ rails generate cloud_storage_sync:install
21
+
22
+ ### Sync assets
23
+
24
+ When you're ready to send your files to the cloud all you have to do is to run the following rake task:
25
+
26
+ rake cloud_storage_sync:sync_assets
27
+
28
+ If everything goes well you will see an output similar to this:
29
+
30
+ *** Syncing with aws ***
31
+ Uploading new and changed files
32
+ U public/hello.png (b55b17cc47783139c3f5dee0f3a90ce7)
33
+ Done
34
+
35
+ If you have config.force_deletion_sync set to true, you would get an output like this:
36
+
37
+ *** Syncing with aws ***
38
+ Deleting remote files that no longer exist locally
39
+ D Screen shot 2011-11-03 at 12.47.03 PM.png
40
+ D delete_me.png
41
+ ...
42
+ Done
43
+
44
+ And that's it.
45
+
46
+ ## Questions?
47
+
48
+ If you have any questions, please feel free to contact us on Twitter: [Tractical](http://twitter.com/tractical), [Amed Rodriguez](http://twitter.com/amedse), [Javier Saldaña](http://twitter.com/javiersaldana), [Daniel Roux](http://twitter.com/danroux).
@@ -0,0 +1,6 @@
1
+ # Use Rakefile for tasks that operate on the plugin’s source files, such as special testing or documentation.
2
+ # These must be run from the plugin’s directory.
3
+
4
+ # rakes = Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"]
5
+ # rakes.sort.each { |ext| load ext; puts ext }
6
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "cloud-storage-sync/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "cloud_storage_sync"
7
+ s.version = CloudStorageSync::VERSION
8
+ s.authors = ["Amed Rodriguez", "Javier Saldana", "Daniel Roux"]
9
+ s.email = ["amed@tractical.com", "javier@tractical.com", "daniel@tractical.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{Sync assets hosts}
12
+ s.description = %q{Sync your assets hosts to Amazon & Rackspace services}
13
+
14
+ s.rubyforge_project = "cloud-storage-sync"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "rspec-rails", "2.7.0"
22
+ s.add_development_dependency "mocha", "0.10.0"
23
+ s.add_development_dependency "ruby-debug19"
24
+
25
+ s.add_dependency "fog", "1.0.0"
26
+
27
+ end
@@ -0,0 +1,23 @@
1
+ module CloudStorageSync
2
+
3
+ class << self
4
+
5
+ def config
6
+ @config ||= Config.new
7
+ end
8
+
9
+ def configure(&proc)
10
+ yield @config ||= Config.new
11
+ end
12
+
13
+ def storage
14
+ @storage ||= Storage.new(config.credentials, config.options)
15
+ end
16
+
17
+ def sync
18
+ config.validate
19
+ raise Config::Invalid.new(config.errors.full_messages.join(', ')) unless config && config.valid?
20
+ storage.sync
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,68 @@
1
+ module CloudStorageSync
2
+ class Config
3
+ include ActiveModel::Validations
4
+ DYNAMIC_SERVICES = [:provider,
5
+ :google_storage_secret_access_key, :google_storage_access_key_id,
6
+ :aws_secret_access_key, :aws_access_key_id,
7
+ :rackspace_username, :rackspace_api_key, :rackspace_european_cloud,
8
+ :rackspace_auth_url, :rackspace_servicenet, :rackspace_cdn_ssl,
9
+ :ninefold_storage_token,:ninefold_storage_secret,
10
+ :endpoint, :region, :host, :path, :port, :scheme, :persistent]
11
+
12
+ class Invalid < StandardError; end
13
+
14
+ attr_accessor :provider, :force_deletion_sync, :credentials, :assets_directory, :config_path
15
+
16
+ validates_presence_of :assets_directory
17
+ validates_inclusion_of :force_deletion_sync, :in => [true, false]
18
+
19
+ def initialize
20
+ self.force_deletion_sync = false
21
+ self.credentials = {}
22
+ end
23
+
24
+ def force_deletion_sync?
25
+ self.force_deletion_sync == true
26
+ end
27
+
28
+ def initializer_exists?
29
+ path = File.join(config_path, "initializers", "cloud_storage_sync.rb")
30
+ File.exists? path
31
+ end
32
+
33
+ def validate
34
+ case provider
35
+ when "aws"
36
+ requires :aws_access_key_id, :aws_secret_access_key
37
+ when "rackspace"
38
+ requires :rackspace_api_key, :rackspace_username
39
+ when "google"
40
+ requires :google_storage_access_key_id, :google_storage_secret_access_key
41
+ when "ninefold"
42
+ requires :ninefold_storage_token, :ninefold_storage_secret
43
+ else
44
+ raise ArgumentError.new("#{provider} is not a recognized storage provider")
45
+ end
46
+ end
47
+
48
+ def requires(*attrs)
49
+ attrs.each do |key|
50
+ raise ArgumentError.new("#{provider.capitalize} requires #{attrs.join(', ')} in configuration files") if self.send(key).nil?
51
+ end
52
+ end
53
+
54
+ def options
55
+ { :assets_directory => assets_directory, :force_deletion_sync => force_deletion_sync }
56
+ end
57
+
58
+ DYNAMIC_SERVICES.each do |key|
59
+ variable = :"@#{key}"
60
+ define_method :"#{key}=" do |value|
61
+ self.credentials.merge!(key => value)
62
+ instance_variable_set variable, value
63
+ end
64
+
65
+ class_eval "def #{key}; @#{key}; end\n"
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ module CloudStorageSync
2
+ class Railtie < Rails::Railtie
3
+ railtie_name :cloud_storage_sync
4
+
5
+ rake_tasks do
6
+ load "tasks/deploy.rake"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,72 @@
1
+ module CloudStorageSync
2
+ class Storage
3
+
4
+ class BucketNotFound < StandardError; end
5
+
6
+ attr_accessor :credentials, :options
7
+
8
+ def initialize(credentials, options)
9
+ self.credentials = credentials
10
+ self.options = options
11
+ end
12
+
13
+ def connection
14
+ @connection ||= Fog::Storage.new(credentials)
15
+ end
16
+
17
+ def bucket
18
+ @bucket ||= connection.directories.get(options[:assets_directory])
19
+ raise BucketNotFound.new("Directory '#{options[:assets_directory]}' not found") unless @bucket
20
+ @bucket
21
+ end
22
+
23
+ def force_deletion_sync?
24
+ options[:force_deletion_sync] == true
25
+ end
26
+
27
+ def local_files
28
+ @local_files ||= Dir.glob("#{Rails.root.to_s}/public/**/*").map{ |f| Digest::MD5.hexdigest(File.read(f)) }
29
+ end
30
+
31
+ def remote_files
32
+ @remote_files ||= bucket.files.map{ |f| f.etag }
33
+ end
34
+
35
+ def upload_new_and_changed_files
36
+ STDERR.puts "Uploading new and changed files"
37
+ Dir.glob("public/**/*").each do |file|
38
+ if File.file?(file)
39
+ remote_file = file.gsub("public/", "")
40
+ begin
41
+ obj = bucket.files.get(remote_file)
42
+ rescue
43
+ obj = nil
44
+ end
45
+ if !obj || (obj.etag != Digest::MD5.hexdigest(File.read(file)))
46
+ STDERR.print "U " + file
47
+ f = bucket.files.create(:key => remote_file, :body => File.open(file), :public => true)
48
+ STDERR.puts " (" + f.etag + ")"
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ def delete_unsynced_remote_files
55
+ STDERR.puts "Deleting remote files that no longer exist locally"
56
+ files_to_delete = (local_files | remote_files) - (local_files & remote_files)
57
+ bucket.files.each do |f|
58
+ if files_to_delete.include?(f.etag)
59
+ STDERR.puts "D #{f.key}"
60
+ f.destroy
61
+ end
62
+ end
63
+ end
64
+
65
+ def sync
66
+ upload_new_and_changed_files
67
+ delete_unsynced_remote_files if options[:force_deletion_sync] == true
68
+ STDERR.puts "Done"
69
+ end
70
+
71
+ end
72
+ end
@@ -0,0 +1,9 @@
1
+ # require 'resque/tasks'
2
+ # will give you the gem tasks
3
+
4
+ namespace :cloud_storage_sync do
5
+ desc "Sync assets"
6
+ task :sync do
7
+ puts "pending"
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module CloudStorageSync
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,11 @@
1
+ require 'fog'
2
+ require 'active_model'
3
+ require 'erb'
4
+ require "cloud-storage-sync/cloud_storage_sync"
5
+ require 'cloud-storage-sync/config'
6
+ require 'cloud-storage-sync/storage'
7
+
8
+ module CloudStorageSync
9
+ require 'cloud-storage-sync/railtie' if defined?(Rails)
10
+ end
11
+ # require 'cloud-storage-sync/engine' if defined?(Rails)
@@ -0,0 +1,20 @@
1
+ require 'rails'
2
+ if ::Rails.version >= "3.1"
3
+ module CloudStorageSync
4
+ class InstallGenerator < Rails::Generators::Base
5
+ desc "This generator installs the files needed for CloudStorageSync configuration"
6
+ class_option :use_yml, :type => :boolean, :default => false, :desc => "Use YML file instead of Rails Initializer"
7
+ source_root File.expand_path(File.join(File.dirname(__FILE__), '../templates'))
8
+
9
+ def app_name
10
+ @app_name ||= Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, "").downcase
11
+ end
12
+
13
+ def generate_initializer
14
+ unless options[:use_yml]
15
+ template "cloud_storage_sync.rb", "config/initializers/cloud_storage_sync.rb"
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,23 @@
1
+ require 'rails/generators'
2
+ module CloudStorageSync
3
+ class InstallGenerator < Rails::Generators::Base
4
+ desc "Install a config/cloud_storage_sync.yml and the rake task enhancer"
5
+
6
+ def self.source_root
7
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
8
+ end
9
+
10
+ def app_name
11
+ @app_name ||= Rails.application.is_a?(Rails::Application) &&
12
+ Rails.application.class.name.sub(/::Application$/, "").downcase
13
+ end
14
+
15
+ def generate_config
16
+ template "cloud_storage_sync.yml", "config/cloud_storage_sync.yml"
17
+ end
18
+
19
+ def generate_rake_task
20
+ template "cloud_storage_sync.rake", "lib/tasks/cloud_storage_sync.rake"
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ Rake::Task["cloud_storage_sync:sync"].enhance do
2
+ CloudStorageSync.sync
3
+ end
@@ -0,0 +1,31 @@
1
+ CloudStorageSync.configure do |config|
2
+ ## CloudStorageSync supports the following providers: aws, google, ninefold and rackspace
3
+ ## For more information on which parameters are required for each provider, visit http://fog.io/1.0.0/storage/
4
+ ## Provider examples:
5
+
6
+ # config.provider = aws
7
+ # config.aws_access_key_id = AWS_SECRET_ACCESS_KEY
8
+ # config.aws_secret_access_key = AWS_ACCESS_KEY_ID
9
+ # all other configuration attributes are: endpoint, region, host, path, port, scheme, persistent
10
+
11
+ # config.provider = rackspace
12
+ # config.rackspace_username = RACKSPACE_USERNAME
13
+ # config.rackspace_api_key = RACKSPACE_API_KEY
14
+ ## If you work with the European cloud from Rackspace uncomment the following
15
+ # config.rackspace_european_cloud = true
16
+ # all other configuration attributes are: rackspace_auth_url, rackspace_servicenet, rackspace_cdn_ssl, persistent
17
+
18
+ # config.provider = google
19
+ # config.google_storage_access_key_id = GOOGLE_STORAGE_ACCESS_KEY_ID
20
+ # config.google_storage_secret_access_key = GOOGLE_STORAGE_SECRET_ACCESS_KEY
21
+ # all other configuration attributes are: host, port, scheme, persistent
22
+
23
+ config.aws_access_key_id = 'AWS_SECRET_ACCESS_KEY'
24
+ config.aws_secret_access_key = 'AWS_ACCESS_KEY_ID'
25
+
26
+ # 'assets_directory' aka bucket in aws, container in rackspace, etc.
27
+ config.assets_directory = 'ASSETS_DIRECTORY'
28
+
29
+ # Change this to true if you want to delete files that don't exist locally anymore.
30
+ config.force_deletion_sync = false
31
+ end
@@ -0,0 +1,8 @@
1
+ namespace :cloud_storage_sync do
2
+ desc "sync assets"
3
+ task :sync_assets => :environment do
4
+ puts "*** Syncing with #{CloudStorageSync.config.provider} ***"
5
+ CloudStorageSync.sync
6
+ end
7
+ end
8
+
@@ -0,0 +1,171 @@
1
+ require File.dirname(__FILE__) + '/spec_helper'
2
+
3
+ describe CloudStorageSync::Config do
4
+ it "should have each DYNAMIC_SERVICES accessor for configuration" do
5
+ CloudStorageSync::Config::DYNAMIC_SERVICES.each do |service_config|
6
+ should respond_to(service_config)
7
+ end
8
+ end
9
+ end
10
+
11
+ describe CloudStorageSync, 'with #configure(initializer)' do
12
+ before(:all) do
13
+ CloudStorageSync.configure do |config|
14
+ config.provider = "aws"
15
+ config.aws_secret_access_key = "111222333444"
16
+ config.aws_access_key_id = "qwerty1234567890"
17
+ config.assets_directory = "app_test"
18
+ end
19
+
20
+ @config = CloudStorageSync.config
21
+
22
+ Fog.mock!
23
+ # create a connection
24
+ connection = Fog::Storage.new(@config.credentials)
25
+ # First, a place to contain the glorious details
26
+ connection.directories.create(
27
+ :key => @config.options[:assets_directory],
28
+ :public => true
29
+ )
30
+
31
+ @storage = CloudStorageSync.storage
32
+ end
33
+
34
+ it "loads aws configuration" do
35
+ @storage.credentials.should eq(@config.credentials)
36
+ @storage.credentials[:provider].should == "aws"
37
+ @storage.credentials[:aws_secret_access_key].should == "111222333444"
38
+ @storage.credentials[:aws_access_key_id].should == "qwerty1234567890"
39
+ end
40
+
41
+ it "loads buckets" do
42
+ @storage.bucket.should_not be_nil
43
+ end
44
+
45
+ it "syncs to aws" do
46
+ expect{ CloudStorageSync.sync }.should_not raise_error
47
+ end
48
+
49
+ it "requires valid configuration fields" do
50
+ CloudStorageSync.config.provider = "rackspace"
51
+ expect{ CloudStorageSync.sync}.to raise_error(ArgumentError,
52
+ "Rackspace requires rackspace_api_key, rackspace_username in configuration files")
53
+ CloudStorageSync.config.provider = "google"
54
+ expect{ CloudStorageSync.sync}.to raise_error(ArgumentError,
55
+ "Google requires google_storage_access_key_id, google_storage_secret_access_key in configuration files")
56
+ CloudStorageSync.config.provider = "ninefold"
57
+ expect{ CloudStorageSync.sync}.to raise_error(ArgumentError,
58
+ "Ninefold requires ninefold_storage_token, ninefold_storage_secret in configuration files")
59
+ CloudStorageSync.config.provider = "best_cloud_service"
60
+ expect{ CloudStorageSync.sync}.to raise_error(ArgumentError,
61
+ "best_cloud_service is not a recognized storage provider")
62
+ end
63
+
64
+ context "Connect to each service supported" do
65
+ before(:each) do
66
+ @config.credentials.clear
67
+ end
68
+
69
+ it "syncs to google" do
70
+ CloudStorageSync.configure do |config|
71
+ config.provider = "google"
72
+ config.google_storage_access_key_id = "somegooglekey"
73
+ config.google_storage_secret_access_key = "secret_access_key"
74
+ config.persistent = true
75
+ end
76
+
77
+ expect{ @connection = create_connection }.not_to raise_error
78
+ @connection.should be_a_kind_of Fog::Storage::Google::Mock
79
+ end
80
+
81
+ it "syncs to aws" do
82
+ CloudStorageSync.configure do |config|
83
+ config.provider = "aws"
84
+ config.aws_access_key_id = "api_key"
85
+ config.aws_secret_access_key = "username"
86
+ end
87
+
88
+ expect{ @connection = create_connection }.not_to raise_error
89
+ @connection.should be_a_kind_of Fog::Storage::AWS::Mock
90
+ end
91
+
92
+ it "syncs to rackspace" do
93
+ CloudStorageSync.configure do |config|
94
+ config.provider = "rackspace"
95
+ config.rackspace_username = "username"
96
+ config.rackspace_api_key = "api_key"
97
+ end
98
+
99
+ expect{ @connection = create_connection }.to raise_error(Fog::Errors::MockNotImplemented, "Contributions welcome!")
100
+ end
101
+
102
+ it "syncs to ninefold" do
103
+ CloudStorageSync.configure do |config|
104
+ config.provider = "ninefold"
105
+ config.ninefold_storage_token = "token_key"
106
+ config.ninefold_storage_secret = "secret"
107
+ end
108
+
109
+ expect{ @connection = create_connection }.to raise_error(Fog::Errors::MockNotImplemented, "Contributions welcome!")
110
+ end
111
+ end
112
+ end
113
+
114
+ describe CloudStorageSync::Storage do
115
+ YML_FILE_PATH = File.join(File.dirname(__FILE__), 'fixtures', "cloud_storage_sync.yml")
116
+ YML_FILE = File.read(YML_FILE_PATH)
117
+ YML_DIGEST = Digest::MD5.hexdigest(YML_FILE)
118
+
119
+ before do
120
+ config = mock(CloudStorageSync::Config)
121
+ config.stub(:credentials).and_return(:provider =>"aws",
122
+ :aws_secret_access_key =>"111222333444",
123
+ :aws_access_key_id =>"qwerty1234567890")
124
+
125
+ config.stub(:options).and_return(:assets_directory => "app_test",
126
+ :force_deletion_sync => false)
127
+
128
+ CloudStorageSync.stub(:config).and_return(config)
129
+ @config = CloudStorageSync.config
130
+
131
+ Fog.mock!
132
+ # create a connection
133
+ connection = Fog::Storage.new(@config.credentials)
134
+ # First, a place to contain the glorious details
135
+ connection.directories.create(
136
+ :key => @config.options[:assets_directory],
137
+ :public => true
138
+ )
139
+
140
+ @storage = CloudStorageSync::Storage.new(@config.credentials, @config.options)
141
+ end
142
+
143
+ it "Uploads a new file and then deletes it" do
144
+ @storage.stub(:local_files).and_return([YML_DIGEST])
145
+ Dir.stub(:glob).and_return([YML_FILE_PATH])
146
+ @storage.local_files.length.should == 1
147
+ @storage.bucket.files.length.should == 0
148
+ @storage.sync
149
+ @storage.bucket.files.reload
150
+ @storage.bucket.files.length.should == 1
151
+ Dir.stub(:glob).and_return([])
152
+ @storage.stub(:local_files).and_return([])
153
+ @storage.stub(:remote_files).and_return([YML_DIGEST])
154
+ @storage.sync
155
+ @storage.bucket.files.reload
156
+ @storage.bucket.files.length.should == 1
157
+ @storage.options[:force_deletion_sync] = true
158
+ Fog::Storage::AWS::File.any_instance.should_receive(:etag).and_return(YML_DIGEST)
159
+ @storage.sync
160
+ @storage.bucket.files.reload
161
+ @storage.bucket.files.length.should == 0
162
+ end
163
+ end
164
+
165
+ def create_connection
166
+ connection = Fog::Storage.new(@config.credentials)
167
+ # First, a place to contain the glorious details
168
+ connection.directories.create(:key => @config.options[:assets_directory],
169
+ :public => true)
170
+ connection
171
+ end
@@ -0,0 +1,23 @@
1
+ ## Provider examples:
2
+
3
+ # provider: rackspace
4
+ # rackspace_username: RACKSPACE_USERNAME
5
+ # rackspace_api_key: RACKSPACE_API_KEY
6
+ ## If you work with the European cloud from Rackspace uncomment the following
7
+ # rackspace_european_cloud: true
8
+
9
+ # provider: google
10
+ # google_storage_access_key_id: GOOGLE_STORAGE_ACCESS_KEY_ID
11
+ # google_storage_secret_access_key: GOOGLE_STORAGE_SECRET_ACCESS_KEY
12
+
13
+ ## CloudStorageSync supports the following providers: aws, google, ninefold and rackspace
14
+ ## For more information on which parameters are required for each provider, visit http://fog.io/1.0.0/storage/
15
+
16
+ defaults: &defaults
17
+ provider: "aws"
18
+ aws_secret_access_key: "111222333444"
19
+ aws_access_key_id: "qwerty1234567890"
20
+
21
+ test:
22
+ <<: *defaults
23
+ assets_directory: "app_test"
@@ -0,0 +1,12 @@
1
+ require "rubygems"
2
+ require "rspec"
3
+ require "mocha"
4
+ require "rails"
5
+ require "fog"
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
9
+
10
+ require "cloud_storage_sync"
11
+
12
+ Rails.env = "test"
@@ -0,0 +1,13 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ class InstallGeneratorTest < Rails::Generators::TestCase
4
+ tests CloudStorageSync::InstallGenerator
5
+ destination File.expand_path("../tmp", File.dirname(__FILE__))
6
+ setup :prepare_destination
7
+ setup :run_generator
8
+
9
+ test "Assert all files are properly created" do
10
+ assert_file "lib/tasks/cloud_storage_sync.rake"
11
+ end
12
+
13
+ end
@@ -0,0 +1,5 @@
1
+ require "test/unit"
2
+ require "rubygems"
3
+ require "rails"
4
+ require File.join(File.dirname(__FILE__), '../', 'lib', 'generators',
5
+ 'cloud_storage_sync', 'install_generator')
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cloud_storage_sync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Amed Rodriguez
9
+ - Javier Saldana
10
+ - Daniel Roux
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2011-11-10 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rspec-rails
18
+ requirement: &2156698980 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - =
22
+ - !ruby/object:Gem::Version
23
+ version: 2.7.0
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: *2156698980
27
+ - !ruby/object:Gem::Dependency
28
+ name: mocha
29
+ requirement: &2156698140 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - =
33
+ - !ruby/object:Gem::Version
34
+ version: 0.10.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *2156698140
38
+ - !ruby/object:Gem::Dependency
39
+ name: ruby-debug19
40
+ requirement: &2156697380 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ type: :development
47
+ prerelease: false
48
+ version_requirements: *2156697380
49
+ - !ruby/object:Gem::Dependency
50
+ name: fog
51
+ requirement: &2156684080 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - =
55
+ - !ruby/object:Gem::Version
56
+ version: 1.0.0
57
+ type: :runtime
58
+ prerelease: false
59
+ version_requirements: *2156684080
60
+ description: Sync your assets hosts to Amazon & Rackspace services
61
+ email:
62
+ - amed@tractical.com
63
+ - javier@tractical.com
64
+ - daniel@tractical.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - .rvmrc
71
+ - Gemfile
72
+ - MIT-LICENSE.txt
73
+ - README.md
74
+ - Rakefile
75
+ - cloud_storage_sync.gemspec
76
+ - lib/cloud-storage-sync/cloud_storage_sync.rb
77
+ - lib/cloud-storage-sync/config.rb
78
+ - lib/cloud-storage-sync/railtie.rb
79
+ - lib/cloud-storage-sync/storage.rb
80
+ - lib/cloud-storage-sync/tasks.rb
81
+ - lib/cloud-storage-sync/version.rb
82
+ - lib/cloud_storage_sync.rb
83
+ - lib/generators/cloud_storage_sync/install/install_generator.rb
84
+ - lib/generators/cloud_storage_sync/install_generator.rb
85
+ - lib/generators/cloud_storage_sync/templates/cloud_storage_sync.rake
86
+ - lib/generators/cloud_storage_sync/templates/cloud_storage_sync.rb
87
+ - lib/tasks/deploy.rake
88
+ - spec/cloud_storage_sync_spec.rb
89
+ - spec/fixtures/cloud_storage_sync.yml
90
+ - spec/spec_helper.rb
91
+ - test/install_generator_test.rb
92
+ - test/test_helper.rb
93
+ homepage: ''
94
+ licenses: []
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ none: false
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ segments:
106
+ - 0
107
+ hash: 4032249789575117650
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
110
+ requirements:
111
+ - - ! '>='
112
+ - !ruby/object:Gem::Version
113
+ version: '0'
114
+ segments:
115
+ - 0
116
+ hash: 4032249789575117650
117
+ requirements: []
118
+ rubyforge_project: cloud-storage-sync
119
+ rubygems_version: 1.8.10
120
+ signing_key:
121
+ specification_version: 3
122
+ summary: Sync assets hosts
123
+ test_files:
124
+ - spec/cloud_storage_sync_spec.rb
125
+ - spec/fixtures/cloud_storage_sync.yml
126
+ - spec/spec_helper.rb
127
+ - test/install_generator_test.rb
128
+ - test/test_helper.rb