asset_sync 2.12.1 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fbb82cb5023ce3d6e1f088aa62fa32718f8e743977c31b773e3f2a324a0a397
4
- data.tar.gz: 504e104e3dfe839bb19b0794a7af8f4bb932fd7f7500347374c14b8862e5ae43
3
+ metadata.gz: e9d768c5e2075b08498c16af32ad4fb3f1006d4c68bd88846a60c843309a8ef3
4
+ data.tar.gz: 87a0b335fd8fc8903f30ce171d78d7beff4a87cb7fe0962bdf0c68dcf537c277
5
5
  SHA512:
6
- metadata.gz: 2945ac417bfcc350068b1c9ce3c59781f0cd7bb50bd606919803e55602a81b06d6d6fed24de0c7e62ca695a83901481d296a9ae20031b5ab1e9edfc61a69823a
7
- data.tar.gz: b96f8274e66d1d7ec2ab182fdcb3833edd7c24b9dc9d9fd9d038a3db8608dc1102a23b2998ec5c9749e89fe6d12212488dc9733ec927328fcc0f388bf84df357
6
+ metadata.gz: 24dba26c0c958ce65353daccf498fba8b5689a778d9e091325eeb323677f8057ade739e37c60a7c1e8d66d3bae36d87601da6d2bd569bf06559df89cdfca24f9
7
+ data.tar.gz: eca6579e50a37d8ce887cb5a44c068db42a387d04b58badb9b371d77944fd7f1a95c57132a0af4863f63efe62a7403f68b74d512145da78ca4aeee060344e17c
@@ -2,6 +2,9 @@
2
2
  # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
3
3
  sudo: false
4
4
  language: ruby
5
+ arch:
6
+ - amd64
7
+ - ppc64le
5
8
  cache:
6
9
  bundler: true
7
10
  rvm:
