multi_sync 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (150) hide show
  1. checksums.yaml +7 -0
  2. data/.document +3 -0
  3. data/.gitignore +20 -0
  4. data/.rubocop.yml +26 -0
  5. data/.travis.yml +24 -0
  6. data/.yardopts +6 -0
  7. data/CHANGELOG.md +0 -0
  8. data/CONTRIBUTING.md +44 -0
  9. data/Gemfile +17 -0
  10. data/LICENSE.md +20 -0
  11. data/README.md +134 -0
  12. data/Rakefile +45 -0
  13. data/examples/custom.rb +34 -0
  14. data/examples/rails-3-2/.gitignore +15 -0
  15. data/examples/rails-3-2/Gemfile +43 -0
  16. data/examples/rails-3-2/README.rdoc +261 -0
  17. data/examples/rails-3-2/Rakefile +7 -0
  18. data/examples/rails-3-2/app/assets/images/rails.png +0 -0
  19. data/examples/rails-3-2/app/assets/javascripts/application.js +15 -0
  20. data/examples/rails-3-2/app/assets/stylesheets/application.css +13 -0
  21. data/examples/rails-3-2/app/controllers/application_controller.rb +3 -0
  22. data/examples/rails-3-2/app/helpers/application_helper.rb +2 -0
  23. data/examples/rails-3-2/app/mailers/.gitkeep +0 -0
  24. data/examples/rails-3-2/app/models/.gitkeep +0 -0
  25. data/examples/rails-3-2/app/views/layouts/application.html.erb +14 -0
  26. data/examples/rails-3-2/config.ru +4 -0
  27. data/examples/rails-3-2/config/application.rb +62 -0
  28. data/examples/rails-3-2/config/asset_sync.yml +21 -0
  29. data/examples/rails-3-2/config/boot.rb +6 -0
  30. data/examples/rails-3-2/config/database.yml +25 -0
  31. data/examples/rails-3-2/config/environment.rb +5 -0
  32. data/examples/rails-3-2/config/environments/development.rb +37 -0
  33. data/examples/rails-3-2/config/environments/production.rb +67 -0
  34. data/examples/rails-3-2/config/environments/test.rb +37 -0
  35. data/examples/rails-3-2/config/initializers/backtrace_silencers.rb +7 -0
  36. data/examples/rails-3-2/config/initializers/inflections.rb +15 -0
  37. data/examples/rails-3-2/config/initializers/mime_types.rb +5 -0
  38. data/examples/rails-3-2/config/initializers/multi_sync.rb +29 -0
  39. data/examples/rails-3-2/config/initializers/secret_token.rb +7 -0
  40. data/examples/rails-3-2/config/initializers/session_store.rb +8 -0
  41. data/examples/rails-3-2/config/initializers/wrap_parameters.rb +14 -0
  42. data/examples/rails-3-2/config/locales/en.yml +5 -0
  43. data/examples/rails-3-2/config/routes.rb +58 -0
  44. data/examples/rails-3-2/db/seeds.rb +7 -0
  45. data/examples/rails-3-2/lib/assets/.gitkeep +0 -0
  46. data/examples/rails-3-2/lib/tasks/.gitkeep +0 -0
  47. data/examples/rails-3-2/log/.gitkeep +0 -0
  48. data/examples/rails-3-2/public/404.html +26 -0
  49. data/examples/rails-3-2/public/422.html +26 -0
  50. data/examples/rails-3-2/public/500.html +25 -0
  51. data/examples/rails-3-2/public/favicon.ico +0 -0
  52. data/examples/rails-3-2/public/index.html +241 -0
  53. data/examples/rails-3-2/public/robots.txt +5 -0
  54. data/examples/rails-3-2/script/rails +6 -0
  55. data/examples/rails-3-2/test/fixtures/.gitkeep +0 -0
  56. data/examples/rails-3-2/test/functional/.gitkeep +0 -0
  57. data/examples/rails-3-2/test/integration/.gitkeep +0 -0
  58. data/examples/rails-3-2/test/performance/browsing_test.rb +12 -0
  59. data/examples/rails-3-2/test/test_helper.rb +13 -0
  60. data/examples/rails-3-2/test/unit/.gitkeep +0 -0
  61. data/examples/rails-4-0/.gitignore +16 -0
  62. data/examples/rails-4-0/Gemfile +50 -0
  63. data/examples/rails-4-0/README.rdoc +28 -0
  64. data/examples/rails-4-0/Rakefile +6 -0
  65. data/examples/rails-4-0/app/assets/images/.keep +0 -0
  66. data/examples/rails-4-0/app/assets/javascripts/application.js +16 -0
  67. data/examples/rails-4-0/app/assets/stylesheets/application.css +13 -0
  68. data/examples/rails-4-0/app/controllers/application_controller.rb +5 -0
  69. data/examples/rails-4-0/app/controllers/concerns/.keep +0 -0
  70. data/examples/rails-4-0/app/helpers/application_helper.rb +2 -0
  71. data/examples/rails-4-0/app/mailers/.keep +0 -0
  72. data/examples/rails-4-0/app/models/.keep +0 -0
  73. data/examples/rails-4-0/app/models/concerns/.keep +0 -0
  74. data/examples/rails-4-0/app/views/layouts/application.html.erb +14 -0
  75. data/examples/rails-4-0/config.ru +4 -0
  76. data/examples/rails-4-0/config/application.rb +24 -0
  77. data/examples/rails-4-0/config/asset_sync.yml +21 -0
  78. data/examples/rails-4-0/config/boot.rb +4 -0
  79. data/examples/rails-4-0/config/database.yml +25 -0
  80. data/examples/rails-4-0/config/environment.rb +5 -0
  81. data/examples/rails-4-0/config/environments/development.rb +29 -0
  82. data/examples/rails-4-0/config/environments/production.rb +80 -0
  83. data/examples/rails-4-0/config/environments/test.rb +36 -0
  84. data/examples/rails-4-0/config/initializers/backtrace_silencers.rb +7 -0
  85. data/examples/rails-4-0/config/initializers/filter_parameter_logging.rb +4 -0
  86. data/examples/rails-4-0/config/initializers/inflections.rb +16 -0
  87. data/examples/rails-4-0/config/initializers/mime_types.rb +5 -0
  88. data/examples/rails-4-0/config/initializers/multi_sync.rb +29 -0
  89. data/examples/rails-4-0/config/initializers/secret_token.rb +12 -0
  90. data/examples/rails-4-0/config/initializers/session_store.rb +3 -0
  91. data/examples/rails-4-0/config/initializers/wrap_parameters.rb +14 -0
  92. data/examples/rails-4-0/config/locales/en.yml +23 -0
  93. data/examples/rails-4-0/config/routes.rb +56 -0
  94. data/examples/rails-4-0/db/seeds.rb +7 -0
  95. data/examples/rails-4-0/lib/assets/.keep +0 -0
  96. data/examples/rails-4-0/lib/tasks/.keep +0 -0
  97. data/examples/rails-4-0/log/.keep +0 -0
  98. data/examples/rails-4-0/public/404.html +58 -0
  99. data/examples/rails-4-0/public/422.html +58 -0
  100. data/examples/rails-4-0/public/500.html +57 -0
  101. data/examples/rails-4-0/public/favicon.ico +0 -0
  102. data/examples/rails-4-0/public/robots.txt +5 -0
  103. data/examples/rails-4-0/test/controllers/.keep +0 -0
  104. data/examples/rails-4-0/test/fixtures/.keep +0 -0
  105. data/examples/rails-4-0/test/helpers/.keep +0 -0
  106. data/examples/rails-4-0/test/integration/.keep +0 -0
  107. data/examples/rails-4-0/test/mailers/.keep +0 -0
  108. data/examples/rails-4-0/test/models/.keep +0 -0
  109. data/examples/rails-4-0/test/test_helper.rb +15 -0
  110. data/gemfiles/middleman-3.1.x.gemfile +5 -0
  111. data/gemfiles/rails-3.2.x.gemfile +5 -0
  112. data/gemfiles/rails-4.0.x.gemfile +5 -0
  113. data/lib/multi_sync.rb +92 -0
  114. data/lib/multi_sync/client.rb +243 -0
  115. data/lib/multi_sync/configuration.rb +36 -0
  116. data/lib/multi_sync/environment.rb +37 -0
  117. data/lib/multi_sync/extensions/middleman.rb +22 -0
  118. data/lib/multi_sync/extensions/rails.rb +20 -0
  119. data/lib/multi_sync/extensions/rails/asset_sync.rb +44 -0
  120. data/lib/multi_sync/extensions/rails/railtie.rb +11 -0
  121. data/lib/multi_sync/logging.rb +60 -0
  122. data/lib/multi_sync/mixins/log_helper.rb +9 -0
  123. data/lib/multi_sync/mixins/pluralize_helper.rb +15 -0
  124. data/lib/multi_sync/resource.rb +84 -0
  125. data/lib/multi_sync/resources/local_resource.rb +30 -0
  126. data/lib/multi_sync/resources/remote_resource.rb +32 -0
  127. data/lib/multi_sync/source.rb +40 -0
  128. data/lib/multi_sync/sources/local_source.rb +17 -0
  129. data/lib/multi_sync/sources/manifest_source.rb +82 -0
  130. data/lib/multi_sync/target.rb +34 -0
  131. data/lib/multi_sync/targets/aws_target.rb +80 -0
  132. data/lib/multi_sync/targets/local_target.rb +58 -0
  133. data/lib/multi_sync/version.rb +3 -0
  134. data/lib/tasks/multi_sync_rails.rake +15 -0
  135. data/multi_sync.gemspec +35 -0
  136. data/spec/spec_helper.rb +22 -0
  137. data/spec/support/celluloid.rb +14 -0
  138. data/spec/support/fakefs.rb +7 -0
  139. data/spec/support/fog.rb +25 -0
  140. data/spec/support/pry.rb +6 -0
  141. data/spec/support/timecop.rb +2 -0
  142. data/spec/unit/multi_sync/client_spec.rb +301 -0
  143. data/spec/unit/multi_sync/configuration_spec.rb +92 -0
  144. data/spec/unit/multi_sync/resources/local_resource_spec.rb +55 -0
  145. data/spec/unit/multi_sync/sources/local_source_spec.rb +48 -0
  146. data/spec/unit/multi_sync/sources/manifest_source_spec.rb +57 -0
  147. data/spec/unit/multi_sync/targets/aws_target_spec.rb +60 -0
  148. data/spec/unit/multi_sync/targets/local_target_spec.rb +41 -0
  149. data/spec/unit/multi_sync_spec.rb +55 -0
  150. metadata +377 -0
