asset_sync 2.17.0 → 2.18.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: 30fcfd0667904cde532ba24578e9bbc15f33051d5bde3e345226915c7135ccde
4
- data.tar.gz: 67cff250568d8473c940733f182e425b811550be1c95e940498508fe5d81e656
3
+ metadata.gz: b64084370fbccba4e315b80d8877893f7e556fc24eecc938f1dda2a328a78e3b
4
+ data.tar.gz: f387731557d333a5d295c4c62ac9fedc3d6b23c57509f1cefb306d823d91845e
5
5
  SHA512:
6
- metadata.gz: 6c2471c8dcad1fdd461fac5e7881723f012888e295e5f8bda6c13137ff1cb31f3aef2db669d71588a3a699dbd2d56366abacdf9ab0d0cae4b8e7b5dba2bff8f8
7
- data.tar.gz: 1c5fb8a038bc21c0f8218a1dd74ec6cff47df3b43588e0b9599032559a639564341814f1576faa5b6a9f9378ca2e37de1c08f219748999f0e7a437f48e96fe22
6
+ metadata.gz: f64ebb5f182457d6010c0c2c5ad8535668f980594c8d59bc7c59838d105e64d2ae7c067dca99604bca9e1dacccd2dedc5104cc88cedd2dfc7679aab7ebbe0d22
7
+ data.tar.gz: 87bf1e02addf61a30abfddd4ea082f2d730db5428425d2676808624349d3f2f987967051a85b9d075155e1555dbdfe3dcd34ab2d18580e39d272280d1436596f
data/CHANGELOG.md CHANGED
@@ -7,7 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
8
  ### Added
9
9
 
10
- - Add `fog_options` configuration option.
10
+ - Nothing
11
11
 
12
12
  ### Changed
13
13
 
@@ -18,6 +18,14 @@ 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
+
21
29
  ## [2.17.0] - 2023-01-13
22
30
 
23
31
  ### Added
@@ -56,6 +56,7 @@ module AssetSync
56
56
  attr_accessor :rackspace_username, :rackspace_api_key, :rackspace_auth_url
57
57
 
58
58
  # Google Storage
59
+ attr_accessor :google_auth # when using generic auth (like access tokens)
59
60
  attr_accessor :google_storage_secret_access_key, :google_storage_access_key_id # when using S3 interop
60
61
  attr_accessor :google_json_key_location # when using service accounts
61
62
  attr_accessor :google_json_key_string # when using service accounts
@@ -81,7 +82,7 @@ module AssetSync
81
82
  validates :rackspace_api_key, :presence => true, :if => :rackspace?
82
83
  validates :google_storage_secret_access_key, :presence => true, :if => :google_interop?
83
84
  validates :google_storage_access_key_id, :presence => true, :if => :google_interop?
84
- validates :google_project, :presence => true, :if => :google_service_account?
85
+ validates :google_project, :presence => true, :if => -> (c) { c.google_auth || c.google_service_account? }
85
86
  validate(:if => :google_service_account?) do
86
87
  unless google_json_key_location.present? || google_json_key_string.present?
87
88
  errors.add(:base, 'must provide either google_json_key_location or google_json_key_string if using Google service account')
@@ -162,7 +163,7 @@ module AssetSync
162
163
  end
163
164
 
164
165
  def google_interop?
165
- 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?
166
167
  end
167
168
 
168
169
  def google_service_account?
@@ -310,7 +311,9 @@ module AssetSync
310
311
  options.merge!({ :rackspace_region => fog_region }) if fog_region
311
312
  options.merge!({ :rackspace_auth_url => rackspace_auth_url }) if rackspace_auth_url
312
313
  elsif google?
313
- if google_json_key_location
314
+ if google_auth
315
+ options.merge!({:google_auth => google_auth, :google_project => google_project})
316
+ elsif google_json_key_location
314
317
  options.merge!({:google_json_key_location => google_json_key_location, :google_project => google_project})
315
318
  elsif google_json_key_string
316
319
  options.merge!({:google_json_key_string => google_json_key_string, :google_project => google_project})
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssetSync
4
- VERSION = "2.17.0"
4
+ VERSION = "2.18.0"
5
5
  end
@@ -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.17.0
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: 2023-01-13 00:00:00.000000000 Z
14
+ date: 2023-01-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
288
  - !ruby/object:Gem::Version
289
289
  version: '0'
290
290
  requirements: []
291
- rubygems_version: 3.4.3
291
+ rubygems_version: 3.4.5
292
292
  signing_key:
293
293
  specification_version: 4
294
294
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and