@@ -18,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [2.13.0] - 2020-12-14
22
+
23
+ ### Added
24
+
25
+ - Add Backblaze B2 Cloud Storage support
26
+ (https://github.com/AssetSync/asset_sync/pull/410)
27
+
28
+
21
29
  ## [2.12.1] - 2020-06-17
22
30
 
23
31
  ### Fixed
@@ -978,7 +986,8 @@ Changes:
978
986
  * Merge branch 'sinatra'
979
987
 
980
988
 
981
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.12.1...HEAD
989
+ [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.13.0...HEAD
990
+ [2.13.0]: https://github.com/AssetSync/asset_sync/compare/v2.12.1...v2.13.0
982
991
  [2.12.1]: https://github.com/AssetSync/asset_sync/compare/v2.12.0...v2.12.1
983
992
  [2.12.0]: https://github.com/AssetSync/asset_sync/compare/v2.11.0...v2.12.0
984
993
  [2.11.0]: https://github.com/AssetSync/asset_sync/compare/v2.10.0...v2.11.0
data/README.md CHANGED
@@ -38,6 +38,13 @@ gem "asset_sync"
38
38
  gem "fog-azure-rm"
39
39
  ```
40
40
 
41
+ To use Backblaze B2, insert these.
42
+
43
+ ``` ruby
44
+ gem "asset_sync"
45
+ gem "fog-backblaze"
46
+ ```
47
+
41
48
 
42
49
  ### Extended Installation (Faster sync with turbosprockets)
43
50
 
@@ -77,6 +84,13 @@ Or, to use Azure Blob storage, configure as this.
77
84
  config.action_controller.asset_host = "//#{ENV['AZURE_STORAGE_ACCOUNT_NAME']}.blob.core.windows.net/#{ENV['FOG_DIRECTORY']}"
78
85
  ```
79
86
 
87
+ Or, to use Backblaze B2, configure as this.
88
+
89
+ ``` ruby
90
+ #config/environments/production.rb
91
+ config.action_controller.asset_host = "//f000.backblazeb2.com/file/#{ENV['FOG_DIRECTORY']}"
92
+ ```
93
+
80
94
 
81
95
  On **HTTPS**: the exclusion of any protocol in the asset host declaration above will allow browsers to choose the transport mechanism on the fly. So if your application is available under both HTTP and HTTPS the assets will be served to match.
82
96
 
@@ -170,7 +184,7 @@ heroku config:add FOG_DIRECTORY=xxxx
170
184
  heroku config:add FOG_PROVIDER=Rackspace
171
185
  ```
172
186
 
173
- Google Storage Cloud configuration is supported as well. The preferred option is using the [GCS JSON API](https://github.com/fog/fog-google#storage) which requires that you create an appropriate service account, generate the signatures and make them accessible to asset sync at the prescribed location
187
+ Google Storage Cloud configuration is supported as well. The preferred option is using the [GCS JSON API](https://github.com/fog/fog-google#storage) which requires that you create an appropriate service account, generate the signatures and make them accessible to asset sync at the prescribed location
174
188
 
175
189
  ```bash
176
190
  heroku config:add FOG_PROVIDER=Google
@@ -199,6 +213,7 @@ Run the included Rake task to generate a starting point.
199
213
  rails g asset_sync:install --provider=Rackspace
200
214
  rails g asset_sync:install --provider=AWS
201
215
  rails g asset_sync:install --provider=AzureRM
216
+ rails g asset_sync:install --provider=Backblaze
202
217
 
203
218
  The generator will create a Rails initializer at `config/initializers/asset_sync.rb`.
204
219
 
@@ -245,7 +260,7 @@ AssetSync.configure do |config|
245
260
  #
246
261
  # Upload files concurrently
247
262
  # config.concurrent_uploads = false
248
- #
263
+ #
249
264
  # Number of threads when concurrent_uploads is enabled
250
265
  # config.concurrent_uploads_max_threads = 10
251
266
  #
@@ -274,6 +289,7 @@ Run the included Rake task to generate a starting point.
274
289
  rails g asset_sync:install --use-yml --provider=Rackspace
275
290
  rails g asset_sync:install --use-yml --provider=AWS
276
291
  rails g asset_sync:install --use-yml --provider=AzureRM
292
+ rails g asset_sync:install --use-yml --provider=Backblaze
277
293
 
278
294
  The generator will create a YAML file at `config/asset_sync.yml`.
279
295
 
@@ -383,7 +399,7 @@ To customize the overrides:
383
399
  AssetSync.configure do |config|
384
400
  # Clear the default overrides
385
401
  config.file_ext_to_mime_type_overrides.clear
386
-
402
+
387
403
  # Add/Edit overrides
388
404
  # Will call `#to_s` for inputs
389
405
  config.file_ext_to_mime_type_overrides.add(:js, :"application/x-javascript")
@@ -392,7 +408,7 @@ end
392
408
  The blocks are run when local files are being scanned and uploaded
393
409
 
394
410
  #### Fog (Required)
395
- * **fog\_provider**: your storage provider *AWS* (S3) or *Rackspace* (Cloud Files) or *Google* (Google Storage) or *AzureRM* (Azure Blob)
411
+ * **fog\_provider**: your storage provider *AWS* (S3) or *Rackspace* (Cloud Files) or *Google* (Google Storage) or *AzureRM* (Azure Blob) or *Backblaze* (Backblaze B2)
396
412
  * **fog\_directory**: your bucket name
397
413
 
398
414
  #### Fog (Optional)
@@ -426,6 +442,11 @@ When using the S3 API
426
442
  * **azure\_storage\_account\_name**: your Azure Blob access key
427
443
  * **azure\_storage\_access\_key**: your Azure Blob access secret
428
444
 
445
+ #### Backblaze B2
446
+ * **b2\_key\_id**: Your Backblaze B2 key ID
447
+ * **b2\_key\_token**: Your Backblaze B2 key token
448
+ * **b2\_bucket\_id**: Your Backblaze B2 bucket ID
449
+
429
450
  #### Rackspace (Optional)
430
451
 
431
452
  * **rackspace\_auth\_url**: Rackspace auth URL, for Rackspace London use: `https://lon.identity.api.rackspacecloud.com/v2.0`
@@ -551,7 +572,7 @@ AssetSync.configure do |config|
551
572
  config.prefix = 'assets'
552
573
  # Can be a `Pathname` or `String`
553
574
  # Will be converted into an `Pathname`
554
- # If relative, will be converted into an absolute path
575
+ # If relative, will be converted into an absolute path
555
576
  # via `::Rails.root` or `::Dir.pwd`
556
577
  config.public_path = Pathname('./public')
557
578
  end
@@ -622,7 +643,7 @@ Make sure you have a .env file with these details:-
622
643
  AWS_SECRET_ACCESS_KEY=<yoursecretkey>
623
644
  FOG_DIRECTORY=<yourbucket>
624
645
  FOG_REGION=<youbucketregion>
625
-
646
+
626
647
  # for AzureRM provider
627
648
  AZURE_STORAGE_ACCOUNT_NAME=<youraccountname>
628
649
  AZURE_STORAGE_ACCESS_KEY=<youraccesskey>
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
 
29
29
  s.add_development_dependency "fog-aws"
30
30
  s.add_development_dependency "fog-azure-rm"
31
+ s.add_development_dependency "fog-backblaze"
31
32
 
32
33
  s.add_development_dependency "uglifier"
33
34
  s.add_development_dependency "appraisal"
@@ -55,6 +55,11 @@ module AssetSync
55
55
  attr_accessor :azure_storage_account_name
56
56
  attr_accessor :azure_storage_access_key
57
57
 
58
+ # Backblaze B2 with Fog::Backblaze
59
+ attr_accessor :b2_key_id
60
+ attr_accessor :b2_key_token
61
+ attr_accessor :b2_bucket_id
62
+
58
63
  validates :existing_remote_files, :inclusion => { :in => %w(keep delete ignore) }
59
64
 
60
65
  validates :fog_provider, :presence => true
@@ -153,6 +158,10 @@ module AssetSync
153
158
  fog_provider =~ /azurerm/i
154
159
  end
155
160
 
161
+ def backblaze?
162
+ fog_provider =~ /backblaze/i
163
+ end
164
+
156
165
  def cache_asset_regexp=(cache_asset_regexp)
157
166
  self.cache_asset_regexps = [cache_asset_regexp]
158
167
  end
@@ -233,6 +242,10 @@ module AssetSync
233
242
  self.azure_storage_account_name = yml['azure_storage_account_name'] if yml.has_key?("azure_storage_account_name")
234
243
  self.azure_storage_access_key = yml['azure_storage_access_key'] if yml.has_key?("azure_storage_access_key")
235
244
 
245
+ self.b2_key_id = yml['b2_key_id'] if yml.has_key?("b2_key_id")
246
+ self.b2_key_token = yml['b2_key_token'] if yml.has_key?("b2_key_token")
247
+ self.b2_bucket_id = yml['b2_bucket_id'] if yml.has_key?("b2_bucket_id")
248
+
236
249
  # TODO deprecate the other old style config settings. FML.
237
250
  self.aws_access_key_id = yml["aws_access_key"] if yml.has_key?("aws_access_key")
238
251
  self.aws_secret_access_key = yml["aws_access_secret"] if yml.has_key?("aws_access_secret")
@@ -293,6 +306,13 @@ module AssetSync
293
306
  :azure_storage_access_key => azure_storage_access_key,
294
307
  })
