asset_sync 2.11.0 → 2.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yaml +64 -0
- data/.travis.yml +4 -9
- data/Appraisals +4 -8
- data/CHANGELOG.md +46 -1
- data/README.md +28 -6
- data/asset_sync.gemspec +1 -0
- data/gemfiles/{rails_5_0.gemfile → rails_6_1.gemfile} +1 -1
- data/lib/asset_sync/config.rb +33 -4
- data/lib/asset_sync/engine.rb +5 -0
- data/lib/asset_sync/storage.rb +8 -2
- data/lib/asset_sync/version.rb +1 -1
- data/lib/generators/asset_sync/install_generator.rb +21 -1
- data/lib/generators/asset_sync/templates/asset_sync.rb +7 -0
- data/lib/generators/asset_sync/templates/asset_sync.yml +6 -1
- data/spec/fixtures/backblaze_with_yml/config/asset_sync.yml +20 -0
- data/spec/integration/backblaze_intergration_spec.rb +74 -0
- data/spec/unit/backblaze_spec.rb +150 -0
- data/spec/unit/google_spec.rb +22 -0
- data/spec/unit/storage_spec.rb +13 -6
- metadata +28 -8
- data/gemfiles/rails_5_1.gemfile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb865a74b05c9a16ce39367906e4b4e98e95aa1ee6513cce217c84bea8a832b6
|
4
|
+
data.tar.gz: 4684411bd7bddcf9daf4e6e9c1ba0b92fbf85cf67f2c9a42825b3c910e151c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02951393035ba6db862849187d74f41d49529206d6d8a13b84ccca91b7d7c533fee6f0ea2440ea4b4e35ed72967d2d7489cfb6118c9fb8895e201964f146f64
|
7
|
+
data.tar.gz: 51e1bd03d2acd5a528fa5960ff5986c29303bb8ec03ce643cb57bce30958fc5d1fab981de815459fc9b16eab176a1717ad1873a9b4f08a7659b94f5ed8b7bd5d
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- master
|
7
|
+
paths-ignore:
|
8
|
+
- 'README.md'
|
9
|
+
push:
|
10
|
+
branches:
|
11
|
+
- master
|
12
|
+
paths-ignore:
|
13
|
+
- 'README.md'
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
unit_tests:
|
17
|
+
name: Unit Tests
|
18
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
os:
|
23
|
+
- ubuntu
|
24
|
+
ruby:
|
25
|
+
- 2.5
|
26
|
+
- 2.6
|
27
|
+
- 2.7
|
28
|
+
- 3.0
|
29
|
+
- jruby
|
30
|
+
gemfile:
|
31
|
+
- gemfiles/rails_5_2.gemfile
|
32
|
+
- gemfiles/rails_6_0.gemfile
|
33
|
+
- gemfiles/rails_6_1.gemfile
|
34
|
+
allow_failures:
|
35
|
+
- false
|
36
|
+
include:
|
37
|
+
- os: ubuntu
|
38
|
+
ruby: ruby-head
|
39
|
+
gemfile: gemfiles/rails_6_1.gemfile
|
40
|
+
allow_failures: true
|
41
|
+
- os: ubuntu
|
42
|
+
ruby: jruby-head
|
43
|
+
gemfile: gemfiles/rails_6_1.gemfile
|
44
|
+
allow_failures: true
|
45
|
+
exclude:
|
46
|
+
- os: ubuntu
|
47
|
+
ruby: 3.0
|
48
|
+
gemfile: gemfiles/rails_5_2.gemfile
|
49
|
+
allow_failures: false
|
50
|
+
env:
|
51
|
+
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
52
|
+
ALLOW_FAILURES: "${{ matrix.allow_failures }}"
|
53
|
+
runs-on: ${{ matrix.os }}-latest
|
54
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
55
|
+
steps:
|
56
|
+
- name: Checkout
|
57
|
+
uses: actions/checkout@v2
|
58
|
+
- name: Setup Ruby
|
59
|
+
uses: ruby/setup-ruby@v1
|
60
|
+
with:
|
61
|
+
ruby-version: ${{ matrix.ruby }}
|
62
|
+
bundler-cache: true
|
63
|
+
- name: Test
|
64
|
+
run: bundle exec rake spec:unit || $ALLOW_FAILURES
|
data/.travis.yml
CHANGED
@@ -2,11 +2,12 @@
|
|
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:
|
8
|
-
- 2.3
|
9
|
-
- 2.4
|
10
11
|
- 2.5
|
11
12
|
- 2.6
|
12
13
|
- 2.7
|
@@ -14,10 +15,9 @@ rvm:
|
|
14
15
|
- jruby
|
15
16
|
- jruby-head
|
16
17
|
gemfile:
|
17
|
-
- gemfiles/rails_5_0.gemfile
|
18
|
-
- gemfiles/rails_5_1.gemfile
|
19
18
|
- gemfiles/rails_5_2.gemfile
|
20
19
|
- gemfiles/rails_6_0.gemfile
|
20
|
+
- gemfiles/rails_6_1.gemfile
|
21
21
|
before_install:
|
22
22
|
# Cannot use bundler 2.x due to dependency (mainly rails 4.2)
|
23
23
|
# Solution from https://github.com/rails/rails/blob/4-2-stable/.travis.yml
|
@@ -34,11 +34,6 @@ matrix:
|
|
34
34
|
allow_failures:
|
35
35
|
- rvm: ruby-head
|
36
36
|
- rvm: jruby-head
|
37
|
-
exclude:
|
38
|
-
- rvm: 2.3
|
39
|
-
gemfile: gemfiles/rails_6_0.gemfile
|
40
|
-
- rvm: 2.4
|
41
|
-
gemfile: gemfiles/rails_6_0.gemfile
|
42
37
|
notifications:
|
43
38
|
webhooks:
|
44
39
|
urls:
|
data/Appraisals
CHANGED
@@ -1,12 +1,4 @@
|
|
1
1
|
|
2
|
-
appraise "rails_5_0" do
|
3
|
-
gem "rails", "~> 5.0.0"
|
4
|
-
end
|
5
|
-
|
6
|
-
appraise "rails_5_1" do
|
7
|
-
gem "rails", "~> 5.1.0"
|
8
|
-
end
|
9
|
-
|
10
2
|
appraise "rails_5_2" do
|
11
3
|
gem "rails", "~> 5.2.0"
|
12
4
|
end
|
@@ -14,3 +6,7 @@ end
|
|
14
6
|
appraise "rails_6_0" do
|
15
7
|
gem "rails", "~> 6.0.0"
|
16
8
|
end
|
9
|
+
|
10
|
+
appraise "rails_6_1" do
|
11
|
+
gem "rails", "~> 6.1.0"
|
12
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,46 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [2.14.0] - 2020-03-31
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Add support for fog option `google_json_key_string`
|
26
|
+
(https://github.com/AssetSync/asset_sync/pull/415)
|
27
|
+
|
28
|
+
|
29
|
+
## [2.13.1] - 2021-03-01
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
- Fix "files to be uploaded list" generation for file names with dashes
|
34
|
+
(https://github.com/AssetSync/asset_sync/pull/414)
|
35
|
+
|
36
|
+
|
37
|
+
## [2.13.0] - 2020-12-14
|
38
|
+
|
39
|
+
### Added
|
40
|
+
|
41
|
+
- Add Backblaze B2 Cloud Storage support
|
42
|
+
(https://github.com/AssetSync/asset_sync/pull/410)
|
43
|
+
|
44
|
+
|
45
|
+
## [2.12.1] - 2020-06-17
|
46
|
+
|
47
|
+
### Fixed
|
48
|
+
|
49
|
+
- Fix initializer template in generator
|
50
|
+
(https://github.com/AssetSync/asset_sync/pull/404)
|
51
|
+
|
52
|
+
|
53
|
+
## [2.12.0] - 2020-06-11
|
54
|
+
|
55
|
+
### Added
|
56
|
+
|
57
|
+
- Add option `aws_session_token` to support AWS Temporary Security Credentials
|
58
|
+
(https://github.com/AssetSync/asset_sync/pull/403)
|
59
|
+
|
60
|
+
|
21
61
|
## [2.11.0] - 2020-03-13
|
22
62
|
|
23
63
|
### Added
|
@@ -962,7 +1002,12 @@ Changes:
|
|
962
1002
|
* Merge branch 'sinatra'
|
963
1003
|
|
964
1004
|
|
965
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.
|
1005
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.14.0...HEAD
|
1006
|
+
[2.14.0]: https://github.com/AssetSync/asset_sync/compare/v2.13.1...v2.14.0
|
1007
|
+
[2.13.1]: https://github.com/AssetSync/asset_sync/compare/v2.13.0...v2.13.1
|
1008
|
+
[2.13.0]: https://github.com/AssetSync/asset_sync/compare/v2.12.1...v2.13.0
|
1009
|
+
[2.12.1]: https://github.com/AssetSync/asset_sync/compare/v2.12.0...v2.12.1
|
1010
|
+
[2.12.0]: https://github.com/AssetSync/asset_sync/compare/v2.11.0...v2.12.0
|
966
1011
|
[2.11.0]: https://github.com/AssetSync/asset_sync/compare/v2.10.0...v2.11.0
|
967
1012
|
[2.10.0]: https://github.com/AssetSync/asset_sync/compare/v2.9.1...v2.10.0
|
968
1013
|
[2.9.1]: https://github.com/AssetSync/asset_sync/compare/v2.9.0...v2.9.1
|
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
|
|
@@ -208,6 +223,7 @@ AssetSync.configure do |config|
|
|
208
223
|
config.fog_directory = ENV['FOG_DIRECTORY']
|
209
224
|
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
210
225
|
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
226
|
+
config.aws_session_token = ENV['AWS_SESSION_TOKEN'] if ENV.key?('AWS_SESSION_TOKEN')
|
211
227
|
|
212
228
|
# Don't delete files from the store
|
213
229
|
# config.existing_remote_files = 'keep'
|
@@ -244,7 +260,7 @@ AssetSync.configure do |config|
|
|
244
260
|
#
|
245
261
|
# Upload files concurrently
|
246
262
|
# config.concurrent_uploads = false
|
247
|
-
#
|
263
|
+
#
|
248
264
|
# Number of threads when concurrent_uploads is enabled
|
249
265
|
# config.concurrent_uploads_max_threads = 10
|
250
266
|
#
|
@@ -273,6 +289,7 @@ Run the included Rake task to generate a starting point.
|
|
273
289
|
rails g asset_sync:install --use-yml --provider=Rackspace
|
274
290
|
rails g asset_sync:install --use-yml --provider=AWS
|
275
291
|
rails g asset_sync:install --use-yml --provider=AzureRM
|
292
|
+
rails g asset_sync:install --use-yml --provider=Backblaze
|
276
293
|
|
277
294
|
The generator will create a YAML file at `config/asset_sync.yml`.
|
278
295
|
|
@@ -382,7 +399,7 @@ To customize the overrides:
|
|
382
399
|
AssetSync.configure do |config|
|
383
400
|
# Clear the default overrides
|
384
401
|
config.file_ext_to_mime_type_overrides.clear
|
385
|
-
|
402
|
+
|
386
403
|
# Add/Edit overrides
|
387
404
|
# Will call `#to_s` for inputs
|
388
405
|
config.file_ext_to_mime_type_overrides.add(:js, :"application/x-javascript")
|
@@ -391,7 +408,7 @@ end
|
|
391
408
|
The blocks are run when local files are being scanned and uploaded
|
392
409
|
|
393
410
|
#### Fog (Required)
|
394
|
-
* **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)
|
395
412
|
* **fog\_directory**: your bucket name
|
396
413
|
|
397
414
|
#### Fog (Optional)
|
@@ -425,6 +442,11 @@ When using the S3 API
|
|
425
442
|
* **azure\_storage\_account\_name**: your Azure Blob access key
|
426
443
|
* **azure\_storage\_access\_key**: your Azure Blob access secret
|
427
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
|
+
|
428
450
|
#### Rackspace (Optional)
|
429
451
|
|
430
452
|
* **rackspace\_auth\_url**: Rackspace auth URL, for Rackspace London use: `https://lon.identity.api.rackspacecloud.com/v2.0`
|
@@ -550,7 +572,7 @@ AssetSync.configure do |config|
|
|
550
572
|
config.prefix = 'assets'
|
551
573
|
# Can be a `Pathname` or `String`
|
552
574
|
# Will be converted into an `Pathname`
|
553
|
-
# If relative, will be converted into an absolute path
|
575
|
+
# If relative, will be converted into an absolute path
|
554
576
|
# via `::Rails.root` or `::Dir.pwd`
|
555
577
|
config.public_path = Pathname('./public')
|
556
578
|
end
|
@@ -621,7 +643,7 @@ Make sure you have a .env file with these details:-
|
|
621
643
|
AWS_SECRET_ACCESS_KEY=<yoursecretkey>
|
622
644
|
FOG_DIRECTORY=<yourbucket>
|
623
645
|
FOG_REGION=<youbucketregion>
|
624
|
-
|
646
|
+
|
625
647
|
# for AzureRM provider
|
626
648
|
AZURE_STORAGE_ACCOUNT_NAME=<youraccountname>
|
627
649
|
AZURE_STORAGE_ACCESS_KEY=<youraccesskey>
|
data/asset_sync.gemspec
CHANGED
@@ -5,6 +5,6 @@ source "https://rubygems.org"
|
|
5
5
|
gem "rcov", platforms: :mri_18, group: [:development, :test]
|
6
6
|
gem "simplecov", platforms: [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], group: [:development, :test], require: false
|
7
7
|
gem "jruby-openssl", platform: :jruby
|
8
|
-
gem "rails", "~>
|
8
|
+
gem "rails", "~> 6.1.0"
|
9
9
|
|
10
10
|
gemspec path: "../"
|
data/lib/asset_sync/config.rb
CHANGED
@@ -37,7 +37,7 @@ module AssetSync
|
|
37
37
|
attr_reader :fog_public # e.g. true, false, "default"
|
38
38
|
|
39
39
|
# Amazon AWS
|
40
|
-
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles, :aws_signature_version
|
40
|
+
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_session_token, :aws_reduced_redundancy, :aws_iam_roles, :aws_signature_version
|
41
41
|
attr_accessor :fog_host # e.g. 's3.amazonaws.com'
|
42
42
|
attr_accessor :fog_port # e.g. '9000'
|
43
43
|
attr_accessor :fog_path_style # e.g. true
|
@@ -49,12 +49,18 @@ module AssetSync
|
|
49
49
|
# Google Storage
|
50
50
|
attr_accessor :google_storage_secret_access_key, :google_storage_access_key_id # when using S3 interop
|
51
51
|
attr_accessor :google_json_key_location # when using service accounts
|
52
|
+
attr_accessor :google_json_key_string # when using service accounts
|
52
53
|
attr_accessor :google_project # when using service accounts
|
53
54
|
|
54
55
|
# Azure Blob with Fog::AzureRM
|
55
56
|
attr_accessor :azure_storage_account_name
|
56
57
|
attr_accessor :azure_storage_access_key
|
57
58
|
|
59
|
+
# Backblaze B2 with Fog::Backblaze
|
60
|
+
attr_accessor :b2_key_id
|
61
|
+
attr_accessor :b2_key_token
|
62
|
+
attr_accessor :b2_bucket_id
|
63
|
+
|
58
64
|
validates :existing_remote_files, :inclusion => { :in => %w(keep delete ignore) }
|
59
65
|
|
60
66
|
validates :fog_provider, :presence => true
|
@@ -66,8 +72,12 @@ module AssetSync
|
|
66
72
|
validates :rackspace_api_key, :presence => true, :if => :rackspace?
|
67
73
|
validates :google_storage_secret_access_key, :presence => true, :if => :google_interop?
|
68
74
|
validates :google_storage_access_key_id, :presence => true, :if => :google_interop?
|
69
|
-
validates :google_json_key_location, :presence => true, :if => :google_service_account?
|
70
75
|
validates :google_project, :presence => true, :if => :google_service_account?
|
76
|
+
validate(:if => :google_service_account?) do
|
77
|
+
unless google_json_key_location.present? || google_json_key_string.present?
|
78
|
+
errors.add(:base, 'must provide either google_json_key_location or google_json_key_string if using Google service account')
|
79
|
+
end
|
80
|
+
end
|
71
81
|
validates :concurrent_uploads, :inclusion => { :in => [true, false] }
|
72
82
|
|
73
83
|
def initialize
|
@@ -142,17 +152,21 @@ module AssetSync
|
|
142
152
|
end
|
143
153
|
|
144
154
|
def google_interop?
|
145
|
-
google? && google_json_key_location.nil?
|
155
|
+
google? && google_json_key_location.nil? && google_json_key_string.nil?
|
146
156
|
end
|
147
157
|
|
148
158
|
def google_service_account?
|
149
|
-
google? && google_json_key_location
|
159
|
+
google? && (google_json_key_location || google_json_key_string)
|
150
160
|
end
|
151
161
|
|
152
162
|
def azure_rm?
|
153
163
|
fog_provider =~ /azurerm/i
|
154
164
|
end
|
155
165
|
|
166
|
+
def backblaze?
|
167
|
+
fog_provider =~ /backblaze/i
|
168
|
+
end
|
169
|
+
|
156
170
|
def cache_asset_regexp=(cache_asset_regexp)
|
157
171
|
self.cache_asset_regexps = [cache_asset_regexp]
|
158
172
|
end
|
@@ -203,6 +217,7 @@ module AssetSync
|
|
203
217
|
self.fog_scheme = yml["fog_scheme"]
|
204
218
|
self.aws_access_key_id = yml["aws_access_key_id"]
|
205
219
|
self.aws_secret_access_key = yml["aws_secret_access_key"]
|
220
|
+
self.aws_session_token = yml["aws_session_token"] if yml.has_key?("aws_session_token")
|
206
221
|
self.aws_reduced_redundancy = yml["aws_reduced_redundancy"]
|
207
222
|
self.aws_iam_roles = yml["aws_iam_roles"]
|
208
223
|
self.aws_signature_version = yml["aws_signature_version"]
|
@@ -232,6 +247,10 @@ module AssetSync
|
|
232
247
|
self.azure_storage_account_name = yml['azure_storage_account_name'] if yml.has_key?("azure_storage_account_name")
|
233
248
|
self.azure_storage_access_key = yml['azure_storage_access_key'] if yml.has_key?("azure_storage_access_key")
|
234
249
|
|
250
|
+
self.b2_key_id = yml['b2_key_id'] if yml.has_key?("b2_key_id")
|
251
|
+
self.b2_key_token = yml['b2_key_token'] if yml.has_key?("b2_key_token")
|
252
|
+
self.b2_bucket_id = yml['b2_bucket_id'] if yml.has_key?("b2_bucket_id")
|
253
|
+
|
235
254
|
# TODO deprecate the other old style config settings. FML.
|
236
255
|
self.aws_access_key_id = yml["aws_access_key"] if yml.has_key?("aws_access_key")
|
237
256
|
self.aws_secret_access_key = yml["aws_access_secret"] if yml.has_key?("aws_access_secret")
|
@@ -260,6 +279,7 @@ module AssetSync
|
|
260
279
|
:aws_access_key_id => aws_access_key_id,
|
261
280
|
:aws_secret_access_key => aws_secret_access_key
|
262
281
|
})
|
282
|
+
options.merge!({:aws_session_token => aws_session_token}) if aws_session_token
|
263
283
|
end
|
264
284
|
options.merge!({:host => fog_host}) if fog_host
|
265
285
|
options.merge!({:port => fog_port}) if fog_port
|
@@ -277,6 +297,8 @@ module AssetSync
|
|
277
297
|
elsif google?
|
278
298
|
if google_json_key_location
|
279
299
|
options.merge!({:google_json_key_location => google_json_key_location, :google_project => google_project})
|
300
|
+
elsif google_json_key_string
|
301
|
+
options.merge!({:google_json_key_string => google_json_key_string, :google_project => google_project})
|
280
302
|
else
|
281
303
|
options.merge!({
|
282
304
|
:google_storage_secret_access_key => google_storage_secret_access_key,
|
@@ -291,6 +313,13 @@ module AssetSync
|
|
291
313
|
:azure_storage_access_key => azure_storage_access_key,
|
292
314
|
})
|
293
315
|
options.merge!({:environment => fog_region}) if fog_region
|
316
|
+
elsif backblaze?
|
317
|
+
require 'fog/backblaze'
|
318
|
+
options.merge!({
|
319
|
+
:b2_key_id => b2_key_id,
|
320
|
+
:b2_key_token => b2_key_token,
|
321
|
+
:b2_bucket_id => b2_bucket_id,
|
322
|
+
})
|
294
323
|
else
|
295
324
|
raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS, Rackspace and Google are supported currently."
|
296
325
|
end
|
data/lib/asset_sync/engine.rb
CHANGED
@@ -23,6 +23,7 @@ module AssetSync
|
|
23
23
|
|
24
24
|
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID'] if ENV.has_key?('AWS_ACCESS_KEY_ID')
|
25
25
|
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] if ENV.has_key?('AWS_SECRET_ACCESS_KEY')
|
26
|
+
config.aws_session_token = ENV['AWS_SESSION_TOKEN'] if ENV.has_key?('AWS_SESSION_TOKEN')
|
26
27
|
config.aws_signature_version = ENV['AWS_SIGNATURE_VERSION'] if ENV.has_key?('AWS_SIGNATURE_VERSION')
|
27
28
|
config.aws_reduced_redundancy = ENV['AWS_REDUCED_REDUNDANCY'] == true if ENV.has_key?('AWS_REDUCED_REDUNDANCY')
|
28
29
|
|
@@ -35,6 +36,10 @@ module AssetSync
|
|
35
36
|
config.azure_storage_account_name = ENV['AZURE_STORAGE_ACCOUNT_NAME'] if ENV.has_key?('AZURE_STORAGE_ACCOUNT_NAME')
|
36
37
|
config.azure_storage_access_key = ENV['AZURE_STORAGE_ACCESS_KEY'] if ENV.has_key?('AZURE_STORAGE_ACCESS_KEY')
|
37
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
|
+
|
38
43
|
config.enabled = (ENV['ASSET_SYNC_ENABLED'] == 'true') if ENV.has_key?('ASSET_SYNC_ENABLED')
|
39
44
|
|
40
45
|
config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -4,7 +4,7 @@ require "asset_sync/multi_mime"
|
|
4
4
|
|
5
5
|
module AssetSync
|
6
6
|
class Storage
|
7
|
-
REGEXP_FINGERPRINTED_FILES =
|
7
|
+
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/m
|
8
8
|
REGEXP_ASSETS_TO_CACHE_CONTROL = /-[0-9a-fA-F]{32,}$/
|
9
9
|
|
10
10
|
class BucketNotFound < StandardError;
|
@@ -22,7 +22,13 @@ module AssetSync
|
|
22
22
|
|
23
23
|
def bucket
|
24
24
|
# fixes: https://github.com/rumblelabs/asset_sync/issues/18
|
25
|
-
|
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)
|
data/lib/asset_sync/version.rb
CHANGED
@@ -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 '
|
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
|
@@ -35,6 +39,10 @@ module AssetSync
|
|
35
39
|
"<%= ENV['AWS_SECRET_ACCESS_KEY'] %>"
|
36
40
|
end
|
37
41
|
|
42
|
+
def aws_session_token
|
43
|
+
"<%= ENV['AWS_SESSION_TOKEN'] %>"
|
44
|
+
end
|
45
|
+
|
38
46
|
def google_storage_access_key_id
|
39
47
|
"<%= ENV['GOOGLE_STORAGE_ACCESS_KEY_ID'] %>"
|
40
48
|
end
|
@@ -59,6 +67,18 @@ module AssetSync
|
|
59
67
|
"<%= ENV['AZURE_STORAGE_ACCESS_KEY'] %>"
|
60
68
|
end
|
61
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
|
+
|
62
82
|
def app_name
|
63
83
|
@app_name ||= Rails.application.is_a?(Rails::Application) && Rails.application.class.name.sub(/::Application$/, "").downcase
|
64
84
|
end
|
@@ -4,6 +4,7 @@ if defined?(AssetSync)
|
|
4
4
|
config.fog_provider = 'AWS'
|
5
5
|
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
6
6
|
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
7
|
+
config.aws_session_token = ENV['AWS_SESSION_TOKEN'] if ENV.key?('AWS_SESSION_TOKEN')
|
7
8
|
# To use AWS reduced redundancy storage.
|
8
9
|
# config.aws_reduced_redundancy = true
|
9
10
|
#
|
@@ -34,6 +35,12 @@ if defined?(AssetSync)
|
|
34
35
|
config.azure_storage_account_name = ENV['AZURE_STORAGE_ACCOUNT_NAME']
|
35
36
|
config.azure_storage_access_key = ENV['AZURE_STORAGE_ACCESS_KEY']
|
36
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
|
+
|
37
44
|
# config.fog_directory specifies container name of Azure Blob storage
|
38
45
|
<%- end -%>
|
39
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
|
data/spec/unit/google_spec.rb
CHANGED
@@ -99,6 +99,28 @@ describe AssetSync do
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
describe "when using service account with JSON key string" do
|
103
|
+
before(:each) do
|
104
|
+
AssetSync.configure do |config|
|
105
|
+
config.google_json_key_string = 'a-google-json-key-string'
|
106
|
+
config.google_project = 'a-google-project-name'
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should configure google_json_key_string" do
|
111
|
+
expect(AssetSync.config.google_json_key_string).to eq("a-google-json-key-string")
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should return the correct fog_options" do
|
115
|
+
expected_fog_options = { google_json_key_string: "a-google-json-key-string",
|
116
|
+
google_project: 'a-google-project-name',
|
117
|
+
provider: "Google"}
|
118
|
+
expect(AssetSync.config.fog_options).to eq(expected_fog_options)
|
119
|
+
end
|
120
|
+
it "should not require that google_storage_secret_access_key or access_key_id be set" do
|
121
|
+
expect(AssetSync.config.valid?).to eq(true)
|
122
|
+
end
|
123
|
+
end
|
102
124
|
end
|
103
125
|
|
104
126
|
describe 'from yml' do
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -137,17 +137,22 @@ describe AssetSync::Storage do
|
|
137
137
|
|
138
138
|
it 'should upload updated non-fingerprinted files' do
|
139
139
|
@local_files = [
|
140
|
-
'public/image.png',
|
141
|
-
'public/image-82389298328.png',
|
142
|
-
'public/image-a8389f9h324.png',
|
140
|
+
'public/great-image.png',
|
141
|
+
'public/great-image-82389298328.png',
|
142
|
+
'public/great-image-a8389f9h324.png',
|
143
|
+
"public/new\nline.js",
|
144
|
+
"public/new\nline-aaaaaaaaaaa.js",
|
145
|
+
"public/new\nline-bbbbbbbbbbb.js",
|
143
146
|
'public/application.js',
|
144
147
|
'public/application-b3389d983k1.js',
|
145
148
|
'public/application-ac387d53f31.js',
|
146
149
|
'public',
|
147
150
|
]
|
148
151
|
@remote_files = [
|
149
|
-
'public/image.png',
|
150
|
-
'public/image-a8389f9h324.png',
|
152
|
+
'public/great-image.png',
|
153
|
+
'public/great-image-a8389f9h324.png',
|
154
|
+
"public/new\nline.js",
|
155
|
+
"public/new\nline-aaaaaaaaaaa.js",
|
151
156
|
'public/application.js',
|
152
157
|
'public/application-b3389d983k1.js',
|
153
158
|
]
|
@@ -158,7 +163,8 @@ describe AssetSync::Storage do
|
|
158
163
|
allow(File).to receive(:file?).and_return(true) # Pretend they all exist
|
159
164
|
|
160
165
|
updated_nonfingerprinted_files = [
|
161
|
-
'public/image.png',
|
166
|
+
'public/great-image.png',
|
167
|
+
"public/new\nline.js",
|
162
168
|
'public/application.js',
|
163
169
|
]
|
164
170
|
(@local_files - @remote_files + updated_nonfingerprinted_files).each do |file|
|
@@ -436,6 +442,7 @@ describe AssetSync::Storage do
|
|
436
442
|
allow(directory).to receive(:files).and_return([file])
|
437
443
|
allow(file).to receive(:key).and_return('public/image.png')
|
438
444
|
allow(connection).to receive(:directories).and_return(directories)
|
445
|
+
allow(config).to receive(:backblaze?).and_return(false)
|
439
446
|
expect(connection).not_to receive(:delete_multiple_objects)
|
440
447
|
expect(file).to receive(:destroy)
|
441
448
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asset_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hamilton
|
8
8
|
- David Rice
|
9
9
|
- Phil McClure
|
10
10
|
- Toby Osbourn
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-03-31 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
|
@@ -193,6 +207,7 @@ extensions: []
|
|
193
207
|
extra_rdoc_files: []
|
194
208
|
files:
|
195
209
|
- ".editorconfig"
|
210
|
+
- ".github/workflows/tests.yaml"
|
196
211
|
- ".gitignore"
|
197
212
|
- ".travis.yml"
|
198
213
|
- Appraisals
|
@@ -203,10 +218,9 @@ files:
|
|
203
218
|
- UPGRADING.md
|
204
219
|
- asset_sync.gemspec
|
205
220
|
- docs/heroku.md
|
206
|
-
- gemfiles/rails_5_0.gemfile
|
207
|
-
- gemfiles/rails_5_1.gemfile
|
208
221
|
- gemfiles/rails_5_2.gemfile
|
209
222
|
- gemfiles/rails_6_0.gemfile
|
223
|
+
- gemfiles/rails_6_1.gemfile
|
210
224
|
- lib/asset_sync.rb
|
211
225
|
- lib/asset_sync/asset_sync.rb
|
212
226
|
- lib/asset_sync/config.rb
|
@@ -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
|
@@ -241,7 +258,7 @@ homepage: https://github.com/rumblelabs/asset_sync
|
|
241
258
|
licenses:
|
242
259
|
- MIT
|
243
260
|
metadata: {}
|
244
|
-
post_install_message:
|
261
|
+
post_install_message:
|
245
262
|
rdoc_options: []
|
246
263
|
require_paths:
|
247
264
|
- lib
|
@@ -256,8 +273,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
273
|
- !ruby/object:Gem::Version
|
257
274
|
version: '0'
|
258
275
|
requirements: []
|
259
|
-
rubygems_version: 3.
|
260
|
-
signing_key:
|
276
|
+
rubygems_version: 3.2.15
|
277
|
+
signing_key:
|
261
278
|
specification_version: 4
|
262
279
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|
263
280
|
Rackspace Cloudfiles
|
@@ -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
|
data/gemfiles/rails_5_1.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "rcov", platforms: :mri_18, group: [:development, :test]
|
6
|
-
gem "simplecov", platforms: [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], group: [:development, :test], require: false
|
7
|
-
gem "jruby-openssl", platform: :jruby
|
8
|
-
gem "rails", "~> 5.1.0"
|
9
|
-
|
10
|
-
gemspec path: "../"
|