asset_sync 2.2.0 → 2.3.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
- SHA1:
3
- metadata.gz: 5b188551b31d31cea82d0a2daa66ea13611526bf
4
- data.tar.gz: 8dc71ab706a8da82c83030d1c0bcabe88d44e4d4
2
+ SHA256:
3
+ metadata.gz: 6da0a6735b574c2e13ef9bb97f00b35f6b28555e81a43aeaa2a4d74ca86cac44
4
+ data.tar.gz: 11eafe2e4c2297e47a64736d4d6834140271d26c557dcddf2244eabd356cc2b3
5
5
  SHA512:
6
- metadata.gz: 4666031ff720620d925adbfee0e5213abd28c96e2df89f37af6e88dfd96d76e3b439e4a0e52c373243ea5452078218b07afaacc86f4b35f8fdeed8fa660c37f9
7
- data.tar.gz: bef8d1ecde9c3bb946016db35ec7f558b9dea0f51a96bb19a727f03d2560688b48901720a3d2e102cf1aad2e5b3a617021e1cdc2e37bb502912dbbb36c9ef422
6
+ metadata.gz: 3fb08a40bb3769b7a966483b28c9c7b5b050ff6f2457f066f4c66bd3646f6da11fc99981b62924a884effa8b0662e314f1725b0e92fdfc6166536a42634f42ce
7
+ data.tar.gz: 6743f47d2400bce60b26291c21743f0a99427ddb108b9d5f5492913d595f5b71dd2824bf48e51e1117a6e6be641afb3dce85e2265f9dd8cf537be30f75f2df5d
@@ -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
@@ -18,7 +18,19 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
- ## [2.2.0] - 2016-07-12
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] - 2016-05-19
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.2.0...HEAD
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
- Dir[File.join(Webpacker::Configuration.fetch(:public_output_path), '/**/**')]
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 will need to ensure the policy has the following permissions.
346
- You __must__ give the user permission to **s3:ListAllMyBuckets** as well as give permission to both the bucket, as well as the bucket's contents (/*). If not given all these permissions you'll see the error ```Expected(200) <=> Actual(403 Forbidden) ```
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
  # ...
@@ -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
 
@@ -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')
@@ -1,3 +1,3 @@
1
1
  module AssetSync
2
- VERSION = "2.2.0".freeze
2
+ VERSION = "2.3.0".freeze
3
3
  end
@@ -1,50 +1,61 @@
1
- AssetSync.configure do |config|
2
- <%- if aws? -%>
3
- config.fog_provider = 'AWS'
4
- config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
5
- config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
6
- # To use AWS reduced redundancy storage.
7
- # config.aws_reduced_redundancy = true
8
- <%- elsif google? -%>
9
- config.fog_provider = 'Google'
10
- config.google_storage_access_key_id = ENV['GOOGLE_STORAGE_ACCESS_KEY_ID']
11
- config.google_storage_secret_access_key = ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY']
12
- <%- elsif rackspace? -%>
13
- config.fog_provider = 'Rackspace'
14
- config.rackspace_username = ENV['RACKSPACE_USERNAME']
15
- config.rackspace_api_key = ENV['RACKSPACE_API_KEY']
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
- # if you need to change rackspace_auth_url (e.g. if you need to use Rackspace London)
18
- # config.rackspace_auth_url = "lon.auth.api.rackspacecloud.com"
19
- <%- end -%>
20
- config.fog_directory = ENV['FOG_DIRECTORY']
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
- # Invalidate a file on a cdn after uploading files
23
- # config.cdn_distribution_id = "12345"
24
- # config.invalidate = ['file1.js']
32
+ # Invalidate a file on a cdn after uploading files
33
+ # config.cdn_distribution_id = "12345"
34
+ # config.invalidate = ['file1.js']
25
35
 
26
- # Increase upload performance by configuring your region
27
- # config.fog_region = 'eu-west-1'
28
- #
29
- # Don't delete files from the store
30
- # config.existing_remote_files = "keep"
31
- #
32
- # Automatically replace files with their equivalent gzip compressed version
33
- # config.gzip_compression = true
34
- #
35
- # Use the Rails generated 'manifest.yml' file to produce the list of files to
36
- # upload instead of searching the assets directory.
37
- # config.manifest = true
38
- #
39
- # Fail silently. Useful for environments such as Heroku
40
- # config.fail_silently = true
41
- #
42
- # Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
43
- # Logging messages are sent to `STDOUT` when `log_silently` is falsy
44
- # config.log_silently = true
45
- #
46
- # Allow custom assets to be cacheable. Note: The base filename will be matched
47
- # If you have an asset with name `app.0ba4d3.js`, only `app.0ba4d3` will need to be matched
48
- # config.cache_asset_regexps = [ /\.[a-f0-9]{8}$/i, /\.[a-f0-9]{20}$/i ]
49
- # config.cache_asset_regexp = /\.[a-f0-9]{8}$/i
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.2.0
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-07-12 00:00:00.000000000 Z
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.6.12
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