295
308
  options.merge!({:environment => fog_region}) if fog_region
309
+ elsif backblaze?
310
+ require 'fog/backblaze'
311
+ options.merge!({
312
+ :b2_key_id => b2_key_id,
313
+ :b2_key_token => b2_key_token,
314
+ :b2_bucket_id => b2_bucket_id,
315
+ })
296
316
  else
297
317
  raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS, Rackspace and Google are supported currently."
298
318
  end
@@ -36,6 +36,10 @@ module AssetSync
36
36
  config.azure_storage_account_name = ENV['AZURE_STORAGE_ACCOUNT_NAME'] if ENV.has_key?('AZURE_STORAGE_ACCOUNT_NAME')
37
37
  config.azure_storage_access_key = ENV['AZURE_STORAGE_ACCESS_KEY'] if ENV.has_key?('AZURE_STORAGE_ACCESS_KEY')
38
38
 
39
+ config.b2_key_id = ENV['B2_KEY_ID'] if ENV.has_key?('B2_KEY_ID')
40
+ config.b2_key_token = ENV['B2_KEY_TOKEN'] if ENV.has_key?('B2_KEY_TOKEN')
41
+ config.b2_bucket_id = ENV['B2_BUCKET_ID'] if ENV.has_key?('B2_BUCKET_ID')
42
+
39
43
  config.enabled = (ENV['ASSET_SYNC_ENABLED'] == 'true') if ENV.has_key?('ASSET_SYNC_ENABLED')
40
44
 
41
45
  config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
