asset_sync 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.editorconfig +17 -0
- data/CHANGELOG.md +16 -3
- data/README.md +38 -8
- data/lib/asset_sync/config.rb +11 -3
- data/lib/asset_sync/engine.rb +4 -0
- data/lib/asset_sync/version.rb +1 -1
- data/lib/generators/asset_sync/templates/asset_sync.rb +57 -46
- data/lib/generators/asset_sync/templates/asset_sync.yml +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6da0a6735b574c2e13ef9bb97f00b35f6b28555e81a43aeaa2a4d74ca86cac44
|
4
|
+
data.tar.gz: 11eafe2e4c2297e47a64736d4d6834140271d26c557dcddf2244eabd356cc2b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fb08a40bb3769b7a966483b28c9c7b5b050ff6f2457f066f4c66bd3646f6da11fc99981b62924a884effa8b0662e314f1725b0e92fdfc6166536a42634f42ce
|
7
|
+
data.tar.gz: 6743f47d2400bce60b26291c21743f0a99427ddb108b9d5f5492913d595f5b71dd2824bf48e51e1117a6e6be641afb3dce85e2265f9dd8cf537be30f75f2df5d
|
data/.editorconfig
CHANGED
@@ -3,5 +3,22 @@
|
|
3
3
|
# top-most EditorConfig file
|
4
4
|
root = true
|
5
5
|
|
6
|
+
# default configuration
|
7
|
+
[*]
|
8
|
+
indent_style = space
|
9
|
+
indent_size = 2
|
10
|
+
insert_final_newline = true
|
11
|
+
trim_trailing_whitespace = true
|
12
|
+
|
13
|
+
# Unix-style newlines with a newline ending every file
|
14
|
+
end_of_line = lf
|
15
|
+
|
16
|
+
# Set default charset
|
17
|
+
charset = utf-8
|
18
|
+
|
19
|
+
# Tab indentation (no size specified)
|
20
|
+
[Makefile]
|
21
|
+
indent_style = tab
|
22
|
+
|
6
23
|
[*.{md,markdown}]
|
7
24
|
trim_trailing_whitespace = false
|
data/CHANGELOG.md
CHANGED
@@ -18,7 +18,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
-
## [2.
|
21
|
+
## [2.3.0] - 2017-12-05
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Add options: `aws_signature_version`, `fog_host`, `fog_scheme`
|
26
|
+
(https://github.com/AssetSync/asset_sync/pull/362)
|
27
|
+
|
28
|
+
### Changed
|
29
|
+
|
30
|
+
- Change initializer template to only run when AssetSync const defined
|
31
|
+
|
32
|
+
|
33
|
+
## [2.2.0] - 2017-07-12
|
22
34
|
|
23
35
|
### Added
|
24
36
|
|
@@ -35,7 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
35
47
|
(https://github.com/AssetSync/asset_sync/pull/351)
|
36
48
|
|
37
49
|
|
38
|
-
## [2.1.0] -
|
50
|
+
## [2.1.0] - 2017-05-19
|
39
51
|
|
40
52
|
### Added
|
41
53
|
|
@@ -830,7 +842,8 @@ Changes:
|
|
830
842
|
* Merge branch 'sinatra'
|
831
843
|
|
832
844
|
|
833
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.
|
845
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.3.0...HEAD
|
846
|
+
[2.3.0]: https://github.com/AssetSync/asset_sync/compare/v2.2.0...v2.3.0
|
834
847
|
[2.2.0]: https://github.com/AssetSync/asset_sync/compare/v2.1.0...v2.2.0
|
835
848
|
[2.1.0]: https://github.com/AssetSync/asset_sync/compare/v2.0.0...v2.1.0
|
836
849
|
[2.0.0]: https://github.com/AssetSync/asset_sync/compare/v1.3.0...v2.0.0
|
data/README.md
CHANGED
@@ -183,6 +183,15 @@ AssetSync.configure do |config|
|
|
183
183
|
# Increase upload performance by configuring your region
|
184
184
|
# config.fog_region = 'eu-west-1'
|
185
185
|
#
|
186
|
+
# Change AWS signature version. Default is 4
|
187
|
+
# config.aws_signature_version = 4
|
188
|
+
#
|
189
|
+
# Change host option in fog (only if you need to)
|
190
|
+
# config.fog_host = 's3.amazonaws.com'
|
191
|
+
#
|
192
|
+
# Use http instead of https.
|
193
|
+
# config.fog_scheme = 'http'
|
194
|
+
#
|
186
195
|
# Automatically replace files with their equivalent gzip compressed version
|
187
196
|
# config.gzip_compression = true
|
188
197
|
#
|
@@ -220,8 +229,22 @@ defaults: &defaults
|
|
220
229
|
fog_directory: "rails-app-assets"
|
221
230
|
aws_access_key_id: "<%= ENV['AWS_ACCESS_KEY_ID'] %>"
|
222
231
|
aws_secret_access_key: "<%= ENV['AWS_SECRET_ACCESS_KEY'] %>"
|
232
|
+
|
233
|
+
# To use AWS reduced redundancy storage.
|
234
|
+
# aws_reduced_redundancy: true
|
235
|
+
#
|
223
236
|
# You may need to specify what region your storage bucket is in
|
224
237
|
# fog_region: "eu-west-1"
|
238
|
+
#
|
239
|
+
# Change AWS signature version. Default is 4
|
240
|
+
# aws_signature_version: 4
|
241
|
+
#
|
242
|
+
# Change host option in fog (only if you need to)
|
243
|
+
# fog_host: "s3.amazonaws.com"
|
244
|
+
#
|
245
|
+
# Use http instead of https. Default should be "https" (at least for fog-aws)
|
246
|
+
# fog_scheme: "http"
|
247
|
+
|
225
248
|
existing_remote_files: keep # Existing pre-compiled assets on S3 will be kept
|
226
249
|
# To delete existing remote files.
|
227
250
|
# existing_remote_files: delete
|
@@ -282,7 +305,11 @@ AssetSync.configure do |config|
|
|
282
305
|
config.add_local_file_paths do
|
283
306
|
# Any code that returns paths of local asset files to be uploaded
|
284
307
|
# Like Webpacker
|
285
|
-
|
308
|
+
public_root = Rails.root.join("public")
|
309
|
+
Dir.chdir(public_root) do
|
310
|
+
packs_dir = Webpacker.config.public_output_path.relative_path_from(public_root)
|
311
|
+
Dir[File.join(packs_dir, '/**/**')]
|
312
|
+
end
|
286
313
|
end
|
287
314
|
end
|
288
315
|
```
|
@@ -342,19 +369,21 @@ production:
|
|
342
369
|
|
343
370
|
### Amazon (AWS) IAM Users
|
344
371
|
|
345
|
-
Amazon has switched to the more secure IAM User security policy model. When generating a user & policy for asset_sync you
|
346
|
-
|
372
|
+
Amazon has switched to the more secure IAM User security policy model. When generating a user & policy for asset_sync you **must** ensure the policy has the following permissions, or you'll see the error:
|
373
|
+
|
374
|
+
```
|
375
|
+
Expected(200) <=> Actual(403 Forbidden)
|
376
|
+
```
|
377
|
+
|
378
|
+
IAM User Policy Example with minimum require permissions (replace `bucket_name` with your bucket):
|
347
379
|
|
348
|
-
IAM User Policy Example (replace "bucket_name" with your bucket):
|
349
380
|
``` json
|
350
381
|
{
|
351
382
|
"Statement": [
|
352
383
|
{
|
353
|
-
"Action":
|
354
|
-
"s3:ListAllMyBuckets"
|
355
|
-
],
|
384
|
+
"Action": "s3:ListBucket",
|
356
385
|
"Effect": "Allow",
|
357
|
-
"Resource": "arn:aws:s3
|
386
|
+
"Resource": "arn:aws:s3:::bucket_name"
|
358
387
|
},
|
359
388
|
{
|
360
389
|
"Action": "s3:PutObject*",
|
@@ -366,6 +395,7 @@ IAM User Policy Example (replace "bucket_name" with your bucket):
|
|
366
395
|
```
|
367
396
|
|
368
397
|
If you want to use IAM roles you must set ```config.aws_iam_roles = true``` in your initializers.
|
398
|
+
|
369
399
|
```
|
370
400
|
AssetSync.configure do |config|
|
371
401
|
# ...
|
data/lib/asset_sync/config.rb
CHANGED
@@ -29,10 +29,12 @@ module AssetSync
|
|
29
29
|
attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
|
30
30
|
attr_accessor :fog_directory # e.g. 'the-bucket-name'
|
31
31
|
attr_accessor :fog_region # e.g. 'eu-west-1'
|
32
|
-
attr_accessor :fog_path_style # e.g true
|
33
32
|
|
34
33
|
# Amazon AWS
|
35
|
-
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles
|
34
|
+
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles, :aws_signature_version
|
35
|
+
attr_accessor :fog_host # e.g. 's3.amazonaws.com'
|
36
|
+
attr_accessor :fog_path_style # e.g. true
|
37
|
+
attr_accessor :fog_scheme # e.g. 'http'
|
36
38
|
|
37
39
|
# Rackspace
|
38
40
|
attr_accessor :rackspace_username, :rackspace_api_key, :rackspace_auth_url
|
@@ -146,13 +148,16 @@ module AssetSync
|
|
146
148
|
def load_yml!
|
147
149
|
self.enabled = yml["enabled"] if yml.has_key?('enabled')
|
148
150
|
self.fog_provider = yml["fog_provider"]
|
151
|
+
self.fog_host = yml["fog_host"]
|
149
152
|
self.fog_directory = yml["fog_directory"]
|
150
153
|
self.fog_region = yml["fog_region"]
|
151
154
|
self.fog_path_style = yml["fog_path_style"]
|
155
|
+
self.fog_scheme = yml["fog_scheme"]
|
152
156
|
self.aws_access_key_id = yml["aws_access_key_id"]
|
153
157
|
self.aws_secret_access_key = yml["aws_secret_access_key"]
|
154
158
|
self.aws_reduced_redundancy = yml["aws_reduced_redundancy"]
|
155
159
|
self.aws_iam_roles = yml["aws_iam_roles"]
|
160
|
+
self.aws_signature_version = yml["aws_signature_version"]
|
156
161
|
self.rackspace_username = yml["rackspace_username"]
|
157
162
|
self.rackspace_auth_url = yml["rackspace_auth_url"] if yml.has_key?("rackspace_auth_url")
|
158
163
|
self.rackspace_api_key = yml["rackspace_api_key"]
|
@@ -199,6 +204,10 @@ module AssetSync
|
|
199
204
|
:aws_secret_access_key => aws_secret_access_key
|
200
205
|
})
|
201
206
|
end
|
207
|
+
options.merge!({:host => fog_host}) if fog_host
|
208
|
+
options.merge!({:scheme => fog_scheme}) if fog_scheme
|
209
|
+
options.merge!({:aws_signature_version => aws_signature_version}) if aws_signature_version
|
210
|
+
options.merge!({:path_style => fog_path_style}) if fog_path_style
|
202
211
|
elsif rackspace?
|
203
212
|
options.merge!({
|
204
213
|
:rackspace_username => rackspace_username,
|
@@ -218,7 +227,6 @@ module AssetSync
|
|
218
227
|
end
|
219
228
|
|
220
229
|
options.merge!({:region => fog_region}) if fog_region && !rackspace?
|
221
|
-
options.merge!({:path_style => fog_path_style}) if fog_path_style && aws?
|
222
230
|
return options
|
223
231
|
end
|
224
232
|
|
data/lib/asset_sync/engine.rb
CHANGED
@@ -16,9 +16,13 @@ module AssetSync
|
|
16
16
|
config.fog_provider = ENV['FOG_PROVIDER'] if ENV.has_key?('FOG_PROVIDER')
|
17
17
|
config.fog_directory = ENV['FOG_DIRECTORY'] if ENV.has_key?('FOG_DIRECTORY')
|
18
18
|
config.fog_region = ENV['FOG_REGION'] if ENV.has_key?('FOG_REGION')
|
19
|
+
config.fog_host = ENV['FOG_HOST'] if ENV.has_key?('FOG_HOST')
|
20
|
+
config.fog_scheme = ENV['FOG_SCHEMA'] if ENV.has_key?('FOG_SCHEMA')
|
21
|
+
config.fog_path_style = ENV['FOG_PATH_STYLE'] if ENV.has_key?('FOG_PATH_STYLE')
|
19
22
|
|
20
23
|
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID'] if ENV.has_key?('AWS_ACCESS_KEY_ID')
|
21
24
|
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY'] if ENV.has_key?('AWS_SECRET_ACCESS_KEY')
|
25
|
+
config.aws_signature_version = ENV['AWS_SIGNATURE_VERSION'] if ENV.has_key?('AWS_SIGNATURE_VERSION')
|
22
26
|
config.aws_reduced_redundancy = ENV['AWS_REDUCED_REDUNDANCY'] == true if ENV.has_key?('AWS_REDUCED_REDUNDANCY')
|
23
27
|
|
24
28
|
config.rackspace_username = ENV['RACKSPACE_USERNAME'] if ENV.has_key?('RACKSPACE_USERNAME')
|
data/lib/asset_sync/version.rb
CHANGED
@@ -1,50 +1,61 @@
|
|
1
|
-
AssetSync
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
if defined?(AssetSync)
|
2
|
+
AssetSync.configure do |config|
|
3
|
+
<%- if aws? -%>
|
4
|
+
config.fog_provider = 'AWS'
|
5
|
+
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
6
|
+
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
7
|
+
# To use AWS reduced redundancy storage.
|
8
|
+
# config.aws_reduced_redundancy = true
|
9
|
+
#
|
10
|
+
# Change AWS signature version. Default is 4
|
11
|
+
# config.aws_signature_version = 4
|
12
|
+
#
|
13
|
+
# Change host option in fog (only if you need to)
|
14
|
+
# config.fog_host = "s3.amazonaws.com"
|
15
|
+
#
|
16
|
+
# Use http instead of https. Default should be "https" (at least for fog-aws)
|
17
|
+
# config.fog_scheme = "http"
|
18
|
+
<%- elsif google? -%>
|
19
|
+
config.fog_provider = 'Google'
|
20
|
+
config.google_storage_access_key_id = ENV['GOOGLE_STORAGE_ACCESS_KEY_ID']
|
21
|
+
config.google_storage_secret_access_key = ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY']
|
22
|
+
<%- elsif rackspace? -%>
|
23
|
+
config.fog_provider = 'Rackspace'
|
24
|
+
config.rackspace_username = ENV['RACKSPACE_USERNAME']
|
25
|
+
config.rackspace_api_key = ENV['RACKSPACE_API_KEY']
|
16
26
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
27
|
+
# if you need to change rackspace_auth_url (e.g. if you need to use Rackspace London)
|
28
|
+
# config.rackspace_auth_url = "lon.auth.api.rackspacecloud.com"
|
29
|
+
<%- end -%>
|
30
|
+
config.fog_directory = ENV['FOG_DIRECTORY']
|
21
31
|
|
22
|
-
|
23
|
-
|
24
|
-
|
32
|
+
# Invalidate a file on a cdn after uploading files
|
33
|
+
# config.cdn_distribution_id = "12345"
|
34
|
+
# config.invalidate = ['file1.js']
|
25
35
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
36
|
+
# Increase upload performance by configuring your region
|
37
|
+
# config.fog_region = 'eu-west-1'
|
38
|
+
#
|
39
|
+
# Don't delete files from the store
|
40
|
+
# config.existing_remote_files = "keep"
|
41
|
+
#
|
42
|
+
# Automatically replace files with their equivalent gzip compressed version
|
43
|
+
# config.gzip_compression = true
|
44
|
+
#
|
45
|
+
# Use the Rails generated 'manifest.yml' file to produce the list of files to
|
46
|
+
# upload instead of searching the assets directory.
|
47
|
+
# config.manifest = true
|
48
|
+
#
|
49
|
+
# Fail silently. Useful for environments such as Heroku
|
50
|
+
# config.fail_silently = true
|
51
|
+
#
|
52
|
+
# Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
|
53
|
+
# Logging messages are sent to `STDOUT` when `log_silently` is falsy
|
54
|
+
# config.log_silently = true
|
55
|
+
#
|
56
|
+
# Allow custom assets to be cacheable. Note: The base filename will be matched
|
57
|
+
# If you have an asset with name `app.0ba4d3.js`, only `app.0ba4d3` will need to be matched
|
58
|
+
# config.cache_asset_regexps = [ /\.[a-f0-9]{8}$/i, /\.[a-f0-9]{20}$/i ]
|
59
|
+
# config.cache_asset_regexp = /\.[a-f0-9]{8}$/i
|
60
|
+
end
|
50
61
|
end
|
@@ -5,6 +5,15 @@ defaults: &defaults
|
|
5
5
|
aws_secret_access_key: "<%= aws_secret_access_key %>"
|
6
6
|
# To use AWS reduced redundancy storage.
|
7
7
|
# aws_reduced_redundancy: true
|
8
|
+
#
|
9
|
+
# Change AWS signature version. Default is 4
|
10
|
+
# aws_signature_version: 4
|
11
|
+
#
|
12
|
+
# Change host option in fog (only if you need to)
|
13
|
+
# fog_host: "s3.amazonaws.com"
|
14
|
+
#
|
15
|
+
# Use http instead of https. Default should be "https" (at least for fog-aws)
|
16
|
+
# fog_scheme: "http"
|
8
17
|
<%- elsif google? -%>
|
9
18
|
fog_provider: 'Google'
|
10
19
|
google_storage_access_key_id: "<%= google_storage_access_key_id %>"
|
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.
|
4
|
+
version: 2.3.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: 2017-
|
14
|
+
date: 2017-12-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-core
|
@@ -225,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
225
|
version: '0'
|
226
226
|
requirements: []
|
227
227
|
rubyforge_project: asset_sync
|
228
|
-
rubygems_version: 2.
|
228
|
+
rubygems_version: 2.7.3
|
229
229
|
signing_key:
|
230
230
|
specification_version: 4
|
231
231
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|