chamber 2.12.3 → 2.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/README.md +101 -26
  5. data/lib/chamber.rb +82 -10
  6. data/lib/chamber/adapters/cloud/circle_ci.rb +85 -0
  7. data/lib/chamber/adapters/cloud/heroku.rb +74 -0
  8. data/lib/chamber/binary/circle_ci.rb +122 -0
  9. data/lib/chamber/binary/heroku.rb +45 -16
  10. data/lib/chamber/binary/runner.rb +42 -26
  11. data/lib/chamber/binary/travis.rb +5 -3
  12. data/lib/chamber/commands/base.rb +10 -16
  13. data/lib/chamber/commands/cloud/base.rb +35 -0
  14. data/lib/chamber/commands/{heroku → cloud}/clear.rb +6 -8
  15. data/lib/chamber/commands/cloud/compare.rb +26 -0
  16. data/lib/chamber/commands/cloud/pull.rb +29 -0
  17. data/lib/chamber/commands/cloud/push.rb +44 -0
  18. data/lib/chamber/commands/comparable.rb +2 -2
  19. data/lib/chamber/commands/compare.rb +6 -9
  20. data/lib/chamber/commands/initialize.rb +26 -22
  21. data/lib/chamber/commands/securable.rb +10 -10
  22. data/lib/chamber/commands/secure.rb +2 -2
  23. data/lib/chamber/commands/show.rb +8 -8
  24. data/lib/chamber/commands/sign.rb +2 -2
  25. data/lib/chamber/commands/verify.rb +2 -2
  26. data/lib/chamber/configuration.rb +8 -3
  27. data/lib/chamber/context_resolver.rb +16 -7
  28. data/lib/chamber/encryption_methods/ssl.rb +21 -12
  29. data/lib/chamber/file.rb +22 -20
  30. data/lib/chamber/file_set.rb +21 -11
  31. data/lib/chamber/files/signature.rb +31 -23
  32. data/lib/chamber/filters/decryption_filter.rb +13 -11
  33. data/lib/chamber/filters/encryption_filter.rb +17 -8
  34. data/lib/chamber/filters/environment_filter.rb +12 -14
  35. data/lib/chamber/filters/failed_decryption_filter.rb +6 -6
  36. data/lib/chamber/filters/insecure_filter.rb +12 -3
  37. data/lib/chamber/filters/namespace_filter.rb +5 -5
  38. data/lib/chamber/filters/secure_filter.rb +5 -5
  39. data/lib/chamber/filters/translate_secure_keys_filter.rb +5 -5
  40. data/lib/chamber/instance.rb +54 -30
  41. data/lib/chamber/integrations/rails.rb +1 -1
  42. data/lib/chamber/integrations/sinatra.rb +6 -6
  43. data/lib/chamber/key_pair.rb +8 -8
  44. data/lib/chamber/keys/base.rb +35 -41
  45. data/lib/chamber/keys/decryption.rb +8 -14
  46. data/lib/chamber/keys/encryption.rb +8 -14
  47. data/lib/chamber/namespace_set.rb +2 -4
  48. data/lib/chamber/settings.rb +86 -56
  49. data/lib/chamber/types/secured.rb +8 -10
  50. data/lib/chamber/version.rb +1 -1
  51. data/templates/settings.yml +2 -0
  52. metadata +51 -41
  53. metadata.gz.sig +0 -0
  54. data/lib/chamber/commands/heroku.rb +0 -31
  55. data/lib/chamber/commands/heroku/compare.rb +0 -33
  56. data/lib/chamber/commands/heroku/pull.rb +0 -30
  57. data/lib/chamber/commands/heroku/push.rb +0 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 553e93e239b69f83d7fe5fb0cda5153fcc0f8ce7
4
- data.tar.gz: 3d9007fe77914b4e7d88a1665cce0fb4291a9c32
2
+ SHA256:
3
+ metadata.gz: 690d43a7af0262a4fe1ca2f3ab99e66ed6db6a4873a5bdbd50e9bd655a44ffe8
4
+ data.tar.gz: 57ec92f68941f7a281d5ca3b056bdfd64833cd69567de2c07418180f09729d15
5
5
  SHA512:
6
- metadata.gz: ea0d5e559bf833679d176bc5a3930c1a49f1e3d2e14233ec6e7f33ae2fed039be9a725138824c7e03930bfbc2360f6ccb66bc4c51f61c3b8fa03a7d4de4e2723
7
- data.tar.gz: 6d9d274ddb7871100155501bc811bac435109fb2cd918aa7962f52e55c7270c206cad097dd61c4c4ee80ae73181f7e22177c2e11878896db9a8f9d87d544c97b
6
+ metadata.gz: d38158c0fa8d6bc2c87b6ee4de139c9a13e8118159f2048846d23945c89156597c7106602bd29cb575dce8f15e5a3ee4a279e63f629e23fb25d2dc70feb693f8
7
+ data.tar.gz: 6e5ea4037cd71876681dae104acdd4081129be0dce0373cd6a78e5ed67810156e6545bd29e5124c3fcb92e459ea58a68a356f2acba8ed8232808a07c0752445f
Binary file
data.tar.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -1,5 +1,33 @@
1
- # Chamber
2
- [![Gem Version](https://img.shields.io/gem/v/chamber.svg)](https://rubygems.org/gems/chamber) ![Rubygems Rank Overall](https://img.shields.io/gem/rt/chamber.svg) ![Rubygems Rank Daily](https://img.shields.io/gem/rd/chamber.svg) ![Rubygems Downloads](https://img.shields.io/gem/dv/chamber/stable.svg) [![Build Status](https://img.shields.io/travis/thekompanee/chamber/master.svg)](http://travis-ci.org/thekompanee/chamber) [![Code Climate](https://codeclimate.com/github/thekompanee/chamber.svg)](https://codeclimate.com/github/thekompanee/chamber) [![Code Climate](https://codeclimate.com/github/thekompanee/chamber/coverage.svg)](https://codeclimate.com/github/thekompanee/chamber)
1
+ Chamber
2
+ ================================================================================
3
+
4
+ <div align="center">
5
+ <a href="https://rubygems.org/gems/chamber" alt="RubyGems Version">
6
+ <img src="https://img.shields.io/gem/v/chamber.svg?style=flat-square&label=current-version" alt="RubyGems Version" />
7
+ </a>
8
+
9
+ <a href="https://rubygems.org/gems/chamber" alt="RubyGems Rank Overall">
10
+ <img src="https://img.shields.io/gem/rt/chamber.svg?style=flat-square&label=total-rank" alt="RubyGems Rank Overall" />
11
+ </a>
12
+
13
+ <a href="https://rubygems.org/gems/chamber" alt="RubyGems Rank Daily">
14
+ <img src="https://img.shields.io/gem/rd/chamber.svg?style=flat-square&label=daily-rank" alt="RubyGems Rank Daily" />
15
+ </a>
16
+
17
+ <a href="https://rubygems.org/gems/chamber" alt="RubyGems Downloads">
18
+ <img src="https://img.shields.io/gem/dt/chamber.svg?style=flat-square&label=total-downloads" alt="RubyGems Downloads" />
19
+ </a>
20
+
21
+ <a href="https://github.com/thekompanee/chamber/actions?query=workflow%3ABuild" alt="Build Status">
22
+ <img src="https://img.shields.io/github/workflow/status/thekompanee/chamber/Build?label=CI&style=flat-square&logo=github" alt="Build Status" />
23
+ </a>
24
+
25
+ <a href="#" alt="Maintainability">
26
+ <img src="https://img.shields.io/codeclimate/maintainability/thekompanee/chamber?style=flat-square&label=grade" alt="Maintainability" />
27
+ </a>
28
+ </div>
29
+
30
+ <br>
3
31
 
4
32
  Chamber is the auto-encrypting, extremely organizable, Heroku-loving,
5
33
  CLI-having, non-extra-repo-needing, non-Rails-specific-ing, CI-serving
@@ -9,17 +37,73 @@ We looked at all of the options out there and thought something was still
9
37
  missing, so we wrote Chamber. We made it with lots of ❤ and we hope you like it
10
38
  as much as we do.
11
39
 
12
- ## What Sets Chamber Apart?
40
+ What Sets Chamber Apart
41
+ --------------------------------------------------------------------------------
13
42
 
14
43
  For an idea of how Chamber compares to other popular libraries, check out our
15
44
  [Gem Comparison][comparison].
16
45
 
17
- ## Basic Usage
46
+ Basic Usage
47
+ --------------------------------------------------------------------------------
48
+
49
+ Before starting this guide, make sure you [install chamber][installation].
50
+
51
+ Once your app is initialized, you should have a `settings.yml` file somewhere.
52
+ A lot of times it's the root of your project and sometimes it's in a framework
53
+ specific location.
54
+
55
+ Inside of here you can define any settings you'd like like so:
56
+
57
+ ```yaml
58
+ # settings.yml
59
+
60
+ smtp_username: 'my_username'
61
+ smtp_password: 'my_password'
62
+ ```
63
+
64
+ From there you can access your settings by using the special `Chamber.env`
65
+ constant.
66
+
67
+ ```ruby
68
+ Chamber.env.smtp_password
69
+ # => 'my_password'
70
+ ```
71
+
72
+ If you want to encrypt a setting, prefix the setting name with `_secure_` like
73
+ so:
74
+
75
+ ```ruby
76
+ # settings.yml
77
+
78
+ smtp_username: 'my_username'
79
+ _secure_smtp_password: 'my_password'
80
+ ```
81
+
82
+ And then run `chamber secure`. Your settings file will have an encrypted value:
83
+
84
+ ```ruby
85
+ # settings.yml
86
+
87
+ smtp_username: 'my_username'
88
+ _secure_smtp_password: JL5hAVux4tERpv49QPWxy9H0VC2Rnk7V8/e8+1XOwPcXcoH/a7Lh253UY/v9m8nI/Onb+ZG9nZ082J4M/BmLa+f7jwMEwufIqbUhUah9eKIW8xcxlppBYpl7JVGf2HJF5TfCN44gMQNgGNzboCQXKqRyeGFm4u772Sg9V2gEx/q7qJ6F4jg7v/cltCFLmJfXA2SHA5Dai4p9L4IvMVVJGm34k5j7KOegNqpVWs2RY99cagjPuzc9VM2XSUsXgqcUJdmH8YtPW8Kqkyg0oYlRh6VQWABlWXwTZz74QjTTjqtqfoELIoFTMBDh+cCvuUTAE5m06LhlqauVrB4UnBsd5g==
89
+ ```
90
+
91
+ which you still access the same way because Chamber handles the decryption for
92
+ you:
93
+
94
+ ```ruby
95
+ Chamber.env.smtp_password
96
+ # => 'my_password'
97
+ ```
98
+
99
+ Full Reference
100
+ --------------------------------------------------------------------------------
18
101
 
19
- You can view our Basic Usage Guide [here][basic-usage]. Otherwise, for the full
102
+ There's so much to Chamber, we couldn't put it all in the README. For the full
20
103
  Chamber guide, visit the [wiki][wiki].
21
104
 
22
- ## Credits
105
+ Credits
106
+ --------------------------------------------------------------------------------
23
107
 
24
108
  Chamber was written by [Jeff Felchner][jeff-profile] and
25
109
  [Mark McEahern][mark-profile]
@@ -30,27 +114,18 @@ Chamber is maintained and funded by [The Kompanee, Ltd.][kompanee-site]
30
114
 
31
115
  The names and logos for The Kompanee are trademarks of The Kompanee, Ltd.
32
116
 
33
- ## License
117
+ License
118
+ --------------------------------------------------------------------------------
34
119
 
35
- Chamber is Copyright © 2014-2018 Jeff Felchner and Mark McEahern. It is free
120
+ Chamber is Copyright © 2014-2021 Jeff Felchner and Mark McEahern. It is free
36
121
  software, and may be redistributed under the terms specified in the
37
122
  [LICENSE][license] file.
38
123
 
39
- [accessing]: https://github.com/thekompanee/chamber/wiki/Accessing-Settings
40
- [basic-usage]: https://github.com/thekompanee/chamber/wiki/Basic-Usage
41
- [cli]: https://github.com/thekompanee/chamber/wiki/CLI-Overview
42
- [commit-hook]: https://github.com/thekompanee/chamber/wiki/Git-Commit-Hooks
43
- [comparison]: https://github.com/thekompanee/chamber/wiki/Gem-Comparison
44
- [encryption]: https://github.com/thekompanee/chamber/wiki/Encryption-Basics
45
- [env-vars]: https://github.com/thekompanee/chamber/wiki/Environment-Variables
46
- [heroku]: https://github.com/thekompanee/chamber/wiki/Heroku
47
- [inch]: https://inch-ci.org/github/thekompanee/chamber
48
- [jeff-profile]: https://github.com/jfelchner
49
- [kompanee-logo]: https://kompanee-public-assets.s3.amazonaws.com/readmes/kompanee-horizontal-black.png
50
- [kompanee-site]: http://www.thekompanee.com
51
- [license]: https://github.com/thekompanee/chamber/blob/master/LICENSE.txt
52
- [mark-profile]: https://github.com/m5rk
53
- [namespace-keys]: https://github.com/thekompanee/chamber/wiki/Namespaced-Key-Pairs
54
- [plain-ruby]: https://github.com/thekompanee/chamber/wiki/Installation#in-a-ruby-project-or-ruby-gem
55
- [travis]: https://github.com/thekompanee/chamber/wiki/TravisCI
56
- [wiki]: https://github.com/thekompanee/chamber/wiki
124
+ [comparison]: https://github.com/thekompanee/chamber/wiki/Gem-Comparison
125
+ [jeff-profile]: https://github.com/jfelchner
126
+ [kompanee-logo]: https://kompanee-public-assets.s3.amazonaws.com/readmes/kompanee-horizontal-black.png
127
+ [kompanee-site]: http://www.thekompanee.com
128
+ [license]: https://github.com/thekompanee/chamber/blob/master/LICENSE.txt
129
+ [mark-profile]: https://github.com/m5rk
130
+ [wiki]: https://github.com/thekompanee/chamber/wiki
131
+ [installation]: https://github.com/thekompanee/chamber/wiki/Installation
@@ -7,12 +7,8 @@ require 'chamber/rails'
7
7
  module Chamber
8
8
  attr_writer :instance
9
9
 
10
- def load(options = {})
11
- self.instance = Instance.new(options)
12
- end
13
-
14
- def to_s(options = {})
15
- instance.to_s(options)
10
+ def load(**args)
11
+ self.instance = Instance.new(**args)
16
12
  end
17
13
 
18
14
  def env
@@ -20,7 +16,69 @@ module Chamber
20
16
  end
21
17
 
22
18
  def instance
23
- @instance ||= Instance.new({})
19
+ @instance ||= Instance.new
20
+ end
21
+
22
+ def [](key)
23
+ instance.[](key)
24
+ end
25
+
26
+ def dig!(*args)
27
+ instance.dig!(*args)
28
+ end
29
+
30
+ def dig(*args)
31
+ instance.dig(*args)
32
+ end
33
+
34
+ def configuration
35
+ instance.configuration
36
+ end
37
+
38
+ def decrypt(value, **args)
39
+ instance.decrypt(value, **args)
40
+ end
41
+
42
+ def encrypt(value, **args)
43
+ instance.encrypt(value, **args)
44
+ end
45
+
46
+ def files
47
+ instance.files
48
+ end
49
+
50
+ def filenames
51
+ instance.filenames
52
+ end
53
+
54
+ def namespaces
55
+ instance.namespaces
56
+ end
57
+
58
+ def secure
59
+ instance.secure
60
+ end
61
+
62
+ def sign
63
+ instance.sign
64
+ end
65
+
66
+ def verify
67
+ instance.verify
68
+ end
69
+
70
+ def to_environment
71
+ instance.to_environment
72
+ end
73
+
74
+ def to_hash
75
+ instance.to_hash
76
+ end
77
+
78
+ def to_s(**args)
79
+ return '' unless @instance
80
+
81
+ instance.to_s(**args)
24
82
  end
25
83
 
26
84
  def method_missing(name, *args)
@@ -33,11 +91,25 @@ module Chamber
33
91
  instance.respond_to?(name, include_private)
34
92
  end
35
93
 
36
- module_function :load,
37
- :to_s,
94
+ module_function :[],
95
+ :configuration,
96
+ :decrypt,
97
+ :dig!,
98
+ :dig,
99
+ :encrypt,
38
100
  :env,
101
+ :filenames,
102
+ :files,
39
103
  :instance,
40
104
  :instance=,
105
+ :load,
41
106
  :method_missing,
42
- :respond_to_missing?
107
+ :namespaces,
108
+ :respond_to_missing?,
109
+ :secure,
110
+ :sign,
111
+ :to_environment,
112
+ :to_hash,
113
+ :to_s,
114
+ :verify
43
115
  end
@@ -0,0 +1,85 @@
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
@@ -0,0 +1,74 @@
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
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+ require 'chamber/core_ext/hash'
5
+ require 'chamber/commands/cloud/clear'
6
+ require 'chamber/commands/cloud/push'
7
+ require 'chamber/commands/cloud/pull'
8
+ require 'chamber/commands/cloud/compare'
9
+
10
+ module Chamber
11
+ module Binary
12
+ class CircleCi < Thor
13
+ include Thor::Actions
14
+
15
+ class_option :api_token,
16
+ type: :string,
17
+ aliases: '-t',
18
+ required: true,
19
+ desc: 'The API token to access your CircleCI project.'
20
+
21
+ class_option :project,
22
+ type: :string,
23
+ aliases: '-p',
24
+ required: true,
25
+ desc: 'The project name in your VCS (eg Github).'
26
+
27
+ class_option :username,
28
+ type: :string,
29
+ aliases: '-u',
30
+ required: true,
31
+ desc: 'The user/organization name in your VCS (eg Github).'
32
+
33
+ class_option :vcs_type,
34
+ type: :string,
35
+ aliases: '-v',
36
+ default: 'github',
37
+ desc: 'The type of VCS your project is using.',
38
+ enum: %w{github bitbucket}
39
+
40
+ desc 'clear',
41
+ 'Removes all CircleCi environment variables which match settings that Chamber ' \
42
+ 'knows about'
43
+
44
+ method_option :dry_run,
45
+ type: :boolean,
46
+ aliases: '-d',
47
+ desc: 'Does not actually remove anything, but instead displays what ' \
48
+ 'would change if cleared'
49
+
50
+ def clear
51
+ Commands::Cloud::Clear.call(**options
52
+ .transform_keys(&:to_sym)
53
+ .merge(shell: self, adapter: 'circle_ci'))
54
+ end
55
+
56
+ desc 'push',
57
+ 'Sends settings to CircleCi so that they may be used in the application ' \
58
+ 'once it is deployed'
59
+
60
+ method_option :dry_run,
61
+ type: :boolean,
62
+ aliases: '-d',
63
+ desc: 'Does not actually push anything to CircleCi, but instead ' \
64
+ 'displays what would change if pushed'
65
+
66
+ method_option :keys,
67
+ type: :boolean,
68
+ aliases: '-k',
69
+ desc: 'Pushes private Chamber keys to CircleCi as environment ' \
70
+ 'variables. Chamber will automatically detect it and ' \
71
+ 'transparently decrypt your secure settings without any ' \
72
+ 'further synchronization.'
73
+
74
+ method_option :only_sensitive,
75
+ type: :boolean,
76
+ aliases: '-o',
77
+ default: true,
78
+ desc: 'When enabled, only settings contained in files which have ' \
79
+ 'been gitignored or settings which are marked as "_secure" ' \
80
+ 'will be pushed'
81
+
82
+ def push
83
+ Commands::Cloud::Push.call(**options
84
+ .transform_keys(&:to_sym)
85
+ .merge(shell: self, adapter: 'circle_ci'))
86
+ end
87
+
88
+ desc 'pull',
89
+ 'Retrieves the environment variables for the application and stores them in a ' \
90
+ 'temporary file'
91
+
92
+ method_option :into,
93
+ type: :string,
94
+ desc: 'The file into which the CircleCi config information should be ' \
95
+ 'stored. This file WILL BE OVERRIDDEN.'
96
+
97
+ def pull
98
+ Commands::Cloud::Pull.call(**options
99
+ .transform_keys(&:to_sym)
100
+ .merge(shell: self, adapter: 'circle_ci'))
101
+ end
102
+
103
+ desc 'compare',
104
+ 'Displays the difference between what is currently stored in the ' \
105
+ 'CircleCi application\'s config and what Chamber knows about locally'
106
+
107
+ method_option :only_sensitive,
108
+ type: :boolean,
109
+ aliases: '-o',
110
+ default: true,
111
+ desc: 'When enabled, the diff will only consider settings ' \
112
+ 'contained in files which have been gitignored or settings ' \
113
+ 'which are marked as "_secure"'
114
+
115
+ def compare
116
+ Commands::Cloud::Compare.call(**options
117
+ .transform_keys(&:to_sym)
118
+ .merge(shell: self, adapter: 'circle_ci'))
119
+ end
120
+ end
121
+ end
122
+ end