@@ -22,7 +22,13 @@ module AssetSync
22
22
 
23
23
  def bucket
24
24
  # fixes: https://github.com/rumblelabs/asset_sync/issues/18
25
- @bucket ||= connection.directories.get(self.config.fog_directory, :prefix => self.config.assets_prefix)
25
+
26
+ @bucket ||= if self.config.backblaze?
27
+ connection.directories.get(self.config.fog_directory)
28
+ else
29
+ connection.directories.get(self.config.fog_directory, :prefix => self.config.assets_prefix)
30
+ end
31
+
26
32
  end
27
33
 
28
34
  def log(msg)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssetSync
4
- VERSION = "2.12.1"
4
+ VERSION = "2.13.0"
5
5
  end
@@ -5,7 +5,7 @@ module AssetSync
5
5
 
6
6
  # Commandline options can be defined here using Thor-like options:
7
7
  class_option :use_yml, :type => :boolean, :default => false, :desc => "Use YML file instead of Rails Initializer"
8
- class_option :provider, :type => :string, :default => "AWS", :desc => "Generate with support for 'AWS', 'Rackspace', 'Google', or 'AzureRM"
8
+ class_option :provider, :type => :string, :default => "AWS", :desc => "Generate with support for 'AWS', 'Rackspace', 'Google', 'AzureRM', or 'Backblaze'"
9
9
 
10
10
  def self.source_root
11
11
  @source_root ||= File.join(File.dirname(__FILE__), 'templates')
@@ -27,6 +27,10 @@ module AssetSync
27
27
  options[:provider] == 'AzureRM'
28
28
  end
29
29
 
30
+ def backblaze?
31
+ options[:provider] == 'Backblaze'
32
+ end
33
+
30
34
  def aws_access_key_id
31
35
  "<%= ENV['AWS_ACCESS_KEY_ID'] %>"
32
36
  end
@@ -63,6 +67,18 @@ module AssetSync
63
67
  "<%= ENV['AZURE_STORAGE_ACCESS_KEY'] %>"
64
68
  end
65
69
 
70
+ def b2_key_id
71
+ "<%= ENV['B2_KEY_ID'] %>"
72
+ end
73
+
74
+ def b2_key_token
75
+ "<%= ENV['B2_KEY_TOKEN'] %>"
76
+ end
77
+
78
+ def b2_bucket_id
79
+ "<%= ENV['B2_BUCKET_ID'] %>"
80
+ end
81
+
66
82
  def app_name
67
83
  @app_name ||= Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, "").downcase
68
84
  end
@@ -35,6 +35,12 @@ if defined?(AssetSync)
35
35
  config.azure_storage_account_name = ENV['AZURE_STORAGE_ACCOUNT_NAME']
36
36
  config.azure_storage_access_key = ENV['AZURE_STORAGE_ACCESS_KEY']
37
37
 
38
+ <%- elsif backblaze? -%>
39
+ config.fog_provider = 'Backblaze'
40
+ config.b2_key_id = ENV['B2_KEY_ID']
41
+ config.b2_key_token = ENV['B2_KEY_TOKEN']
42
+ config.b2_bucket_id = ENV['B2_BUCKET_ID']
43
+
38
44
  # config.fog_directory specifies container name of Azure Blob storage
39
45
  <%- end -%>
40
46
  config.fog_directory = ENV['FOG_DIRECTORY']
@@ -32,8 +32,13 @@ defaults: &defaults
32
32
  fog_provider: 'AzureRM'
33
33
  azure_storage_account_name: "<%= azure_storage_account_name %>"
34
34
  azure_storage_access_key: "<%= azure_storage_access_key %>"
35
-
36
35
  # fog_directory specifies container name of Azure Blob storage
36
+ <%- elsif backblaze? -%>
37
+ fog_provider: Backblaze
38
+ b2_key_id: "<%= b2_key_id %>"
39
+ b2_key_token: "<%= b2_key_token %>"
40
+ b2_bucket_id: "<%= b2_bucket_id %>"
41
+ # fog_directory specifies container name of Backblaze B2 Bucket
37
42
  <%- end -%>
38
43
  fog_directory: "<%= app_name %>-assets"
39
44
 