@@ -0,0 +1,92 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync::Configuration, fakefs: true do
4
+
5
+ before do
6
+ FileUtils.mkdir_p('/tmp/fog')
7
+ File.open('/tmp/fog/.fog', 'w') do |f|
8
+ f << "default:\n"
9
+ f << " aws_access_key_id: AWS_ACCESS_KEY_ID_DEFAULT\n"
10
+ f << " aws_secret_access_key: AWS_SECRET_ACCESS_KEY_DEFAULT\n"
11
+ f << "alt:\n"
12
+ f << " aws_access_key_id: AWS_ACCESS_KEY_ID_ALT\n"
13
+ f << ' aws_secret_access_key: AWS_SECRET_ACCESS_KEY_ALT'
14
+ end
15
+ end
16
+
17
+ let(:configuration) { MultiSync::Configuration.new }
18
+
19
+ context :target_pool_size do
20
+ context :defaults do
21
+ describe :size do
22
+ subject { configuration.target_pool_size }
23
+ it { should > 1 }
24
+ end
25
+ end
26
+
27
+ context :custom do
28
+ before do
29
+ configuration.target_pool_size = 3
30
+ end
31
+
32
+ describe :size do
33
+ subject { configuration.target_pool_size }
34
+ it { should eq 3 }
35
+ end
36
+ end
37
+ end
38
+
39
+ context :credentials do
40
+ before do
41
+ Fog.instance_variable_set('@credential_path', nil)
42
+ Fog.instance_variable_set('@credentials', nil)
43
+ Fog.instance_variable_set('@credential', nil)
44
+ end
45
+
46
+ after do
47
+ ENV['FOG_RC'] = nil
48
+ ENV['FOG_CREDENTIAL'] = 'default'
49
+ Fog.instance_variable_set('@credential_path', nil)
50
+ Fog.instance_variable_set('@credentials', nil)
51
+ Fog.instance_variable_set('@credential', nil)
52
+ end
53
+
54
+ context 'with default fog credentials' do
55
+ before do
56
+ ENV['FOG_RC'] = nil
57
+ ENV['FOG_CREDENTIAL'] = 'default'
58
+ end
59
+
60
+ describe :credentials do
61
+ subject { configuration.credentials }
62
+ it { should be_empty }
63
+ end
64
+ end
65
+
66
+ context 'with custom .fog path set' do
67
+ before do
68
+ ENV['FOG_RC'] = '/tmp/fog/.fog'
69
+ ENV['FOG_CREDENTIAL'] = 'default'
70
+ end
71
+
72
+ describe :credentials do
73
+ subject { configuration.credentials }
74
+ its([:aws_access_key_id]) { should eq 'AWS_ACCESS_KEY_ID_DEFAULT' }
75
+ its([:aws_secret_access_key]) { should eq 'AWS_SECRET_ACCESS_KEY_DEFAULT' }
76
+ end
77
+ end
78
+
79
+ context "with 'alt' credential set" do
80
+ before do
81
+ ENV['FOG_RC'] = '/tmp/fog/.fog'
82
+ ENV['FOG_CREDENTIAL'] = 'alt'
83
+ end
84
+
85
+ describe :credentials do
86
+ subject { configuration.credentials }
87
+ its([:aws_access_key_id]) { should eq 'AWS_ACCESS_KEY_ID_ALT' }
88
+ its([:aws_secret_access_key]) { should eq 'AWS_SECRET_ACCESS_KEY_ALT' }
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync::LocalResource, fakefs: true do
4
+ before do
5
+ FileUtils.mkdir_p('/tmp/local-resource')
6
+ File.open('/tmp/local-resource/foo.txt', 'w') do |f| f.write('foo') end
7
+ end
8
+
9
+ describe :local do
10
+ context :valid do
11
+ it 'should return correct file details' do
12
+ resource = MultiSync::LocalResource.new(
13
+ with_root: Pathname.new('/tmp/local-resource/foo.txt'),
14
+ without_root: Pathname.new('foo.txt')
15
+ )
16
+ expect(resource.body).to eq 'foo'
17
+ expect(resource.content_length).to eq 3
18
+ expect(resource.content_type).to eq 'text/plain'
19
+ expect(resource.mtime).to eq Time.now
20
+ expect(resource.etag).to eq 'acbd18db4cc2f85cedef654fccc4a4d8'
21
+ end
22
+ end
23
+
24
+ context :known do
25
+ it 'should return correct file details (with overwritten info)' do
26
+ resource = MultiSync::LocalResource.new(
27
+ with_root: Pathname.new('/tmp/local-resource/foo.txt'),
28
+ without_root: Pathname.new('foo.txt'),
29
+ content_length: 42,
30
+ mtime: Time.now - 1,
31
+ etag: 'etag'
32
+ )
33
+ expect(resource.body).to eq 'foo'
34
+ expect(resource.content_length).to eq 42
35
+ expect(resource.content_type).to eq 'text/plain'
36
+ expect(resource.mtime).to eq Time.now - 1
37
+ expect(resource.etag).to eq 'etag'
38
+ end
39
+ end
40
+
41
+ context :unknown do
42
+ it 'should return default file details' do
43
+ resource = MultiSync::LocalResource.new(
44
+ with_root: Pathname.new('/tmp/local-resource/missing.txt'),
45
+ without_root: Pathname.new('missing.txt')
46
+ )
47
+ expect(resource.body).to eq nil
48
+ expect(resource.content_length).to eq 0
49
+ expect(resource.content_type).to eq 'text/plain'
50
+ expect(resource.mtime).to eq nil
51
+ expect(resource.etag).to eq nil
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync::LocalSource, fakefs: true do
4
+ before do
5
+ FileUtils.mkdir_p('/tmp/local-source')
6
+ File.open('/tmp/local-source/foo.txt', 'w') do |f| f.write('foo') end
7
+ File.open('/tmp/local-source/bar.txt', 'w') do |f| f.write('bar') end
8
+ FileUtils.mkdir_p('/tmp/local-source/in-a-dir')
9
+ File.open('/tmp/local-source/in-a-dir/baz.html', 'w') do |f| f.write('baz') end
10
+ File.open('/tmp/local-source/in-a-dir/baz.txt', 'w') do |f| f.write('baz') end
11
+ end
12
+
13
+ describe :files do
14
+ it 'should find files' do
15
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source')
16
+ expect(source.files).to have(4).files
17
+ end
18
+
19
+ it 'should ignore found files' do
20
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source', include: '**/*', exclude: '*/*.html')
21
+ expect(source.files).to have(3).files
22
+ end
23
+
24
+ it 'should find files (recursively)' do
25
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source', include: '**/*')
26
+ expect(source.files).to have(4).files
27
+ end
28
+
29
+ it 'should find files (by type)' do
30
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source', include: '**/*.txt')
31
+ expect(source.files).to have(3).files
32
+ end
33
+
34
+ context :with_root do
35
+ it 'should return files with the root' do
36
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source')
37
+ expect(source.files[0].path_with_root.to_s).to eq '/tmp/local-source/bar.txt'
38
+ end
39
+ end
40
+
41
+ context :without_root do
42
+ it 'should return files without the root' do
43
+ source = MultiSync::LocalSource.new(source_dir: '/tmp/local-source')
44
+ expect(source.files[0].path_without_root.to_s).to eq 'bar.txt'
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,57 @@
1
+ require 'spec_helper'
2
+ require 'sprockets'
3
+
4
+ describe MultiSync::ManifestSource do
5
+ before do
6
+ FileUtils.rm_rf('/tmp/local-manifest')
7
+
8
+ FileUtils.mkdir_p('/tmp/local-manifest')
9
+ File.open('/tmp/local-manifest/foo.txt', 'w') do |f| f.write('foo') end
10
+ File.open('/tmp/local-manifest/bar.txt', 'w') do |f| f.write('bar') end
11
+ FileUtils.mkdir_p('/tmp/local-manifest/in-a-dir')
12
+ File.open('/tmp/local-manifest/in-a-dir/baz.html', 'w') do |f| f.write('baz') end
13
+ File.open('/tmp/local-manifest/in-a-dir/baz.txt', 'w') do |f| f.write('baz') end
14
+
15
+ env = Sprockets::Environment.new('.') do |e|
16
+ e.append_path('/tmp/local-manifest')
17
+ end
18
+ manifest = Sprockets::Manifest.new(env, '/tmp/local-manifest')
19
+ manifest.compile('foo.txt', 'bar.txt', 'in-a-dir/baz.html', 'in-a-dir/baz.txt')
20
+ end
21
+
22
+ describe :files do
23
+ it 'should find files' do
24
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest')
25
+ expect(source.files).to have(4).files
26
+ end
27
+
28
+ it 'should ignore found files' do
29
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest', include: '**/*', exclude: '*/*.html')
30
+ expect(source.files).to have(3).files
31
+ end
32
+
33
+ it 'should find files (recursively)' do
34
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest', include: '**/*')
35
+ expect(source.files).to have(4).files
36
+ end
37
+
38
+ it 'should find files (by type)' do
39
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest', include: '**/*.txt')
40
+ expect(source.files).to have(3).files
41
+ end
42
+
43
+ context :with_root do
44
+ it 'should return files with the root' do
45
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest')
46
+ expect(source.files[0].path_with_root.to_s).to include '/tmp/local-manifest'
47
+ end
48
+ end
49
+
50
+ context :without_root do
51
+ it 'should return files without the root' do
52
+ source = MultiSync::ManifestSource.new(source_dir: '/tmp/local-manifest')
53
+ expect(source.files[0].path_without_root.to_s).to_not include '/tmp/local-manifest'
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync::AwsTarget, fakefs: true, fog: true do
4
+ before do
5
+ FileUtils.mkdir_p('/tmp/aws-target')
6
+ File.open('/tmp/aws-target/foo.txt', 'w') do |f| f.write('foo') end
7
+ File.open('/tmp/aws-target/bar.txt', 'w') do |f| f.write('bar') end
8
+ FileUtils.mkdir_p('/tmp/aws-target/in-a-dir')
9
+ File.open('/tmp/aws-target/in-a-dir/baz.html', 'w') do |f| f.write('baz') end
10
+
11
+ connection = Fog::Storage.new(
12
+ provider: :aws,
13
+ region: 'us-east-1',
14
+ aws_access_key_id: 'xxx',
15
+ aws_secret_access_key: 'xxx'
16
+ )
17
+
18
+ directory = connection.directories.create(key: 'multi_sync', public: true)
19
+
20
+ Dir.glob('/tmp/aws-target/**/*').reject { |path| File.directory?(path) }.each do |path|
21
+ directory.files.create(
22
+ key: path.gsub('/tmp/', ''),
23
+ body: File.open(path, 'r'),
24
+ public: true
25
+ )
26
+ end
27
+ end
28
+
29
+ describe :files do
30
+ context :aws do
31
+ let(:target) {
32
+ MultiSync::AwsTarget.new(
33
+ target_dir: 'multi_sync',
34
+ destination_dir: 'aws-target',
35
+ credentials: {
36
+ region: 'us-east-1',
37
+ aws_access_key_id: 'xxx',
38
+ aws_secret_access_key: 'xxx'
39
+ }
40
+ )
41
+ }
42
+
43
+ it 'should find files' do
44
+ expect(target.files).to have(3).files
45
+ end
46
+
47
+ context :with_root do
48
+ it 'should return files with the root' do
49
+ expect(target.files[0].path_with_root.to_s).to eq 'multi_sync/aws-target/bar.txt'
50
+ end
51
+ end
52
+
53
+ context :without_root do
54
+ it 'should return files without the root' do
55
+ expect(target.files[0].path_without_root.to_s).to eq 'bar.txt'
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync::LocalTarget, fakefs: true do
4
+ before do
5
+ FileUtils.mkdir_p('/tmp/local-target')
6
+ File.open('/tmp/local-target/foo.txt', 'w') do |f| f.write('foo') end
7
+ File.open('/tmp/local-target/bar.txt', 'w') do |f| f.write('bar') end
8
+ FileUtils.mkdir_p('/tmp/local-target/in-a-dir')
9
+ File.open('/tmp/local-target/in-a-dir/baz.html', 'w') do |f| f.write('baz') end
10
+ end
11
+
12
+ describe :files do
13
+ context :local do
14
+ let(:target) {
15
+ MultiSync::LocalTarget.new(
16
+ target_dir: '/tmp',
17
+ destination_dir: 'local-target',
18
+ credentials: {
19
+ local_root: '/tmp'
20
+ }
21
+ )
22
+ }
23
+
24
+ it 'should find files' do
25
+ expect(target.files).to have(3).files
26
+ end
27
+
28
+ context :with_root do
29
+ it 'should return files with the root' do
30
+ expect(target.files[0].path_with_root.to_s).to eq '/tmp/local-target/bar.txt'
31
+ end
32
+ end
33
+
34
+ context :without_root do
35
+ it 'should return files without the root' do
36
+ expect(target.files[0].path_without_root.to_s).to eq 'bar.txt'
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+
3
+ describe MultiSync do
4
+
5
+ context :methods do
6
+
7
+ describe :version do
8
+ subject { MultiSync::VERSION }
9
+ it { should be_kind_of(String) }
10
+ end
11
+
12
+ describe :logger do
13
+ subject { MultiSync.respond_to?(:logger) }
14
+ it { should be_true }
15
+ end
16
+
17
+ describe :environment do
18
+ subject { MultiSync.respond_to?(:environment) }
19
+ it { should be_true }
20
+ end
21
+
22
+ describe :credentials do
23
+ subject { MultiSync.respond_to?(:credentials) }
24
+ it { should be_true }
25
+ end
26
+
27
+ describe :run do
28
+ subject { MultiSync.respond_to?(:run) }
29
+ it { should be_true }
30
+ end
31
+
32
+ describe :configure do
33
+ subject { MultiSync.respond_to?(:configure) }
34
+ it { should be_true }
35
+ end
36
+
37
+ end
38
+
39
+ context :configure do
40
+
41
+ it 'should allow you to set configuration' do
42
+
43
+ MultiSync.configure do |config|
44
+ config.verbose = true
45
+ config.target_pool_size = 2
46
+ end
47
+
48
+ expect(MultiSync.verbose).to be_true
49
+ expect(MultiSync.target_pool_size).to be 2
50
+
51
+ end
52
+
53
+ end
54
+
55
+ end
metadata ADDED
@@ -0,0 +1,377 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: multi_sync
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Karl Freeman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fog
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: lazily
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: virtus
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.5'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: celluloid
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.15'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.15'
69
+ - !ruby/object:Gem::Dependency
70
+ name: multi_mime
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: multi_json
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.7'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.7'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.5'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.5'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '10.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '10.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: kramdown
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0.14'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0.14'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: yard
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: A flexible synchronisation library for your assets
182
+ email:
183
+ - karlfreeman@gmail.com
184
+ executables: []
185
+ extensions: []
186
+ extra_rdoc_files: []
187
+ files:
188
+ - ".document"
189
+ - ".gitignore"
190
+ - ".rubocop.yml"
191
+ - ".travis.yml"
192
+ - ".yardopts"
193
+ - CHANGELOG.md
194
+ - CONTRIBUTING.md
195
+ - Gemfile
196
+ - LICENSE.md
197
+ - README.md
198
+ - Rakefile
199
+ - examples/custom.rb
200
+ - examples/rails-3-2/.gitignore
201
+ - examples/rails-3-2/Gemfile
202
+ - examples/rails-3-2/README.rdoc
203
+ - examples/rails-3-2/Rakefile
204
+ - examples/rails-3-2/app/assets/images/rails.png
205
+ - examples/rails-3-2/app/assets/javascripts/application.js
206
+ - examples/rails-3-2/app/assets/stylesheets/application.css
207
+ - examples/rails-3-2/app/controllers/application_controller.rb
208
+ - examples/rails-3-2/app/helpers/application_helper.rb
209
+ - examples/rails-3-2/app/mailers/.gitkeep
210
+ - examples/rails-3-2/app/models/.gitkeep
211
+ - examples/rails-3-2/app/views/layouts/application.html.erb
212
+ - examples/rails-3-2/config.ru
213
+ - examples/rails-3-2/config/application.rb
214
+ - examples/rails-3-2/config/asset_sync.yml
215
+ - examples/rails-3-2/config/boot.rb
216
+ - examples/rails-3-2/config/database.yml
217
+ - examples/rails-3-2/config/environment.rb
218
+ - examples/rails-3-2/config/environments/development.rb
219
+ - examples/rails-3-2/config/environments/production.rb
220
+ - examples/rails-3-2/config/environments/test.rb
221
+ - examples/rails-3-2/config/initializers/backtrace_silencers.rb
222
+ - examples/rails-3-2/config/initializers/inflections.rb
223
+ - examples/rails-3-2/config/initializers/mime_types.rb
224
+ - examples/rails-3-2/config/initializers/multi_sync.rb
225
+ - examples/rails-3-2/config/initializers/secret_token.rb
226
+ - examples/rails-3-2/config/initializers/session_store.rb
227
+ - examples/rails-3-2/config/initializers/wrap_parameters.rb
228
+ - examples/rails-3-2/config/locales/en.yml
229
+ - examples/rails-3-2/config/routes.rb
230
+ - examples/rails-3-2/db/seeds.rb
231
+ - examples/rails-3-2/lib/assets/.gitkeep
232
+ - examples/rails-3-2/lib/tasks/.gitkeep
233
+ - examples/rails-3-2/log/.gitkeep
234
+ - examples/rails-3-2/public/404.html
235
+ - examples/rails-3-2/public/422.html
236
+ - examples/rails-3-2/public/500.html
237
+ - examples/rails-3-2/public/favicon.ico
238
+ - examples/rails-3-2/public/index.html
239
+ - examples/rails-3-2/public/robots.txt
240
+ - examples/rails-3-2/script/rails
241
+ - examples/rails-3-2/test/fixtures/.gitkeep
242
+ - examples/rails-3-2/test/functional/.gitkeep
243
+ - examples/rails-3-2/test/integration/.gitkeep
244
+ - examples/rails-3-2/test/performance/browsing_test.rb
245
+ - examples/rails-3-2/test/test_helper.rb
246
+ - examples/rails-3-2/test/unit/.gitkeep
247
+ - examples/rails-4-0/.gitignore
248
+ - examples/rails-4-0/Gemfile
249
+ - examples/rails-4-0/README.rdoc
250
+ - examples/rails-4-0/Rakefile
251
+ - examples/rails-4-0/app/assets/images/.keep
252
+ - examples/rails-4-0/app/assets/javascripts/application.js
253
+ - examples/rails-4-0/app/assets/stylesheets/application.css
254
+ - examples/rails-4-0/app/controllers/application_controller.rb
255
+ - examples/rails-4-0/app/controllers/concerns/.keep
256
+ - examples/rails-4-0/app/helpers/application_helper.rb
257
+ - examples/rails-4-0/app/mailers/.keep
258
+ - examples/rails-4-0/app/models/.keep
259
+ - examples/rails-4-0/app/models/concerns/.keep
260
+ - examples/rails-4-0/app/views/layouts/application.html.erb
261
+ - examples/rails-4-0/bin/bundle
262
+ - examples/rails-4-0/bin/rails
263
+ - examples/rails-4-0/bin/rake
264
+ - examples/rails-4-0/config.ru
265
+ - examples/rails-4-0/config/application.rb
266
+ - examples/rails-4-0/config/asset_sync.yml
267
+ - examples/rails-4-0/config/boot.rb
268
+ - examples/rails-4-0/config/database.yml
269
+ - examples/rails-4-0/config/environment.rb
270
+ - examples/rails-4-0/config/environments/development.rb
271
+ - examples/rails-4-0/config/environments/production.rb
272
+ - examples/rails-4-0/config/environments/test.rb
273
+ - examples/rails-4-0/config/initializers/backtrace_silencers.rb
274
+ - examples/rails-4-0/config/initializers/filter_parameter_logging.rb
275
+ - examples/rails-4-0/config/initializers/inflections.rb
276
+ - examples/rails-4-0/config/initializers/mime_types.rb
277
+ - examples/rails-4-0/config/initializers/multi_sync.rb
278
+ - examples/rails-4-0/config/initializers/secret_token.rb
279
+ - examples/rails-4-0/config/initializers/session_store.rb
280
+ - examples/rails-4-0/config/initializers/wrap_parameters.rb
281
+ - examples/rails-4-0/config/locales/en.yml
282
+ - examples/rails-4-0/config/routes.rb
283
+ - examples/rails-4-0/db/seeds.rb
284
+ - examples/rails-4-0/lib/assets/.keep
285
+ - examples/rails-4-0/lib/tasks/.keep
286
+ - examples/rails-4-0/log/.keep
287
+ - examples/rails-4-0/public/404.html
288
+ - examples/rails-4-0/public/422.html
289
+ - examples/rails-4-0/public/500.html
290
+ - examples/rails-4-0/public/favicon.ico
291
+ - examples/rails-4-0/public/robots.txt
292
+ - examples/rails-4-0/test/controllers/.keep
293
+ - examples/rails-4-0/test/fixtures/.keep
294
+ - examples/rails-4-0/test/helpers/.keep
295
+ - examples/rails-4-0/test/integration/.keep
296
+ - examples/rails-4-0/test/mailers/.keep
297
+ - examples/rails-4-0/test/models/.keep
298
+ - examples/rails-4-0/test/test_helper.rb
299
+ - gemfiles/middleman-3.1.x.gemfile
300
+ - gemfiles/rails-3.2.x.gemfile
301
+ - gemfiles/rails-4.0.x.gemfile
302
+ - lib/multi_sync.rb
303
+ - lib/multi_sync/client.rb
304
+ - lib/multi_sync/configuration.rb
305
+ - lib/multi_sync/environment.rb
306
+ - lib/multi_sync/extensions/middleman.rb
307
+ - lib/multi_sync/extensions/rails.rb
308
+ - lib/multi_sync/extensions/rails/asset_sync.rb
309
+ - lib/multi_sync/extensions/rails/railtie.rb
310
+ - lib/multi_sync/logging.rb
311
+ - lib/multi_sync/mixins/log_helper.rb
312
+ - lib/multi_sync/mixins/pluralize_helper.rb
313
+ - lib/multi_sync/resource.rb
314
+ - lib/multi_sync/resources/local_resource.rb
315
+ - lib/multi_sync/resources/remote_resource.rb
316
+ - lib/multi_sync/source.rb
317
+ - lib/multi_sync/sources/local_source.rb
318
+ - lib/multi_sync/sources/manifest_source.rb
319
+ - lib/multi_sync/target.rb
320
+ - lib/multi_sync/targets/aws_target.rb
321
+ - lib/multi_sync/targets/local_target.rb
322
+ - lib/multi_sync/version.rb
323
+ - lib/tasks/multi_sync_rails.rake
324
+ - multi_sync.gemspec
325
+ - spec/spec_helper.rb
326
+ - spec/support/celluloid.rb
327
+ - spec/support/fakefs.rb
328
+ - spec/support/fog.rb
329
+ - spec/support/pry.rb
330
+ - spec/support/timecop.rb
331
+ - spec/unit/multi_sync/client_spec.rb
332
+ - spec/unit/multi_sync/configuration_spec.rb
333
+ - spec/unit/multi_sync/resources/local_resource_spec.rb
334
+ - spec/unit/multi_sync/sources/local_source_spec.rb
335
+ - spec/unit/multi_sync/sources/manifest_source_spec.rb
336
+ - spec/unit/multi_sync/targets/aws_target_spec.rb
337
+ - spec/unit/multi_sync/targets/local_target_spec.rb
338
+ - spec/unit/multi_sync_spec.rb
339
+ homepage: https://github.com/karlfreeman/multi_sync
340
+ licenses:
341
+ - MIT
342
+ metadata: {}
343
+ post_install_message:
344
+ rdoc_options: []
345
+ require_paths:
346
+ - lib
347
+ required_ruby_version: !ruby/object:Gem::Requirement
348
+ requirements:
349
+ - - ">="
350
+ - !ruby/object:Gem::Version
351
+ version: 1.9.3
352
+ required_rubygems_version: !ruby/object:Gem::Requirement
353
+ requirements:
354
+ - - ">="
355
+ - !ruby/object:Gem::Version
356
+ version: '0'
357
+ requirements: []
358
+ rubyforge_project:
359
+ rubygems_version: 2.2.0
360
+ signing_key:
361
+ specification_version: 4
362
+ summary: A flexible synchronisation library for your assets
363
+ test_files:
364
+ - spec/spec_helper.rb
365
+ - spec/support/celluloid.rb
366
+ - spec/support/fakefs.rb
367
+ - spec/support/fog.rb
368
+ - spec/support/pry.rb
369
+ - spec/support/timecop.rb
370
+ - spec/unit/multi_sync/client_spec.rb
371
+ - spec/unit/multi_sync/configuration_spec.rb
372
+ - spec/unit/multi_sync/resources/local_resource_spec.rb
373
+ - spec/unit/multi_sync/sources/local_source_spec.rb
374
+ - spec/unit/multi_sync/sources/manifest_source_spec.rb
375
+ - spec/unit/multi_sync/targets/aws_target_spec.rb
376
+ - spec/unit/multi_sync/targets/local_target_spec.rb
377
+ - spec/unit/multi_sync_spec.rb