chamber 2.12.5 → 2.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 425f228909eed866d3e32a614a37f4c5d6cfbb4245fe7b063a1373d40ed9aa99
4
- data.tar.gz: eb9f9fec710e239379c6126344a958d45f57b9ce587e1a6084e32eb61fa6ea47
3
+ metadata.gz: 9e231bd41a0611bd30e8c2cbb2d8cc1178ecc1f570649be797468612fc63e922
4
+ data.tar.gz: 19fb0f2721ec1fe8a24ea7244f42f58d2f82e9ca216414b126ec1d72665481ba
5
5
  SHA512:
6
- metadata.gz: f2a087b086635a2b23ece643d72f0f15eb4c3556ce235d27465165aab20e694182dcb67b12e821a3a9b4377ff4bdda7189a485208820cf65b1b399989eaf9f39
7
- data.tar.gz: 0146d205f516a1c689aae1f3c29e80d252cc5a0bc68d73f44c4964fe6a8effdebddc40fbc7925393814a470743a5ab0ed52587d4f5c31db54f7dd024ea45f277
6
+ metadata.gz: 45b656980d6e7ecf49f1ae008639506ec0462192a4ec7b58e577c8607db07333f5f2cf646314a86daa5c61c41b5abac6aac50a72ea34b2f69e8282a8e8766310
7
+ data.tar.gz: 1ed02191209f650c8f3db3110fc7f7b743b466881a74089115bd00ba4001bd19e0aee8e8c373c5e8622339bf2cb4cc931b52067428da025d519da9f12aaf8c38
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -0,0 +1,82 @@
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(options = {})
21
+ self.api_token = options.fetch(:api_token)
22
+ self.project = options.fetch(:project)
23
+ self.username = options.fetch(:username)
24
+ self.vcs_type = options.fetch(: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
+ def environment_variables
43
+ @environment_variables ||= begin
44
+ request = ::Net::HTTP::Get.new(request_uri(resource: 'envvar'))
45
+
46
+ request.basic_auth api_token, ''
47
+ request['Content-Type'] = 'application/json'
48
+
49
+ ::JSON
50
+ .parse(response(request).body)
51
+ .each_with_object({}) { |e, m| m[e['name']] = e['value'] }
52
+ end
53
+ end
54
+
55
+ def remove_environment_variable(name)
56
+ request = ::Net::HTTP::Delete.new(request_uri(resource: "envvar/#{name}"))
57
+
58
+ request.basic_auth api_token, ''
59
+ request['Content-Type'] = 'application/json'
60
+
61
+ ::JSON.parse(response(request).body)['message'] == 'ok'
62
+ end
63
+
64
+ private
65
+
66
+ def request_uri(resource:)
67
+ "#{API_BASE_URI}/project/#{vcs_type}/#{username}/#{project}/#{resource}"
68
+ end
69
+
70
+ def response(request)
71
+ connection.request(request)
72
+ end
73
+
74
+ def connection
75
+ @connection ||= ::Net::HTTP.new(API_HOST, API_PORT).tap do |conn|
76
+ conn.use_ssl = true
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,47 @@
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
+ attr_accessor :app
12
+
13
+ def initialize(options = {})
14
+ self.app = options.fetch(:app)
15
+ end
16
+
17
+ def add_environment_variable(name, value)
18
+ value = value.shellescape unless value =~ /\n/
19
+
20
+ response = heroku(%Q{config:set #{name}="#{value}"})
21
+
22
+ fail NameError, "The variable name '#{name}' is invalid" if response.match?(/invalid/)
23
+
24
+ response
25
+ end
26
+
27
+ def environment_variables
28
+ @environment_variables ||= ::JSON.parse(heroku('config --json'))
29
+ end
30
+
31
+ def remove_environment_variable(name)
32
+ heroku("config:unset #{name}")
33
+ end
34
+
35
+ private
36
+
37
+ def heroku(command)
38
+ Bundler.with_clean_env { `heroku #{command}#{app_option} 2>&1` }
39
+ end
40
+
41
+ def app_option
42
+ app ? " --app='#{app}'" : ''
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,109 @@
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
+
9
+ module Chamber
10
+ module Binary
11
+ class CircleCi < Thor
12
+ include Thor::Actions
13
+
14
+ class_option :api_token,
15
+ type: :string,
16
+ aliases: '-t',
17
+ required: true,
18
+ desc: 'The API token to access your CircleCI project.'
19
+
20
+ class_option :project,
21
+ type: :string,
22
+ aliases: '-p',
23
+ required: true,
24
+ desc: 'The project name in your VCS (eg Github).'
25
+
26
+ class_option :username,
27
+ type: :string,
28
+ aliases: '-u',
29
+ required: true,
30
+ desc: 'The user/organization name in your VCS (eg Github).'
31
+
32
+ class_option :vcs_type,
33
+ type: :string,
34
+ aliases: '-v',
35
+ default: 'github',
36
+ desc: 'The type of VCS your project is using.',
37
+ enum: %w{github bitbucket}
38
+
39
+ desc 'clear', 'Removes all CircleCi environment variables which match settings that ' \
40
+ 'Chamber knows about'
41
+
42
+ method_option :dry_run,
43
+ type: :boolean,
44
+ aliases: '-d',
45
+ desc: 'Does not actually remove anything, but instead displays what ' \
46
+ 'would change if cleared'
47
+
48
+ def clear
49
+ Commands::Cloud::Clear.call(options.merge(shell: self, adapter: 'circle_ci'))
50
+ end
51
+
52
+ desc 'push', 'Sends settings to CircleCi so that they may be used in the application ' \
53
+ 'once it is deployed'
54
+
55
+ method_option :dry_run,
56
+ type: :boolean,
57
+ aliases: '-d',
58
+ desc: 'Does not actually push anything to CircleCi, but instead ' \
59
+ 'displays what would change if pushed'
60
+
61
+ method_option :keys,
62
+ type: :boolean,
63
+ aliases: '-k',
64
+ desc: 'Pushes private Chamber keys to CircleCi as environment ' \
65
+ 'variables. Chamber will automatically detect it and ' \
66
+ 'transparently decrypt your secure settings without any ' \
67
+ 'further synchronization.'
68
+
69
+ method_option :only_sensitive,
70
+ type: :boolean,
71
+ aliases: '-o',
72
+ default: true,
73
+ desc: 'When enabled, only settings contained in files which have ' \
74
+ 'been gitignored or settings which are marked as "_secure" ' \
75
+ 'will be pushed'
76
+
77
+ def push
78
+ Commands::Cloud::Push.call(options.merge(shell: self, adapter: 'circle_ci'))
79
+ end
80
+
81
+ desc 'pull', 'Retrieves the environment variables for the application and stores ' \
82
+ 'them in a temporary file'
83
+
84
+ method_option :into,
85
+ type: :string,
86
+ desc: 'The file into which the CircleCi config information should be ' \
87
+ 'stored. This file WILL BE OVERRIDDEN.'
88
+
89
+ def pull
90
+ Commands::Cloud::Pull.call(options.merge(shell: self, adapter: 'circle_ci'))
91
+ end
92
+
93
+ desc 'compare', 'Displays the difference between what is currently stored in the ' \
94
+ 'CircleCi 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.merge(shell: self, adapter: 'circle_ci'))
106
+ end
107
+ end
108
+ end
109
+ end
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'thor'
4
- require 'chamber/commands/heroku/clear'
5
- require 'chamber/commands/heroku/push'
6
- require 'chamber/commands/heroku/pull'
7
- require 'chamber/commands/heroku/compare'
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
8
 
9
9
  module Chamber
10
10
  module Binary
11
11
  class Heroku < Thor
12
+ include Thor::Actions
13
+
12
14
  class_option :app,
13
15
  type: :string,
14
16
  aliases: '-a',
@@ -26,7 +28,7 @@ class Heroku < Thor
26
28
  'would change if cleared'
27
29
 
28
30
  def clear
29
- Commands::Heroku::Clear.call(options)
31
+ Commands::Cloud::Clear.call(options.merge(shell: self, adapter: 'heroku'))
30
32
  end
31
33
 
32
34
  desc 'push', 'Sends settings to Heroku so that they may be used in the application ' \
@@ -38,6 +40,14 @@ class Heroku < Thor
38
40
  desc: 'Does not actually push anything to Heroku, but instead ' \
39
41
  'displays what would change if pushed'
40
42
 
43
+ method_option :keys,
44
+ type: :boolean,
45
+ aliases: '-k',
46
+ desc: 'Pushes private Chamber keys to Heroku as environment ' \
47
+ 'variables. Chamber will automatically detect it and ' \
48
+ 'transparently decrypt your secure settings without any ' \
49
+ 'further synchronization.'
50
+
41
51
  method_option :only_sensitive,
42
52
  type: :boolean,
43
53
  aliases: '-o',
@@ -47,7 +57,7 @@ class Heroku < Thor
47
57
  'will be pushed'
48
58
 
49
59
  def push
50
- Commands::Heroku::Push.call(options)
60
+ Commands::Cloud::Push.call(options.merge(shell: self, adapter: 'heroku'))
51
61
  end
52
62
 
53
63
  desc 'pull', 'Retrieves the environment variables for the application and stores ' \
@@ -59,7 +69,7 @@ class Heroku < Thor
59
69
  'stored. This file WILL BE OVERRIDDEN.'
60
70
 
61
71
  def pull
62
- puts Commands::Heroku::Pull.call(options)
72
+ Commands::Cloud::Pull.call(options.merge(shell: self, adapter: 'heroku'))
63
73
  end
64
74
 
65
75
  desc 'compare', 'Displays the difference between what is currently stored in the ' \
@@ -74,7 +84,7 @@ class Heroku < Thor
74
84
  'which are marked as "_secure"'
75
85
 
76
86
  def compare
77
- Commands::Heroku::Compare.call(options)
87
+ Commands::Cloud::Compare.call(options.merge(shell: self, adapter: 'heroku'))
78
88
  end
79
89
  end
80
90
  end
@@ -4,6 +4,7 @@ require 'thor'
4
4
  require 'chamber/rubinius_fix'
5
5
  require 'chamber/binary/travis'
6
6
  require 'chamber/binary/heroku'
7
+ require 'chamber/binary/circle_ci'
7
8
  require 'chamber/commands/show'
8
9
  require 'chamber/commands/files'
9
10
  require 'chamber/commands/secure'
@@ -71,6 +72,11 @@ class Runner < Thor
71
72
 
72
73
  ################################################################################
73
74
 
75
+ desc 'circleci SUBCOMMAND ...ARGS', 'For manipulating CircleCI environment variables'
76
+ subcommand 'circleci', Chamber::Binary::CircleCi
77
+
78
+ ################################################################################
79
+
74
80
  desc 'show', 'Displays the list of settings and their values'
75
81
 
76
82
  method_option :as_env,
@@ -24,7 +24,7 @@ class Travis < Thor
24
24
  'which are marked as "_secure"'
25
25
 
26
26
  def secure
27
- Commands::Travis::Secure.call(options)
27
+ Commands::Travis::Secure.call(options.merge(shell: self))
28
28
  end
29
29
  end
30
30
  end
@@ -0,0 +1,35 @@
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(options = {})
12
+ super
13
+
14
+ self.adapter = adapter_class(options[:adapter]).new(options)
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
@@ -1,23 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'chamber/commands/base'
4
- require 'chamber/commands/heroku'
3
+ require 'chamber/commands/cloud/base'
5
4
 
6
5
  module Chamber
7
6
  module Commands
8
- module Heroku
9
- class Clear < Chamber::Commands::Base
10
- include Chamber::Commands::Heroku
11
-
7
+ module Cloud
8
+ class Clear < Chamber::Commands::Cloud::Base
12
9
  def call
13
10
  chamber.to_environment.each_key do |key|
14
- next unless configuration.match(key)
11
+ next unless adapter.environment_variables.has_key?(key)
15
12
 
16
13
  if dry_run
17
14
  shell.say_status 'remove', key, :blue
18
15
  else
19
16
  shell.say_status 'remove', key, :green
20
- shell.say heroku("config:unset #{key}")
17
+
18
+ adapter.remove_environment_variable(key)
21
19
  end
22
20
  end
23
21
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'chamber/commands/cloud/base'
4
+ require 'chamber/commands/comparable'
5
+ require 'chamber/commands/securable'
6
+
7
+ module Chamber
8
+ module Commands
9
+ module Cloud
10
+ class Compare < Chamber::Commands::Cloud::Base
11
+ include Chamber::Commands::Securable
12
+ include Chamber::Commands::Comparable
13
+
14
+ protected
15
+
16
+ def first_settings_data
17
+ ::JSON.pretty_generate(securable_environment_variables)
18
+ end
19
+
20
+ def second_settings_data
21
+ ::JSON.pretty_generate(adapter.environment_variables)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'chamber/commands/cloud/base'
5
+
6
+ module Chamber
7
+ module Commands
8
+ module Cloud
9
+ class Pull < Chamber::Commands::Cloud::Base
10
+ attr_accessor :target_file
11
+
12
+ def initialize(options = {})
13
+ super
14
+
15
+ self.target_file = options[:into]
16
+ end
17
+
18
+ def call
19
+ if target_file
20
+ shell.create_file(target_file,
21
+ ::JSON.pretty_generate(adapter.environment_variables))
22
+ else
23
+ adapter.environment_variables
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'chamber/commands/cloud/base'
4
+ require 'chamber/commands/securable'
5
+ require 'chamber/keys/decryption'
6
+
7
+ module Chamber
8
+ module Commands
9
+ module Cloud
10
+ class Push < Chamber::Commands::Cloud::Base
11
+ include Chamber::Commands::Securable
12
+
13
+ attr_accessor :keys
14
+
15
+ def initialize(options = {})
16
+ super
17
+
18
+ self.keys = options[:keys]
19
+ end
20
+
21
+ def call
22
+ environment_variables = if keys
23
+ Keys::Decryption.
24
+ new(rootpath: chamber.configuration.rootpath,
25
+ namespaces: chamber.configuration.namespaces).
26
+ as_environment_variables
27
+ else
28
+ securable_environment_variables
29
+ end
30
+
31
+ environment_variables.each do |key, value|
32
+ if dry_run
33
+ shell.say_status 'push', key, :blue
34
+ else
35
+ shell.say_status 'push', key, :green
36
+
37
+ adapter.add_environment_variable(key, value)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -8,7 +8,8 @@ class Configuration
8
8
  :decryption_keys,
9
9
  :encryption_keys,
10
10
  :files,
11
- :namespaces
11
+ :namespaces,
12
+ :rootpath
12
13
 
13
14
  def initialize(options = {})
14
15
  options = ContextResolver.resolve(options)
@@ -18,6 +19,7 @@ class Configuration
18
19
  self.decryption_keys = options.fetch(:decryption_keys)
19
20
  self.encryption_keys = options.fetch(:encryption_keys)
20
21
  self.files = options.fetch(:files)
22
+ self.rootpath = options.fetch(:rootpath)
21
23
  end
22
24
 
23
25
  def to_hash
@@ -18,66 +18,48 @@ class Base
18
18
  end
19
19
 
20
20
  def resolve
21
- filenames.each_with_object({}) do |filename, memo|
22
- namespace = namespace_from_filename(filename) || '__default'
23
- value = key_from_file_contents(filename) ||
24
- key_from_environment_variable(filename)
21
+ key_paths.each_with_object({}) do |path, memo|
22
+ namespace = namespace_from_path(path) || '__default'
23
+ value = path.readable? ? path.read : ENV[environment_variable_from_path(path)]
25
24
 
26
25
  memo[namespace.downcase.to_sym] = value if value
27
26
  end
28
27
  end
29
28
 
30
- # rubocop:disable Performance/ChainArrayAllocation
31
- def filenames=(other)
32
- @filenames = begin
33
- paths = Array(other).
34
- map { |o| Pathname.new(o) }.
35
- compact
36
-
37
- paths << default_key_file_path if paths.empty?
38
-
39
- (
40
- paths +
41
- generate_key_filenames
42
- ).
43
- uniq
44
- end
29
+ def as_environment_variables
30
+ key_paths.select(&:readable?).each_with_object({}) do |path, memo|
31
+ memo[environment_variable_from_path(path)] = path.read
32
+ end
45
33
  end
46
- # rubocop:enable Performance/ChainArrayAllocation
47
34
 
48
35
  private
49
36
 
50
- def namespaces=(other)
51
- @namespaces = begin
52
- keys = if other.respond_to?(:keys)
53
- other.keys.map(&:to_s)
54
- else
55
- other
56
- end
57
-
58
- keys + %w{signature}
59
- end
37
+ def key_paths
38
+ @key_paths = (filenames.any? ? filenames : [default_key_file_path]) +
39
+ namespaces.map { |n| namespace_to_key_path(n) }
60
40
  end
61
41
 
62
- def key_from_file_contents(filename)
63
- filename.readable? && filename.read
42
+ # rubocop:disable Performance/ChainArrayAllocation
43
+ def filenames=(other)
44
+ @filenames = Array(other).
45
+ map { |o| Pathname.new(o) }.
46
+ compact
64
47
  end
48
+ # rubocop:enable Performance/ChainArrayAllocation
65
49
 
66
- def key_from_environment_variable(filename)
67
- ENV[environment_variable_from_filename(filename)]
50
+ def namespaces=(other)
51
+ @namespaces = other + %w{signature}
68
52
  end
69
53
 
70
- def namespace_from_filename(filename)
71
- filename.
54
+ def namespace_from_path(path)
55
+ path.
72
56
  basename.
73
57
  to_s.
74
58
  match(self.class::NAMESPACE_PATTERN) { |m| m[1].upcase }
75
59
  end
76
60
 
77
- def generate_key_filenames
78
- namespaces.map do |namespace|
79
- rootpath + ".chamber.#{namespace.to_s.tr('.-', '')}#{key_filename_extension}"
80
- end
61
+ def namespace_to_key_path(namespace)
62
+ rootpath + ".chamber.#{namespace.to_s.tr('.-', '')}#{key_filename_extension}"
81
63
  end
82
64
 
83
65
  def default_key_file_path
@@ -17,10 +17,10 @@ class Decryption < Chamber::Keys::Base
17
17
 
18
18
  private
19
19
 
20
- def environment_variable_from_filename(filename)
20
+ def environment_variable_from_path(path)
21
21
  [
22
22
  'CHAMBER',
23
- namespace_from_filename(filename),
23
+ namespace_from_path(path),
24
24
  'KEY',
25
25
  ].
26
26
  compact.
@@ -17,10 +17,10 @@ class Encryption < Chamber::Keys::Base
17
17
 
18
18
  private
19
19
 
20
- def environment_variable_from_filename(filename)
20
+ def environment_variable_from_path(path)
21
21
  [
22
22
  'CHAMBER',
23
- namespace_from_filename(filename),
23
+ namespace_from_path(path),
24
24
  'PUBLIC_KEY',
25
25
  ].
26
26
  compact.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chamber
4
- VERSION = '2.12.5'
4
+ VERSION = '2.13.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chamber
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.5
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thekompanee
@@ -38,7 +38,7 @@ cert_chain:
38
38
  09JNgxpgZHCDuKwoycU+wXdWVSzMtchMQygnEu6th1SY5qHj4ISipBEBtKG0MdgB
39
39
  L3AbMAHTztj5YI+gvmpuV1B4Zv1QZjZWOeNSnLZdrnOQbyyDBzJyXmNV
40
40
  -----END CERTIFICATE-----
41
- date: 2019-05-29 00:00:00.000000000 Z
41
+ date: 2019-05-30 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: thor
@@ -158,18 +158,21 @@ files:
158
158
  - README.md
159
159
  - bin/chamber
160
160
  - lib/chamber.rb
161
+ - lib/chamber/adapters/cloud/circle_ci.rb
162
+ - lib/chamber/adapters/cloud/heroku.rb
163
+ - lib/chamber/binary/circle_ci.rb
161
164
  - lib/chamber/binary/heroku.rb
162
165
  - lib/chamber/binary/runner.rb
163
166
  - lib/chamber/binary/travis.rb
164
167
  - lib/chamber/commands/base.rb
168
+ - lib/chamber/commands/cloud/base.rb
169
+ - lib/chamber/commands/cloud/clear.rb
170
+ - lib/chamber/commands/cloud/compare.rb
171
+ - lib/chamber/commands/cloud/pull.rb
172
+ - lib/chamber/commands/cloud/push.rb
165
173
  - lib/chamber/commands/comparable.rb
166
174
  - lib/chamber/commands/compare.rb
167
175
  - lib/chamber/commands/files.rb
168
- - lib/chamber/commands/heroku.rb
169
- - lib/chamber/commands/heroku/clear.rb
170
- - lib/chamber/commands/heroku/compare.rb
171
- - lib/chamber/commands/heroku/pull.rb
172
- - lib/chamber/commands/heroku/push.rb
173
176
  - lib/chamber/commands/initialize.rb
174
177
  - lib/chamber/commands/securable.rb
175
178
  - lib/chamber/commands/secure.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler'
4
-
5
- module Chamber
6
- module Commands
7
- module Heroku
8
- def initialize(options = {})
9
- super
10
-
11
- self.app = options[:app]
12
- end
13
-
14
- protected
15
-
16
- attr_accessor :app
17
-
18
- def configuration
19
- @configuration ||= heroku('config --shell').chomp
20
- end
21
-
22
- def heroku(command)
23
- Bundler.with_clean_env { `heroku #{command}#{app_option}` }
24
- end
25
-
26
- def app_option
27
- app ? " --app #{app}" : ''
28
- end
29
- end
30
- end
31
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'chamber/commands/securable'
4
- require 'chamber/commands/heroku'
5
- require 'chamber/commands/comparable'
6
-
7
- module Chamber
8
- module Commands
9
- module Heroku
10
- class Compare < Chamber::Commands::Base
11
- include Chamber::Commands::Securable
12
- include Chamber::Commands::Heroku
13
- include Chamber::Commands::Comparable
14
-
15
- protected
16
-
17
- def first_settings_data
18
- if only_sensitive
19
- secured_settings.to_s(pair_separator: "\n",
20
- value_surrounder: '')
21
- else
22
- current_settings.to_s(pair_separator: "\n",
23
- value_surrounder: '')
24
- end
25
- end
26
-
27
- def second_settings_data
28
- configuration
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'chamber/commands/base'
4
- require 'chamber/commands/heroku'
5
-
6
- module Chamber
7
- module Commands
8
- module Heroku
9
- class Pull < Chamber::Commands::Base
10
- include Chamber::Commands::Heroku
11
-
12
- attr_accessor :target_file
13
-
14
- def initialize(options = {})
15
- super
16
-
17
- self.target_file = options[:into]
18
- end
19
-
20
- def call
21
- if target_file
22
- shell.create_file target_file, configuration
23
- else
24
- configuration
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'chamber/commands/base'
4
- require 'chamber/commands/securable'
5
- require 'chamber/commands/heroku'
6
-
7
- module Chamber
8
- module Commands
9
- module Heroku
10
- class Push < Chamber::Commands::Base
11
- include Chamber::Commands::Securable
12
- include Chamber::Commands::Heroku
13
-
14
- def call
15
- securable_environment_variables.each do |key, value|
16
- if dry_run
17
- shell.say_status 'push', key, :blue
18
- else
19
- shell.say_status 'push', key, :green
20
- heroku("config:set #{key}=#{value.shellescape}")
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end