@@ -0,0 +1,20 @@
1
+ defaults: &defaults
2
+ fog_provider: "Backblaze"
3
+ b2_key_id: 'xxxx'
4
+ b2_key_token: 'zzzz'
5
+ b2_bucket_id: '1234'
6
+
7
+ development:
8
+ <<: *defaults
9
+ fog_directory: "rails_app_development"
10
+ existing_remote_files: keep
11
+
12
+ test:
13
+ <<: *defaults
14
+ fog_directory: "rails_app_test"
15
+ existing_remote_files: keep
16
+
17
+ production:
18
+ <<: *defaults
19
+ fog_directory: "rails_app_production"
20
+ existing_remote_files: delete
@@ -0,0 +1,74 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require "fog/backblaze"
3
+
4
+ def bucket(name)
5
+ options = {
6
+ :provider => 'Backblaze',
7
+ :b2_key_id => ENV['B2_KEY_ID'],
8
+ :b2_key_token => ENV['B2_KEY_TOKEN'],
9
+ :b2_bucket_id => ENV['B2_BUCKET_ID']
10
+ }
11
+ options.merge!({ :environment => ENV['FOG_REGION'] }) if ENV.has_key?('FOG_REGION')
12
+
13
+ connection = Fog::Storage.new(options)
14
+ connection.directories.get(ENV['FOG_DIRECTORY'])
15
+ end
16
+
17
+ def execute(command)
18
+ app_path = File.expand_path("../../dummy_app", __FILE__)
19
+ Dir.chdir app_path
20
+ `#{command}`
21
+ end
22
+
23
+ describe "AssetSync" do
24
+
25
+ before(:each) do
26
+ @prefix = SecureRandom.hex(6)
27
+ end
28
+
29
+ let(:app_js_regex){
30
+ /#{@prefix}\/application-[a-zA-Z0-9]*.js$/
31
+ }
32
+
33
+ let(:app_js_gz_regex){
34
+ /#{@prefix}\/application-[a-zA-Z0-9]*.js.gz$/
35
+ }
36
+
37
+ let(:files){ bucket(@prefix).files }
38
+
39
+
40
+ after(:each) do
41
+ @directory = bucket(@prefix)
42
+ @directory.files.each do |f|
43
+ f.destroy
44
+ end
45
+ end
46
+
47
+ it "sync" do
48
+ execute "rake ASSET_SYNC_PREFIX=#{@prefix} assets:precompile"
49
+
50
+ files = bucket(@prefix).files
51
+
52
+ app_js = files.select{ |f| f.key =~ app_js_regex }.first
53
+ expect(app_js.content_type).to eq("application/javascript")
54
+
55
+ app_js_gz = files.select{ |f| f.key =~ app_js_gz_regex }.first
56
+ expect(app_js_gz.content_type).to eq("application/javascript")
57
+ expect(app_js_gz.content_encoding).to eq("gzip")
58
+ end
59
+
60
+ it "sync with enabled=false" do
61
+ execute "rake ASSET_SYNC_PREFIX=#{@prefix} ASSET_SYNC_ENABLED=false assets:precompile"
62
+ expect(bucket(@prefix).files.size).to eq(0)
63
+ end
64
+
65
+ it "sync with gzip_compression=true" do
66
+ execute "rake ASSET_SYNC_PREFIX=#{@prefix} ASSET_SYNC_GZIP_COMPRESSION=true assets:precompile"
67
+ # bucket(@prefix).files.size.should == 3
68
+
69
+ app_js_path = files.select{ |f| f.key =~ app_js_regex }.first
70
+ app_js = files.get( app_js_path.key )
71
+ expect(app_js.content_type).to eq("application/javascript")
72
+ end
73
+
74
+ end
@@ -0,0 +1,150 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe AssetSync do
4
+ include_context "mock Rails without_yml"
5
+
6
+ describe 'with initializer' do
7
+ before(:each) do
8
+ AssetSync.config = AssetSync::Config.new
9
+ AssetSync.configure do |config|
10
+ config.fog_provider = 'Backblaze'
11
+ config.b2_key_id = 'aaaa'
12
+ config.b2_key_token = 'bbbb'
13
+ config.b2_bucket_id = '4567'
14
+ config.fog_directory = 'mybucket'
15
+ config.existing_remote_files = "keep"
16
+ end
17
+ end
18
+
19
+ it "should configure provider as Backblaze" do
20
+ expect(AssetSync.config.fog_provider).to eq('Backblaze')
21
+ end
22
+
23
+ it "should should keep existing remote files" do
24
+ expect(AssetSync.config.existing_remote_files?).to eq(true)
25
+ end
26
+
27
+ it "should configure b2_key_id" do
28
+ expect(AssetSync.config.b2_key_id).to eq("aaaa")
29
+ end
30
+
31
+ it "should configure b2_key_token" do
32
+ expect(AssetSync.config.b2_key_token).to eq("bbbb")
33
+ end
34
+
35
+ it "should configure b2_bucket_id" do
36
+ expect(AssetSync.config.b2_bucket_id).to eq("4567")
37
+ end
38
+
39
+ it "should configure fog_directory" do
40
+ expect(AssetSync.config.fog_directory).to eq("mybucket")
41
+ end
42
+
43
+ it "should configure existing_remote_files" do
44
+ expect(AssetSync.config.existing_remote_files).to eq("keep")
45
+ end
46
+
47
+ it "should default gzip_compression to false" do
48
+ expect(AssetSync.config.gzip_compression).to be_falsey
49
+ end
50
+
51
+ it "should default manifest to false" do
52
+ expect(AssetSync.config.manifest).to be_falsey
53
+ end
54
+ end
55
+
56
+ describe 'from yml' do
57
+ before(:each) do
58
+ set_rails_root('backblaze_with_yml')
59
+ AssetSync.config = AssetSync::Config.new
60
+ end
61
+
62
+ it "should configure b2_key_id" do
63
+ expect(AssetSync.config.b2_key_id).to eq("xxxx")
64
+ end
65
+
66
+ it "should configure b2_key_token" do
67
+ expect(AssetSync.config.b2_key_token).to eq("zzzz")
68
+ end
69
+
70
+ it "should configure b2_bucket_id" do
71
+ expect(AssetSync.config.b2_bucket_id).to eq("1234")
72
+ end
73
+
74
+ it "should configure fog_directory" do
75
+ expect(AssetSync.config.fog_directory).to eq("rails_app_test")
76
+ end
77
+
78
+ it "should configure existing_remote_files" do
79
+ expect(AssetSync.config.existing_remote_files).to eq("keep")
80
+ end
81
+
82
+ it "should default gzip_compression to false" do
83
+ expect(AssetSync.config.gzip_compression).to be_falsey
84
+ end
85
+
86
+ it "should default manifest to false" do
87
+ expect(AssetSync.config.manifest).to be_falsey
88
+ end
89
+ end
90
+
91
+ describe 'with no configuration' do
92
+ before(:each) do
93
+ AssetSync.config = AssetSync::Config.new
94
+ end
95
+
96
+ it "should be invalid" do
97
+ expect{ AssetSync.sync }.to raise_error(::AssetSync::Config::Invalid)
98
+ end
99
+ end
100
+
101
+ describe 'with fail_silent configuration' do
102
+ before(:each) do
103
+ allow(AssetSync).to receive(:stderr).and_return(StringIO.new)
104
+ AssetSync.config = AssetSync::Config.new
105
+ AssetSync.configure do |config|
106
+ config.fail_silently = true
107
+ end
108
+ end
109
+
110
+ it "should not raise an invalid exception" do
111
+ expect{ AssetSync.sync }.not_to raise_error
112
+ end
113
+ end
114
+
115
+ describe 'with gzip_compression enabled' do
116
+ before(:each) do
117
+ AssetSync.config = AssetSync::Config.new
118
+ AssetSync.config.gzip_compression = true
119
+ end
120
+
121
+ it "config.gzip? should be true" do
122
+ expect(AssetSync.config.gzip?).to be_truthy
123
+ end
124
+ end
125
+
126
+ describe 'with manifest enabled' do
127
+ before(:each) do
128
+ AssetSync.config = AssetSync::Config.new
129
+ AssetSync.config.manifest = true
130
+ end
131
+
132
+ it "config.manifest should be true" do
133
+ expect(AssetSync.config.manifest).to be_truthy
134
+ end
135
+
136
+ it "config.manifest_path should default to public/assets.." do
137
+ expect(AssetSync.config.manifest_path).to match(/public\/assets\/manifest.yml/)
138
+ end
139
+
140
+ it "config.manifest_path should default to public/assets.." do
141
+ Rails.application.config.assets.manifest = "/var/assets"
142
+ expect(AssetSync.config.manifest_path).to eq("/var/assets/manifest.yml")
143
+ end
144
+
145
+ it "config.manifest_path should default to public/custom_assets.." do
146
+ Rails.application.config.assets.prefix = 'custom_assets'
147
+ expect(AssetSync.config.manifest_path).to match(/public\/custom_assets\/manifest.yml/)
148
+ end
149
+ end
150
+ end
@@ -436,6 +436,7 @@ describe AssetSync::Storage do
436
436
  allow(directory).to receive(:files).and_return([file])
