chamber 3.0.0rc1 → 3.0.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +5 -5
- data/lib/chamber/binary/runner.rb +10 -12
- data/lib/chamber/commands/base.rb +4 -4
- data/lib/chamber/commands/initialize.rb +5 -5
- data/lib/chamber/commands/securable.rb +5 -9
- data/lib/chamber/commands/show.rb +0 -1
- data/lib/chamber/context_resolver.rb +5 -4
- data/lib/chamber/encryption_methods/public_key.rb +26 -14
- data/lib/chamber/encryption_methods/ssl.rb +36 -28
- data/lib/chamber/errors/disallowed_class.rb +8 -0
- data/lib/chamber/errors/invalid_key_type.rb +8 -0
- data/lib/chamber/errors/missing_index.rb +13 -0
- data/lib/chamber/errors/missing_setting.rb +13 -0
- data/lib/chamber/errors/non_conforming_key.rb +8 -0
- data/lib/chamber/file.rb +18 -7
- data/lib/chamber/file_set.rb +5 -1
- data/lib/chamber/files/signature.rb +6 -6
- data/lib/chamber/filters/decryption_filter.rb +9 -11
- data/lib/chamber/filters/encryption_filter.rb +8 -9
- data/lib/chamber/filters/environment_filter.rb +16 -18
- data/lib/chamber/filters/failed_decryption_filter.rb +3 -3
- data/lib/chamber/filters/namespace_filter.rb +10 -12
- data/lib/chamber/filters/secure_filter.rb +3 -3
- data/lib/chamber/filters/translate_secure_keys_filter.rb +3 -3
- data/lib/chamber/instance.rb +4 -7
- data/lib/chamber/integrations/sinatra.rb +1 -1
- data/lib/chamber/keys/base.rb +11 -7
- data/lib/chamber/namespace_set.rb +2 -2
- data/lib/chamber/rails.rb +1 -1
- data/lib/chamber/refinements/deep_dup.rb +12 -36
- data/lib/chamber/refinements/enumerable.rb +8 -20
- data/lib/chamber/refinements/hash.rb +10 -36
- data/lib/chamber/rubinius_fix.rb +1 -1
- data/lib/chamber/settings.rb +39 -23
- data/lib/chamber/types/secured.rb +8 -8
- data/lib/chamber/version.rb +1 -1
- data/lib/chamber.rb +0 -5
- data.tar.gz.sig +0 -0
- metadata +29 -34
- metadata.gz.sig +0 -0
- data/lib/chamber/adapters/cloud/circle_ci.rb +0 -85
- data/lib/chamber/adapters/cloud/heroku.rb +0 -74
- data/lib/chamber/binary/circle_ci.rb +0 -123
- data/lib/chamber/binary/heroku.rb +0 -111
- data/lib/chamber/binary/travis.rb +0 -37
- data/lib/chamber/commands/cloud/base.rb +0 -35
- data/lib/chamber/commands/cloud/clear.rb +0 -25
- data/lib/chamber/commands/cloud/compare.rb +0 -26
- data/lib/chamber/commands/cloud/pull.rb +0 -29
- data/lib/chamber/commands/cloud/push.rb +0 -44
- data/lib/chamber/commands/travis/secure.rb +0 -37
- data/lib/chamber/refinements/array.rb +0 -20
@@ -37,14 +37,14 @@ class Secured < CHAMBER_TYPE_VALUE_SUPERCLASS
|
|
37
37
|
|
38
38
|
def cast(value)
|
39
39
|
case value
|
40
|
-
when
|
40
|
+
when Hash
|
41
41
|
value
|
42
|
-
when
|
42
|
+
when String
|
43
43
|
::JSON.parse(value)
|
44
|
-
when
|
44
|
+
when NilClass
|
45
45
|
nil
|
46
46
|
else
|
47
|
-
fail
|
47
|
+
fail ArgumentError, 'Any attributes encrypted with Chamber must be either a Hash or a valid JSON string'
|
48
48
|
end
|
49
49
|
end
|
50
50
|
alias type_cast_from_user cast
|
@@ -54,14 +54,14 @@ class Secured < CHAMBER_TYPE_VALUE_SUPERCLASS
|
|
54
54
|
|
55
55
|
return if value.nil?
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
Chamber.decrypt(value,
|
58
|
+
decryption_keys: decryption_keys,
|
59
|
+
encryption_keys: encryption_keys)
|
60
60
|
end
|
61
61
|
alias type_cast_from_database deserialize
|
62
62
|
|
63
63
|
def serialize(value)
|
64
|
-
fail
|
64
|
+
fail ArgumentError, 'Any attributes encrypted with Chamber must be a Hash' unless value.is_a?(Hash)
|
65
65
|
|
66
66
|
::JSON.dump(
|
67
67
|
::Chamber.encrypt(value,
|
data/lib/chamber/version.rb
CHANGED
data/lib/chamber.rb
CHANGED
@@ -11,10 +11,6 @@ module Chamber
|
|
11
11
|
self.instance = Instance.new(**args)
|
12
12
|
end
|
13
13
|
|
14
|
-
def env
|
15
|
-
instance.settings
|
16
|
-
end
|
17
|
-
|
18
14
|
def instance
|
19
15
|
@instance ||= Instance.new
|
20
16
|
end
|
@@ -87,7 +83,6 @@ module Chamber
|
|
87
83
|
:dig!,
|
88
84
|
:dig,
|
89
85
|
:encrypt,
|
90
|
-
:env,
|
91
86
|
:filenames,
|
92
87
|
:files,
|
93
88
|
:instance,
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chamber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekompanee
|
8
8
|
- jfelchner
|
9
9
|
- stevenhallen
|
10
10
|
- m5rk
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain:
|
14
14
|
- |
|
15
15
|
-----BEGIN CERTIFICATE-----
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
MIIEdjCCAt6gAwIBAgIBATANBgkqhkiG9w0BAQsFADAyMTAwLgYDVQQDDCdhY2Nv
|
17
|
+
dW50c19ydWJ5Z2Vtcy9EQz10aGVrb21wYW5lZS9EQz1jb20wHhcNMjMwMzA2MDM0
|
18
|
+
ODUxWhcNMjYwMzA1MDM0ODUxWjAyMTAwLgYDVQQDDCdhY2NvdW50c19ydWJ5Z2Vt
|
19
19
|
cy9EQz10aGVrb21wYW5lZS9EQz1jb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAw
|
20
20
|
ggGKAoIBgQD0Z84PxtE0iiWCMTQbnit6D4w55GGBQZnhpWUCJwC0SpQ/jnT0Fsma
|
21
21
|
g8oAIdDclLvLC9jzqSAmkOujlpkJMb5NabgkhKFwHi6cVW/gz/cVnISAv8LQTIM5
|
@@ -25,18 +25,20 @@ cert_chain:
|
|
25
25
|
NBRKSuO15kpPo2G55N0HLy8abUzbu5cqjhSbIk9hzD6AmdGCT4DqlsdHI5gOrGP0
|
26
26
|
BO6VxGpRuRETKoZ4epPCsXC2XAwk3TJXkuuqYkgdcv8ZR4rPW2CiPvRqgG1YVwWj
|
27
27
|
SrIy5Dt/dlMvxdIMiTj6ytAQP1kfdKPFWrJTIA2tspl/eNB+LiYsVdj8d0UU/KTY
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
y7jqKMpOE1UCAwEAAaOBljCBkzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
29
|
+
HQ4EFgQU7+XQuN042fZGvzLhYbIwDfsxZV8wLAYDVR0RBCUwI4EhYWNjb3VudHMr
|
30
|
+
cnVieWdlbXNAdGhla29tcGFuZWUuY29tMCwGA1UdEgQlMCOBIWFjY291bnRzK3J1
|
31
|
+
YnlnZW1zQHRoZWtvbXBhbmVlLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAIaR7p1yv
|
32
|
+
+nE+JX/7nItZ0YKE71L6JdAuAlUfvTuHq8S1dpKdewrm3ewNPGt2nK9svy8vxNUQ
|
33
|
+
AqT3KWIaGVwkslL/y/MRxBQHOOZz9XCMmUYXIencNXqNzkWLubcCK7uF1h8mRS46
|
34
|
+
jvGfiXfYDwi8QzqJA8IFEK/oyKCCKlNiIbz8Q4yHM4wTqLwjYQqlHiBEgCF2UHc6
|
35
|
+
0tCTD8eixdZUeuexdB7M7F/M086y1wjWyYCeijqbKmTPqKb8n6AmLo0fqkNBVibJ
|
36
|
+
nYVEOECVzKt/f3PoG0Z2oMnZ6FKqpFiDpPqgAlRDmVznjpMdZR204/t79NoEVlLf
|
37
|
+
lxz9Q1u83TUBUPvDRzKg6Kq9P28JV1Ipnst0ecQZOsnoLjl1BmxUt29hQPJKjd11
|
38
|
+
Z6HMkN0PHJ6eG0Zl3/H4H8Xb+KreWlEx3sXXfZj6UscrdHAVffRQnM1E98PCqnRX
|
39
|
+
l5EwT4ShG/HorJMQSTY1EoBLZf54NrD5WlWcfM0CLrcvT7QM77dIqmue
|
38
40
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
41
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
40
42
|
dependencies:
|
41
43
|
- !ruby/object:Gem::Dependency
|
42
44
|
name: thor
|
@@ -142,18 +144,8 @@ files:
|
|
142
144
|
- README.md
|
143
145
|
- bin/chamber
|
144
146
|
- lib/chamber.rb
|
145
|
-
- lib/chamber/adapters/cloud/circle_ci.rb
|
146
|
-
- lib/chamber/adapters/cloud/heroku.rb
|
147
|
-
- lib/chamber/binary/circle_ci.rb
|
148
|
-
- lib/chamber/binary/heroku.rb
|
149
147
|
- lib/chamber/binary/runner.rb
|
150
|
-
- lib/chamber/binary/travis.rb
|
151
148
|
- lib/chamber/commands/base.rb
|
152
|
-
- lib/chamber/commands/cloud/base.rb
|
153
|
-
- lib/chamber/commands/cloud/clear.rb
|
154
|
-
- lib/chamber/commands/cloud/compare.rb
|
155
|
-
- lib/chamber/commands/cloud/pull.rb
|
156
|
-
- lib/chamber/commands/cloud/push.rb
|
157
149
|
- lib/chamber/commands/comparable.rb
|
158
150
|
- lib/chamber/commands/compare.rb
|
159
151
|
- lib/chamber/commands/files.rb
|
@@ -163,7 +155,6 @@ files:
|
|
163
155
|
- lib/chamber/commands/show.rb
|
164
156
|
- lib/chamber/commands/sign.rb
|
165
157
|
- lib/chamber/commands/travis.rb
|
166
|
-
- lib/chamber/commands/travis/secure.rb
|
167
158
|
- lib/chamber/commands/verify.rb
|
168
159
|
- lib/chamber/configuration.rb
|
169
160
|
- lib/chamber/context_resolver.rb
|
@@ -171,7 +162,12 @@ files:
|
|
171
162
|
- lib/chamber/encryption_methods/public_key.rb
|
172
163
|
- lib/chamber/encryption_methods/ssl.rb
|
173
164
|
- lib/chamber/errors/decryption_failure.rb
|
165
|
+
- lib/chamber/errors/disallowed_class.rb
|
174
166
|
- lib/chamber/errors/environment_conversion.rb
|
167
|
+
- lib/chamber/errors/invalid_key_type.rb
|
168
|
+
- lib/chamber/errors/missing_index.rb
|
169
|
+
- lib/chamber/errors/missing_setting.rb
|
170
|
+
- lib/chamber/errors/non_conforming_key.rb
|
175
171
|
- lib/chamber/file.rb
|
176
172
|
- lib/chamber/file_set.rb
|
177
173
|
- lib/chamber/files/signature.rb
|
@@ -192,7 +188,6 @@ files:
|
|
192
188
|
- lib/chamber/keys/encryption.rb
|
193
189
|
- lib/chamber/namespace_set.rb
|
194
190
|
- lib/chamber/rails.rb
|
195
|
-
- lib/chamber/refinements/array.rb
|
196
191
|
- lib/chamber/refinements/deep_dup.rb
|
197
192
|
- lib/chamber/refinements/enumerable.rb
|
198
193
|
- lib/chamber/refinements/hash.rb
|
@@ -212,7 +207,7 @@ metadata:
|
|
212
207
|
homepage_uri: https://github.com/thekompanee/chamber
|
213
208
|
source_code_uri: https://github.com/thekompanee/chamber
|
214
209
|
wiki_uri: https://github.com/thekompanee/chamber/wiki
|
215
|
-
post_install_message:
|
210
|
+
post_install_message:
|
216
211
|
rdoc_options: []
|
217
212
|
require_paths:
|
218
213
|
- lib
|
@@ -220,15 +215,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
220
215
|
requirements:
|
221
216
|
- - ">="
|
222
217
|
- !ruby/object:Gem::Version
|
223
|
-
version: 2.
|
218
|
+
version: 2.7.5
|
224
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
225
220
|
requirements:
|
226
|
-
- - "
|
221
|
+
- - ">="
|
227
222
|
- !ruby/object:Gem::Version
|
228
|
-
version:
|
223
|
+
version: '0'
|
229
224
|
requirements: []
|
230
|
-
rubygems_version: 3.
|
231
|
-
signing_key:
|
225
|
+
rubygems_version: 3.1.6
|
226
|
+
signing_key:
|
232
227
|
specification_version: 4
|
233
228
|
summary: A surprisingly configurable convention-based approach to managing your application's
|
234
229
|
custom configuration settings.
|
metadata.gz.sig
CHANGED
Binary file
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'net/http'
|
5
|
-
require 'uri'
|
6
|
-
|
7
|
-
module Chamber
|
8
|
-
module Adapters
|
9
|
-
module Cloud
|
10
|
-
class CircleCi
|
11
|
-
API_HOST = 'circleci.com'
|
12
|
-
API_PORT = 443
|
13
|
-
API_BASE_URI = '/api/v1.1'
|
14
|
-
|
15
|
-
attr_accessor :api_token,
|
16
|
-
:project,
|
17
|
-
:username,
|
18
|
-
:vcs_type
|
19
|
-
|
20
|
-
def initialize(api_token:, project:, username:, vcs_type:)
|
21
|
-
self.api_token = api_token
|
22
|
-
self.project = project
|
23
|
-
self.username = username
|
24
|
-
self.vcs_type = vcs_type
|
25
|
-
end
|
26
|
-
|
27
|
-
def add_environment_variable(name, value)
|
28
|
-
value = value.gsub(/\n/, '\n')
|
29
|
-
request = ::Net::HTTP::Post.new(request_uri(resource: 'envvar'))
|
30
|
-
|
31
|
-
request.basic_auth api_token, ''
|
32
|
-
request['Content-Type'] = 'application/json'
|
33
|
-
request.body = ::JSON.dump(name: name, value: value)
|
34
|
-
|
35
|
-
response = ::JSON.parse(response(request).body)
|
36
|
-
|
37
|
-
fail NameError, response['message'] if response['message']
|
38
|
-
|
39
|
-
response['name']
|
40
|
-
end
|
41
|
-
|
42
|
-
# rubocop:disable Layout/MultilineAssignmentLayout
|
43
|
-
def environment_variables
|
44
|
-
@environment_variables ||= \
|
45
|
-
begin
|
46
|
-
request = ::Net::HTTP::Get.new(request_uri(resource: 'envvar'))
|
47
|
-
|
48
|
-
request.basic_auth api_token, ''
|
49
|
-
request['Content-Type'] = 'application/json'
|
50
|
-
|
51
|
-
::JSON
|
52
|
-
.parse(response(request).body)
|
53
|
-
.each_with_object({}) { |e, m| m[e['name']] = e['value'] }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
# rubocop:enable Layout/MultilineAssignmentLayout
|
57
|
-
|
58
|
-
def remove_environment_variable(name)
|
59
|
-
request = ::Net::HTTP::Delete.new(request_uri(resource: "envvar/#{name}"))
|
60
|
-
|
61
|
-
request.basic_auth api_token, ''
|
62
|
-
request['Content-Type'] = 'application/json'
|
63
|
-
|
64
|
-
::JSON.parse(response(request).body)['message'] == 'ok'
|
65
|
-
end
|
66
|
-
|
67
|
-
private
|
68
|
-
|
69
|
-
def request_uri(resource:)
|
70
|
-
"#{API_BASE_URI}/project/#{vcs_type}/#{username}/#{project}/#{resource}"
|
71
|
-
end
|
72
|
-
|
73
|
-
def response(request)
|
74
|
-
connection.request(request)
|
75
|
-
end
|
76
|
-
|
77
|
-
def connection
|
78
|
-
@connection ||= ::Net::HTTP.new(API_HOST, API_PORT).tap do |conn|
|
79
|
-
conn.use_ssl = true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'net/http'
|
5
|
-
require 'uri'
|
6
|
-
|
7
|
-
module Chamber
|
8
|
-
module Adapters
|
9
|
-
module Cloud
|
10
|
-
class Heroku
|
11
|
-
API_HOST = 'api.heroku.com'
|
12
|
-
API_PORT = 443
|
13
|
-
API_BASE_URI = ''
|
14
|
-
|
15
|
-
attr_accessor :api_token,
|
16
|
-
:app
|
17
|
-
|
18
|
-
def initialize(api_token:, app:)
|
19
|
-
self.api_token = api_token
|
20
|
-
self.app = app
|
21
|
-
end
|
22
|
-
|
23
|
-
def add_environment_variable(name, value) # rubocop:disable Metrics/AbcSize
|
24
|
-
value = value.gsub(/\n/, '\n') if value
|
25
|
-
request = ::Net::HTTP::Patch.new(config_vars_uri)
|
26
|
-
|
27
|
-
request['Authorization'] = "Bearer #{api_token}"
|
28
|
-
request['Accept'] = 'application/vnd.heroku+json; version=3'
|
29
|
-
request['Content-Type'] = 'application/json'
|
30
|
-
request.body = ::JSON.dump(::Hash[name, value])
|
31
|
-
|
32
|
-
response = ::JSON.parse(response(request).body)
|
33
|
-
|
34
|
-
fail ::NameError, response['message'] if response['message']
|
35
|
-
|
36
|
-
response
|
37
|
-
end
|
38
|
-
|
39
|
-
def environment_variables
|
40
|
-
request = ::Net::HTTP::Get.new(config_vars_uri)
|
41
|
-
|
42
|
-
request['Authorization'] = "Bearer #{api_token}"
|
43
|
-
request['Accept'] = 'application/vnd.heroku+json; version=3'
|
44
|
-
|
45
|
-
response = ::JSON.parse(response(request).body)
|
46
|
-
|
47
|
-
fail ::NameError, response['message'] if response['message']
|
48
|
-
|
49
|
-
response
|
50
|
-
end
|
51
|
-
|
52
|
-
def remove_environment_variable(name)
|
53
|
-
add_environment_variable(name, nil)
|
54
|
-
end
|
55
|
-
|
56
|
-
private
|
57
|
-
|
58
|
-
def config_vars_uri
|
59
|
-
"#{API_BASE_URI}/apps/#{app}/config-vars"
|
60
|
-
end
|
61
|
-
|
62
|
-
def response(request)
|
63
|
-
connection.request(request)
|
64
|
-
end
|
65
|
-
|
66
|
-
def connection
|
67
|
-
@connection ||= ::Net::HTTP.new(API_HOST, API_PORT).tap do |conn|
|
68
|
-
conn.use_ssl = true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,123 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'thor'
|
4
|
-
require 'chamber/commands/cloud/clear'
|
5
|
-
require 'chamber/commands/cloud/push'
|
6
|
-
require 'chamber/commands/cloud/pull'
|
7
|
-
require 'chamber/commands/cloud/compare'
|
8
|
-
require 'chamber/refinements/hash'
|
9
|
-
|
10
|
-
module Chamber
|
11
|
-
module Binary
|
12
|
-
class CircleCi < ::Thor
|
13
|
-
include ::Thor::Actions
|
14
|
-
using ::Chamber::Refinements::Hash
|
15
|
-
|
16
|
-
class_option :api_token,
|
17
|
-
type: :string,
|
18
|
-
aliases: '-t',
|
19
|
-
required: true,
|
20
|
-
desc: 'The API token to access your CircleCI project.'
|
21
|
-
|
22
|
-
class_option :project,
|
23
|
-
type: :string,
|
24
|
-
aliases: '-p',
|
25
|
-
required: true,
|
26
|
-
desc: 'The project name in your VCS (eg Github).'
|
27
|
-
|
28
|
-
class_option :username,
|
29
|
-
type: :string,
|
30
|
-
aliases: '-u',
|
31
|
-
required: true,
|
32
|
-
desc: 'The user/organization name in your VCS (eg Github).'
|
33
|
-
|
34
|
-
class_option :vcs_type,
|
35
|
-
type: :string,
|
36
|
-
aliases: '-v',
|
37
|
-
default: 'github',
|
38
|
-
desc: 'The type of VCS your project is using.',
|
39
|
-
enum: %w{github bitbucket}
|
40
|
-
|
41
|
-
desc 'clear',
|
42
|
-
'Removes all CircleCi environment variables which match settings that Chamber ' \
|
43
|
-
'knows about'
|
44
|
-
|
45
|
-
method_option :dry_run,
|
46
|
-
type: :boolean,
|
47
|
-
aliases: '-d',
|
48
|
-
desc: 'Does not actually remove anything, but instead displays what ' \
|
49
|
-
'would change if cleared'
|
50
|
-
|
51
|
-
def clear
|
52
|
-
Commands::Cloud::Clear.call(**options
|
53
|
-
.deep_transform_keys(&:to_sym)
|
54
|
-
.merge(shell: self, adapter: 'circle_ci'))
|
55
|
-
end
|
56
|
-
|
57
|
-
desc 'push',
|
58
|
-
'Sends settings to CircleCi so that they may be used in the application ' \
|
59
|
-
'once it is deployed'
|
60
|
-
|
61
|
-
method_option :dry_run,
|
62
|
-
type: :boolean,
|
63
|
-
aliases: '-d',
|
64
|
-
desc: 'Does not actually push anything to CircleCi, but instead ' \
|
65
|
-
'displays what would change if pushed'
|
66
|
-
|
67
|
-
method_option :keys,
|
68
|
-
type: :boolean,
|
69
|
-
aliases: '-k',
|
70
|
-
desc: 'Pushes private Chamber keys to CircleCi as environment ' \
|
71
|
-
'variables. Chamber will automatically detect it and ' \
|
72
|
-
'transparently decrypt your secure settings without any ' \
|
73
|
-
'further synchronization.'
|
74
|
-
|
75
|
-
method_option :only_sensitive,
|
76
|
-
type: :boolean,
|
77
|
-
aliases: '-o',
|
78
|
-
default: true,
|
79
|
-
desc: 'When enabled, only settings contained in files which have ' \
|
80
|
-
'been gitignored or settings which are marked as "_secure" ' \
|
81
|
-
'will be pushed'
|
82
|
-
|
83
|
-
def push
|
84
|
-
Commands::Cloud::Push.call(**options
|
85
|
-
.deep_transform_keys(&:to_sym)
|
86
|
-
.merge(shell: self, adapter: 'circle_ci'))
|
87
|
-
end
|
88
|
-
|
89
|
-
desc 'pull',
|
90
|
-
'Retrieves the environment variables for the application and stores them in a ' \
|
91
|
-
'temporary file'
|
92
|
-
|
93
|
-
method_option :into,
|
94
|
-
type: :string,
|
95
|
-
desc: 'The file into which the CircleCi config information should be ' \
|
96
|
-
'stored. This file WILL BE OVERRIDDEN.'
|
97
|
-
|
98
|
-
def pull
|
99
|
-
Commands::Cloud::Pull.call(**options
|
100
|
-
.deep_transform_keys(&:to_sym)
|
101
|
-
.merge(shell: self, adapter: 'circle_ci'))
|
102
|
-
end
|
103
|
-
|
104
|
-
desc 'compare',
|
105
|
-
'Displays the difference between what is currently stored in the ' \
|
106
|
-
'CircleCi application\'s config and what Chamber knows about locally'
|
107
|
-
|
108
|
-
method_option :only_sensitive,
|
109
|
-
type: :boolean,
|
110
|
-
aliases: '-o',
|
111
|
-
default: true,
|
112
|
-
desc: 'When enabled, the diff will only consider settings ' \
|
113
|
-
'contained in files which have been gitignored or settings ' \
|
114
|
-
'which are marked as "_secure"'
|
115
|
-
|
116
|
-
def compare
|
117
|
-
Commands::Cloud::Compare.call(**options
|
118
|
-
.deep_transform_keys(&:to_sym)
|
119
|
-
.merge(shell: self, adapter: 'circle_ci'))
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
@@ -1,111 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'thor'
|
4
|
-
require 'chamber/commands/cloud/clear'
|
5
|
-
require 'chamber/commands/cloud/push'
|
6
|
-
require 'chamber/commands/cloud/pull'
|
7
|
-
require 'chamber/commands/cloud/compare'
|
8
|
-
require 'chamber/refinements/hash'
|
9
|
-
|
10
|
-
module Chamber
|
11
|
-
module Binary
|
12
|
-
class Heroku < ::Thor
|
13
|
-
include ::Thor::Actions
|
14
|
-
using ::Chamber::Refinements::Hash
|
15
|
-
|
16
|
-
class_option :app,
|
17
|
-
type: :string,
|
18
|
-
aliases: '-a',
|
19
|
-
required: true,
|
20
|
-
desc: 'The name of the Heroku application whose config values will ' \
|
21
|
-
'be affected'
|
22
|
-
|
23
|
-
class_option :api_token,
|
24
|
-
type: :string,
|
25
|
-
aliases: '-t',
|
26
|
-
required: true,
|
27
|
-
desc: 'The API token to access your Heroku project.'
|
28
|
-
|
29
|
-
desc 'clear',
|
30
|
-
'Removes all Heroku environment variables which match settings that ' \
|
31
|
-
'Chamber knows about'
|
32
|
-
|
33
|
-
method_option :dry_run,
|
34
|
-
type: :boolean,
|
35
|
-
aliases: '-d',
|
36
|
-
desc: 'Does not actually remove anything, but instead displays what ' \
|
37
|
-
'would change if cleared'
|
38
|
-
|
39
|
-
def clear
|
40
|
-
Commands::Cloud::Clear.call(**options
|
41
|
-
.deep_transform_keys(&:to_sym)
|
42
|
-
.merge(shell: self, adapter: 'heroku'))
|
43
|
-
end
|
44
|
-
|
45
|
-
desc 'push',
|
46
|
-
'Sends settings to Heroku so that they may be used in the application ' \
|
47
|
-
'once it is deployed'
|
48
|
-
|
49
|
-
method_option :dry_run,
|
50
|
-
type: :boolean,
|
51
|
-
aliases: '-d',
|
52
|
-
desc: 'Does not actually push anything to Heroku, but instead ' \
|
53
|
-
'displays what would change if pushed'
|
54
|
-
|
55
|
-
method_option :keys,
|
56
|
-
type: :boolean,
|
57
|
-
aliases: '-k',
|
58
|
-
desc: 'Pushes private Chamber keys to Heroku as environment ' \
|
59
|
-
'variables. Chamber will automatically detect it and ' \
|
60
|
-
'transparently decrypt your secure settings without any ' \
|
61
|
-
'further synchronization.'
|
62
|
-
|
63
|
-
method_option :only_sensitive,
|
64
|
-
type: :boolean,
|
65
|
-
aliases: '-o',
|
66
|
-
default: true,
|
67
|
-
desc: 'When enabled, only settings contained in files which have ' \
|
68
|
-
'been gitignored or settings which are marked as "_secure" ' \
|
69
|
-
'will be pushed'
|
70
|
-
|
71
|
-
def push
|
72
|
-
Commands::Cloud::Push.call(**options
|
73
|
-
.deep_transform_keys(&:to_sym)
|
74
|
-
.merge(shell: self, adapter: 'heroku'))
|
75
|
-
end
|
76
|
-
|
77
|
-
desc 'pull',
|
78
|
-
'Retrieves the environment variables for the application and stores ' \
|
79
|
-
'them in a temporary file'
|
80
|
-
|
81
|
-
method_option :into,
|
82
|
-
type: :string,
|
83
|
-
desc: 'The file into which the Heroku config information should be ' \
|
84
|
-
'stored. This file WILL BE OVERRIDDEN.'
|
85
|
-
|
86
|
-
def pull
|
87
|
-
Commands::Cloud::Pull.call(**options
|
88
|
-
.deep_transform_keys(&:to_sym)
|
89
|
-
.merge(shell: self, adapter: 'heroku'))
|
90
|
-
end
|
91
|
-
|
92
|
-
desc 'compare',
|
93
|
-
'Displays the difference between what is currently stored in the ' \
|
94
|
-
'Heroku application\'s config and what Chamber knows about locally'
|
95
|
-
|
96
|
-
method_option :only_sensitive,
|
97
|
-
type: :boolean,
|
98
|
-
aliases: '-o',
|
99
|
-
default: true,
|
100
|
-
desc: 'When enabled, the diff will only consider settings ' \
|
101
|
-
'contained in files which have been gitignored or settings ' \
|
102
|
-
'which are marked as "_secure"'
|
103
|
-
|
104
|
-
def compare
|
105
|
-
Commands::Cloud::Compare.call(**options
|
106
|
-
.deep_transform_keys(&:to_sym)
|
107
|
-
.merge(shell: self, adapter: 'heroku'))
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'thor'
|
4
|
-
require 'chamber/commands/travis/secure'
|
5
|
-
require 'chamber/refinements/hash'
|
6
|
-
|
7
|
-
module Chamber
|
8
|
-
module Binary
|
9
|
-
class Travis < ::Thor
|
10
|
-
using ::Chamber::Refinements::Hash
|
11
|
-
|
12
|
-
desc 'secure',
|
13
|
-
'Uses your Travis CI public key to encrypt the settings you have ' \
|
14
|
-
'chosen not to commit to the repo'
|
15
|
-
|
16
|
-
method_option :dry_run,
|
17
|
-
type: :boolean,
|
18
|
-
aliases: '-d',
|
19
|
-
desc: 'Does not actually encrypt anything to .travis.yml, but ' \
|
20
|
-
'instead displays what values would be encrypted'
|
21
|
-
|
22
|
-
method_option :only_sensitive,
|
23
|
-
type: :boolean,
|
24
|
-
aliases: '-o',
|
25
|
-
default: true,
|
26
|
-
desc: 'Does not encrypt settings into .travis.yml unless they are ' \
|
27
|
-
'contained in files which have been gitignored or settings ' \
|
28
|
-
'which are marked as "_secure"'
|
29
|
-
|
30
|
-
def secure
|
31
|
-
Commands::Travis::Secure.call(**options
|
32
|
-
.deep_transform_keys(&:to_sym)
|
33
|
-
.merge(shell: self))
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'chamber/commands/base'
|
4
|
-
|
5
|
-
module Chamber
|
6
|
-
module Commands
|
7
|
-
module Cloud
|
8
|
-
class Base < Chamber::Commands::Base
|
9
|
-
attr_accessor :adapter
|
10
|
-
|
11
|
-
def initialize(adapter:, **args)
|
12
|
-
super(**args)
|
13
|
-
|
14
|
-
self.adapter = adapter_class(adapter).new(**args)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def adapter_class(adapter_name)
|
20
|
-
require "chamber/adapters/cloud/#{adapter_name}"
|
21
|
-
|
22
|
-
@adapter_class ||= case adapter_name
|
23
|
-
when 'circle_ci'
|
24
|
-
Chamber::Adapters::Cloud::CircleCi
|
25
|
-
when 'heroku'
|
26
|
-
Chamber::Adapters::Cloud::Heroku
|
27
|
-
else
|
28
|
-
fail ArgumentError,
|
29
|
-
"Invalid Chamber cloud adapter name: #{adapter_name}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|