asset_sync 2.16.0 → 2.18.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/codeql.yml +43 -0
- data/.github/workflows/tests.yaml +1 -0
- data/CHANGELOG.md +18 -1
- data/README.md +8 -3
- data/lib/asset_sync/config.rb +8 -3
- data/lib/asset_sync/version.rb +1 -1
- data/spec/unit/asset_sync_spec.rb +22 -0
- data/spec/unit/google_spec.rb +24 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b64084370fbccba4e315b80d8877893f7e556fc24eecc938f1dda2a328a78e3b
|
4
|
+
data.tar.gz: f387731557d333a5d295c4c62ac9fedc3d6b23c57509f1cefb306d823d91845e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f64ebb5f182457d6010c0c2c5ad8535668f980594c8d59bc7c59838d105e64d2ae7c067dca99604bca9e1dacccd2dedc5104cc88cedd2dfc7679aab7ebbe0d22
|
7
|
+
data.tar.gz: 87bf1e02addf61a30abfddd4ea082f2d730db5428425d2676808624349d3f2f987967051a85b9d075155e1555dbdfe3dcd34ab2d18580e39d272280d1436596f
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: "CodeQL"
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "master" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "master" ]
|
8
|
+
schedule:
|
9
|
+
- cron: "11 12 * * 0"
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
analyze:
|
13
|
+
name: Analyze
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
permissions:
|
16
|
+
actions: read
|
17
|
+
contents: read
|
18
|
+
security-events: write
|
19
|
+
|
20
|
+
strategy:
|
21
|
+
fail-fast: false
|
22
|
+
matrix:
|
23
|
+
language:
|
24
|
+
- javascript
|
25
|
+
- ruby
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- name: Checkout
|
29
|
+
uses: actions/checkout@v3
|
30
|
+
|
31
|
+
- name: Initialize CodeQL
|
32
|
+
uses: github/codeql-action/init@v2
|
33
|
+
with:
|
34
|
+
languages: ${{ matrix.language }}
|
35
|
+
queries: +security-and-quality
|
36
|
+
|
37
|
+
- name: Autobuild
|
38
|
+
uses: github/codeql-action/autobuild@v2
|
39
|
+
|
40
|
+
- name: Perform CodeQL Analysis
|
41
|
+
uses: github/codeql-action/analyze@v2
|
42
|
+
with:
|
43
|
+
category: "/language:${{ matrix.language }}"
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [2.18.0] - 2023-01-30
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Add `google_auth` configuration option
|
26
|
+
(https://github.com/AssetSync/asset_sync/pull/432)
|
27
|
+
|
28
|
+
|
29
|
+
## [2.17.0] - 2023-01-13
|
30
|
+
|
31
|
+
### Added
|
32
|
+
|
33
|
+
- Add option `fog_options`
|
34
|
+
(https://github.com/AssetSync/asset_sync/pull/431)
|
35
|
+
|
36
|
+
|
21
37
|
## [2.16.0] - 2022-08-26
|
22
38
|
|
23
39
|
### Added
|
@@ -1062,7 +1078,8 @@ Changes:
|
|
1062
1078
|
* Merge branch 'sinatra'
|
1063
1079
|
|
1064
1080
|
|
1065
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.
|
1081
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.17.0...HEAD
|
1082
|
+
[2.17.0]: https://github.com/AssetSync/asset_sync/compare/v2.16.0...v2.17.0
|
1066
1083
|
[2.16.0]: https://github.com/AssetSync/asset_sync/compare/v2.15.3...v2.16.0
|
1067
1084
|
[2.15.3]: https://github.com/AssetSync/asset_sync/compare/v2.15.2...v2.15.3
|
1068
1085
|
[2.15.2]: https://github.com/AssetSync/asset_sync/compare/v2.15.1...v2.15.2
|
data/README.md
CHANGED
@@ -244,8 +244,8 @@ AssetSync.configure do |config|
|
|
244
244
|
#
|
245
245
|
# Change canned ACL of uploaded object. Default is unset. Will override fog_public if set.
|
246
246
|
# Choose from: private | public-read | public-read-write | aws-exec-read |
|
247
|
-
# authenticated-read | bucket-owner-read | bucket-owner-full-control
|
248
|
-
# config.aws_acl = nil
|
247
|
+
# authenticated-read | bucket-owner-read | bucket-owner-full-control
|
248
|
+
# config.aws_acl = nil
|
249
249
|
#
|
250
250
|
# Change host option in fog (only if you need to)
|
251
251
|
# config.fog_host = 's3.amazonaws.com'
|
@@ -256,6 +256,10 @@ AssetSync.configure do |config|
|
|
256
256
|
# Use http instead of https.
|
257
257
|
# config.fog_scheme = 'http'
|
258
258
|
#
|
259
|
+
# Extra fog options.
|
260
|
+
# Overrides any existing value (even those set by AssetSync)
|
261
|
+
# config.fog_options = {}
|
262
|
+
#
|
259
263
|
# Automatically replace files with their equivalent gzip compressed version
|
260
264
|
# config.gzip_compression = true
|
261
265
|
#
|
@@ -322,7 +326,7 @@ defaults: &defaults
|
|
322
326
|
#
|
323
327
|
# Change canned ACL of uploaded object. Default is unset. Will override fog_public if set.
|
324
328
|
# Choose from: private | public-read | public-read-write | aws-exec-read |
|
325
|
-
# authenticated-read | bucket-owner-read | bucket-owner-full-control
|
329
|
+
# authenticated-read | bucket-owner-read | bucket-owner-full-control
|
326
330
|
# aws_acl: null
|
327
331
|
#
|
328
332
|
# Change host option in fog (only if you need to)
|
@@ -436,6 +440,7 @@ The blocks are run when local files are being scanned and uploaded
|
|
436
440
|
|
437
441
|
* **fog\_region**: the region your storage bucket is in e.g. *eu-west-1* (AWS), *ord* (Rackspace), *japanwest* (Azure Blob)
|
438
442
|
* **fog\_path\_style**: To use buckets with dot in names, check https://github.com/fog/fog/issues/2381#issuecomment-28088524
|
443
|
+
* **fog\_options**: For extra fog options. Overrides any existing value (even those set by AssetSync)
|
439
444
|
|
440
445
|
#### AWS
|
441
446
|
|
data/lib/asset_sync/config.rb
CHANGED
@@ -35,6 +35,7 @@ module AssetSync
|
|
35
35
|
attr_accessor :fog_directory # e.g. 'the-bucket-name'
|
36
36
|
attr_accessor :fog_region # e.g. 'eu-west-1'
|
37
37
|
attr_reader :fog_public # e.g. true, false, "default"
|
38
|
+
attr_accessor :fog_options # e.g. { enable_signature_v4_streaming: true }
|
38
39
|
|
39
40
|
# Amazon AWS
|
40
41
|
attr_accessor :aws_access_key_id
|
@@ -55,6 +56,7 @@ module AssetSync
|
|
55
56
|
attr_accessor :rackspace_username, :rackspace_api_key, :rackspace_auth_url
|
56
57
|
|
57
58
|
# Google Storage
|
59
|
+
attr_accessor :google_auth # when using generic auth (like access tokens)
|
58
60
|
attr_accessor :google_storage_secret_access_key, :google_storage_access_key_id # when using S3 interop
|
59
61
|
attr_accessor :google_json_key_location # when using service accounts
|
60
62
|
attr_accessor :google_json_key_string # when using service accounts
|
@@ -80,7 +82,7 @@ module AssetSync
|
|
80
82
|
validates :rackspace_api_key, :presence => true, :if => :rackspace?
|
81
83
|
validates :google_storage_secret_access_key, :presence => true, :if => :google_interop?
|
82
84
|
validates :google_storage_access_key_id, :presence => true, :if => :google_interop?
|
83
|
-
validates :google_project, :presence => true, :if =>
|
85
|
+
validates :google_project, :presence => true, :if => -> (c) { c.google_auth || c.google_service_account? }
|
84
86
|
validate(:if => :google_service_account?) do
|
85
87
|
unless google_json_key_location.present? || google_json_key_string.present?
|
86
88
|
errors.add(:base, 'must provide either google_json_key_location or google_json_key_string if using Google service account')
|
@@ -161,7 +163,7 @@ module AssetSync
|
|
161
163
|
end
|
162
164
|
|
163
165
|
def google_interop?
|
164
|
-
google? && google_json_key_location.nil? && google_json_key_string.nil?
|
166
|
+
google? && google_auth.nil? && google_json_key_location.nil? && google_json_key_string.nil?
|
165
167
|
end
|
166
168
|
|
167
169
|
def google_service_account?
|
@@ -309,7 +311,9 @@ module AssetSync
|
|
309
311
|
options.merge!({ :rackspace_region => fog_region }) if fog_region
|
310
312
|
options.merge!({ :rackspace_auth_url => rackspace_auth_url }) if rackspace_auth_url
|
311
313
|
elsif google?
|
312
|
-
if
|
314
|
+
if google_auth
|
315
|
+
options.merge!({:google_auth => google_auth, :google_project => google_project})
|
316
|
+
elsif google_json_key_location
|
313
317
|
options.merge!({:google_json_key_location => google_json_key_location, :google_project => google_project})
|
314
318
|
elsif google_json_key_string
|
315
319
|
options.merge!({:google_json_key_string => google_json_key_string, :google_project => google_project})
|
@@ -338,6 +342,7 @@ module AssetSync
|
|
338
342
|
raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS, Rackspace and Google are supported currently."
|
339
343
|
end
|
340
344
|
|
345
|
+
options.merge!(@fog_options) if @fog_options
|
341
346
|
options
|
342
347
|
end
|
343
348
|
|
data/lib/asset_sync/version.rb
CHANGED
@@ -278,6 +278,28 @@ describe AssetSync do
|
|
278
278
|
end
|
279
279
|
end
|
280
280
|
|
281
|
+
describe 'with fog_options' do
|
282
|
+
before(:each) do
|
283
|
+
AssetSync.config = AssetSync::Config.new
|
284
|
+
AssetSync.configure do |config|
|
285
|
+
config.fog_provider = 'AWS'
|
286
|
+
config.fog_region = 'eu-west-1'
|
287
|
+
config.fog_path_style = 'true'
|
288
|
+
config.fog_options = { enable_signature_v4_streaming: true }
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
it "assigns fog_options" do
|
293
|
+
AssetSync.config.fog_options = { enable_signature_v4_streaming: true }
|
294
|
+
expect(AssetSync.config.fog_options).to include(
|
295
|
+
provider: 'AWS',
|
296
|
+
region: 'eu-west-1',
|
297
|
+
path_style: 'true',
|
298
|
+
enable_signature_v4_streaming: true,
|
299
|
+
)
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
281
303
|
describe 'with invalid yml' do
|
282
304
|
before(:each) do
|
283
305
|
set_rails_root('with_invalid_yml')
|
data/spec/unit/google_spec.rb
CHANGED
@@ -38,6 +38,30 @@ describe AssetSync do
|
|
38
38
|
expect(AssetSync.config.manifest).to be_falsey
|
39
39
|
end
|
40
40
|
|
41
|
+
describe "when using user-specified google credentials" do
|
42
|
+
before(:each) do
|
43
|
+
AssetSync.configure do |config|
|
44
|
+
config.google_auth = "access-token"
|
45
|
+
config.google_project = 'a-google-project-name'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should configure google_auth" do
|
50
|
+
expect(AssetSync.config.google_auth).to eq("access-token")
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return the correct fog_options" do
|
54
|
+
expected_fog_options = { google_auth: "access-token",
|
55
|
+
google_project: 'a-google-project-name',
|
56
|
+
provider: "Google"}
|
57
|
+
expect(AssetSync.config.fog_options).to eq(expected_fog_options)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should not require that other parameters be set" do
|
61
|
+
expect(AssetSync.config.valid?).to eq(true)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
41
65
|
describe "when using S3 interop API" do
|
42
66
|
before(:each) do
|
43
67
|
AssetSync.configure do |config|
|
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.18.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:
|
14
|
+
date: 2023-01-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-core
|
@@ -221,6 +221,7 @@ extensions: []
|
|
221
221
|
extra_rdoc_files: []
|
222
222
|
files:
|
223
223
|
- ".editorconfig"
|
224
|
+
- ".github/workflows/codeql.yml"
|
224
225
|
- ".github/workflows/tests.yaml"
|
225
226
|
- ".gitignore"
|
226
227
|
- ".travis.yml"
|
@@ -287,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
288
|
- !ruby/object:Gem::Version
|
288
289
|
version: '0'
|
289
290
|
requirements: []
|
290
|
-
rubygems_version: 3.
|
291
|
+
rubygems_version: 3.4.5
|
291
292
|
signing_key:
|
292
293
|
specification_version: 4
|
293
294
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|