437
437
  allow(file).to receive(:key).and_return('public/image.png')
438
438
  allow(connection).to receive(:directories).and_return(directories)
439
+ allow(config).to receive(:backblaze?).and_return(false)
439
440
  expect(connection).not_to receive(:delete_multiple_objects)
440
441
  expect(file).to receive(:destroy)
441
442
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.1
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Hamilton
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-06-17 00:00:00.000000000 Z
14
+ date: 2020-12-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -153,6 +153,20 @@ dependencies:
153
153
  - - ">="
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
+ - !ruby/object:Gem::Dependency
157
+ name: fog-backblaze
158
+ requirement: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ type: :development
164
+ prerelease: false
165
+ version_requirements: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
156
170
  - !ruby/object:Gem::Dependency
157
171
  name: uglifier
158
172
  requirement: !ruby/object:Gem::Requirement
@@ -223,15 +237,18 @@ files:
223
237
  - spec/dummy_app/app/assets/javascripts/application.js
224
238
  - spec/fixtures/aws_with_yml/config/asset_sync.yml
225
239
  - spec/fixtures/azure_rm_with_yml/config/asset_sync.yml
240
+ - spec/fixtures/backblaze_with_yml/config/asset_sync.yml
226
241
  - spec/fixtures/google_with_service_account_yml/config/asset_sync.yml
227
242
  - spec/fixtures/google_with_yml/config/asset_sync.yml
228
243
  - spec/fixtures/rackspace_with_yml/config/asset_sync.yml
229
244
  - spec/fixtures/with_invalid_yml/config/asset_sync.yml
230
245
  - spec/integration/aws_integration_spec.rb
231
246
  - spec/integration/azure_rm_integration_spec.rb
247
+ - spec/integration/backblaze_intergration_spec.rb
232
248
  - spec/spec_helper.rb
233
249
  - spec/unit/asset_sync_spec.rb
234
250
  - spec/unit/azure_rm_spec.rb
251
+ - spec/unit/backblaze_spec.rb
235
252
  - spec/unit/google_spec.rb
236
253
  - spec/unit/multi_mime_spec.rb
237
254
  - spec/unit/rackspace_spec.rb
@@ -256,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
273
  - !ruby/object:Gem::Version
257
274
  version: '0'
258
275
  requirements: []
259
- rubygems_version: 3.1.4
276
+ rubygems_version: 3.2.0
260
277
  signing_key:
261
278
  specification_version: 4
262
279
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
@@ -266,15 +283,18 @@ test_files:
266
283
  - spec/dummy_app/app/assets/javascripts/application.js
267
284
  - spec/fixtures/aws_with_yml/config/asset_sync.yml
268
285
  - spec/fixtures/azure_rm_with_yml/config/asset_sync.yml
286
+ - spec/fixtures/backblaze_with_yml/config/asset_sync.yml
269
287
  - spec/fixtures/google_with_service_account_yml/config/asset_sync.yml
270
288
  - spec/fixtures/google_with_yml/config/asset_sync.yml
271
289
  - spec/fixtures/rackspace_with_yml/config/asset_sync.yml
272
290
  - spec/fixtures/with_invalid_yml/config/asset_sync.yml
273
291
  - spec/integration/aws_integration_spec.rb
274
292
  - spec/integration/azure_rm_integration_spec.rb
293
+ - spec/integration/backblaze_intergration_spec.rb
275
294
  - spec/spec_helper.rb
276
295
  - spec/unit/asset_sync_spec.rb
277
296
  - spec/unit/azure_rm_spec.rb
297
+ - spec/unit/backblaze_spec.rb
278
298
  - spec/unit/google_spec.rb
279
299
  - spec/unit/multi_mime_spec.rb
280
300
  - spec/unit/rackspace_spec.rb