env_compare 0.1.3.pre.alpha → 0.1.3.pre.beta

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: c1119534c3a09963aa5e16f2c11730ea7915f78c1a5efe8b3471d952bf3ec595
4
- data.tar.gz: 79b778d047d032173624c4ea612d91684b897685268cfe18e20e22cded13df42
3
+ metadata.gz: e51a067d2f76fb50f8d90005c51ff3a538d4d426087f9a36da38321050736b32
4
+ data.tar.gz: 370af34407e7666e1484d405d8a36bb31daf2c925d9a690caa7099184ade4ec8
5
5
  SHA512:
6
- metadata.gz: 9cf797bd514f23db0ccc51f81d29021fc8fb296031d52b119a82ffd327a033f48e778ff17892d05da68f6ab3fd0165a80db561661651210b3781074bff10b596
7
- data.tar.gz: 3173d7ecf3810de57da910c86bbddbc5a70276a98056705251b8b80130f0379ad8506987f7055dfc14f528725753898abb1c95199e337b084fd32335c088f673
6
+ metadata.gz: 1d78e742eb5556f34b52d19d15c34f8d653a3bd7d65586b4cc24d88607cdbc1c24b2b28a63b5b45b25ad3a1a8e868559ea162e7abd57591645f1828946c7e896
7
+ data.tar.gz: a57c5325cc82f97815170ba3f9e31cb9845efae58fc7115bdd8ba2e4c8ea1c978a73b2cb1c3fa8dd10034a73926a46389e3636c45ef2b277444b8c7daa087c61
@@ -29,43 +29,140 @@ Layout/SpaceAroundMethodCallOperator:
29
29
  Enabled: true
30
30
 
31
31
 
32
+ Lint/BinaryOperatorWithIdenticalOperands:
33
+ Enabled: true
34
+
32
35
  Lint/DeprecatedOpenSSLConstant:
33
36
  Enabled: true
34
37
 
38
+ Lint/DuplicateElsifCondition:
39
+ Enabled: true
40
+
41
+ Lint/DuplicateRescueException:
42
+ Enabled: true
43
+
44
+ Lint/EmptyConditionalBody:
45
+ Enabled: true
46
+
47
+ Lint/FloatComparison:
48
+ Enabled: true
49
+
50
+ Lint/MissingSuper:
51
+ Enabled: true
52
+
35
53
  Lint/MixedRegexpCaptureTypes:
36
54
  Enabled: true
37
55
 
56
+ Lint/OutOfRangeRegexpRef:
57
+ Enabled: true
58
+
38
59
  Lint/RaiseException:
39
60
  Enabled: true
40
61
 
62
+ Lint/SelfAssignment:
63
+ Enabled: true
64
+
41
65
  Lint/StructNewOverride:
42
66
  Enabled: true
43
67
 
68
+ Lint/TopLevelReturnWithArgument:
69
+ Enabled: true
70
+
71
+ Lint/UnreachableLoop:
72
+ Enabled: true
73
+
44
74
 
45
75
  Metrics/MethodLength:
46
76
  Max: 15
47
77
 
48
78
 
79
+ Performance/AncestorsInclude:
80
+ Enabled: true
81
+
82
+ Performance/BigDecimalWithNumericArgument:
83
+ Enabled: true
84
+
85
+ Performance/RedundantSortBlock:
86
+ Enabled: true
87
+
88
+ Performance/RedundantStringChars:
89
+ Enabled: true
90
+
91
+ Performance/ReverseFirst:
92
+ Enabled: true
93
+
94
+ Performance/SortReverse:
95
+ Enabled: true
96
+
97
+ Performance/Squeeze:
98
+ Enabled: true
99
+
100
+ Performance/StringInclude:
101
+ Enabled: true
102
+
103
+
104
+ Style/AccessorGrouping:
105
+ Enabled: true
106
+
107
+ Style/ArrayCoercion:
108
+ Enabled: true
109
+
110
+ Style/BisectedAttrAccessor:
111
+ Enabled: true
112
+
113
+ Style/CaseLikeIf:
114
+ Enabled: true
115
+
49
116
  Style/Documentation:
50
117
  Enabled: false
51
118
 
52
119
  Style/ExponentialNotation:
53
120
  Enabled: true
54
121
 
122
+ Style/ExplicitBlockArgument:
123
+ Enabled: true
124
+
125
+ Style/GlobalStdStream:
126
+ Enabled: true
127
+
128
+ Style/HashAsLastArrayItem:
129
+ Enabled: true
130
+
55
131
  Style/HashEachMethods:
56
132
  Enabled: true
57
133
 
134
+ Style/HashLikeCase:
135
+ Enabled: true
136
+
58
137
  Style/HashTransformKeys:
59
138
  Enabled: true
60
139
 
61
140
  Style/HashTransformValues:
62
141
  Enabled: true
63
142
 
143
+ Style/OptionalBooleanParameter:
144
+ Enabled: true
145
+
146
+ Style/RedundantAssignment:
147
+ Enabled: true
148
+
149
+ Style/RedundantFetchBlock:
150
+ Enabled: true
151
+
64
152
  Style/RedundantRegexpCharacterClass:
65
153
  Enabled: true
66
154
 
67
155
  Style/RedundantRegexpEscape:
68
156
  Enabled: true
69
157
 
158
+ Style/RedundantFileExtensionInRequire:
159
+ Enabled: true
160
+
161
+ Style/SingleArgumentDig:
162
+ Enabled: true
163
+
70
164
  Style/SlicingWithRange:
71
165
  Enabled: true
166
+
167
+ Style/StringConcatenation:
168
+ Enabled: true
@@ -1,9 +1,16 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Version 0.1.1
3
+ ## [Unreleased]
4
+ ## [0.1.3.pre.beta]
5
+ - Added `force` and `no-force` options for updating environment variables.
4
6
 
5
- Improve description example on `diff` option
7
+ ## [Released]
8
+ ### [0.1.3.pre.alpha] - 2020-07-29
9
+ - Added Heroku Oauth.
10
+ - Added ability to update/remove environment variables.
6
11
 
7
- ## Version 0.1.0
12
+ ### [0.1.1] - 2020-06-12
13
+ - Improve description example on `diff` option.
8
14
 
9
- Initial release. Includes a `diff` option & 2 themes
15
+ ### [0.1.0] - 2020-06-12
16
+ - Initial release. Includes a `diff` option & 2 themes.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- env_compare (0.1.3.pre.alpha)
4
+ env_compare (0.1.3.pre.beta)
5
5
  launchy
6
6
  platform-api
7
7
  thor
@@ -13,7 +13,7 @@ GEM
13
13
  public_suffix (>= 2.0.2, < 5.0)
14
14
  ast (2.4.1)
15
15
  coderay (1.1.3)
16
- diff-lcs (1.3)
16
+ diff-lcs (1.4.4)
17
17
  erubis (2.7.0)
18
18
  excon (0.76.0)
19
19
  heroics (0.1.1)
@@ -26,9 +26,9 @@ GEM
26
26
  method_source (1.0.0)
27
27
  moneta (1.0.0)
28
28
  multi_json (1.15.0)
29
- parallel (1.19.1)
30
- parser (2.7.1.3)
31
- ast (~> 2.4.0)
29
+ parallel (1.19.2)
30
+ parser (2.7.1.4)
31
+ ast (~> 2.4.1)
32
32
  platform-api (3.0.0)
33
33
  heroics (~> 0.1.1)
34
34
  moneta (~> 1.0.0)
@@ -55,19 +55,19 @@ GEM
55
55
  diff-lcs (>= 1.2.0, < 2.0)
56
56
  rspec-support (~> 3.9.0)
57
57
  rspec-support (3.9.3)
58
- rubocop (0.85.1)
58
+ rubocop (0.89.1)
59
59
  parallel (~> 1.10)
60
- parser (>= 2.7.0.1)
60
+ parser (>= 2.7.1.1)
61
61
  rainbow (>= 2.2.2, < 4.0)
62
62
  regexp_parser (>= 1.7)
63
63
  rexml
64
- rubocop-ast (>= 0.0.3)
64
+ rubocop-ast (>= 0.3.0, < 1.0)
65
65
  ruby-progressbar (~> 1.7)
66
66
  unicode-display_width (>= 1.4.0, < 2.0)
67
- rubocop-ast (0.0.3)
68
- parser (>= 2.7.0.1)
69
- rubocop-performance (1.6.1)
70
- rubocop (>= 0.71.0)
67
+ rubocop-ast (0.3.0)
68
+ parser (>= 2.7.1.4)
69
+ rubocop-performance (1.7.1)
70
+ rubocop (>= 0.82.0)
71
71
  ruby-progressbar (1.10.1)
72
72
  thor (1.0.1)
73
73
  unicode-display_width (1.7.0)
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
1
  # EnvCompare
2
+ [![Gem Version](https://img.shields.io/gem/v/env_compare)](https://img.shields.io/gem/v/env_compare)
3
+ ![Gem Downloads](https://img.shields.io/gem/dt/env_compare)
4
+ [![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop-hq/rubocop)
5
+ [![GitHub License](https://img.shields.io/github/license/jaydorsey/env_compare.svg)](https://github.com/jaydorsey/env_compare/blob/main/LICENSE)
2
6
 
3
7
  Compare Heroku ENV variables across environments in an HTML
4
8
  table.
@@ -63,7 +67,7 @@ Use `ec` command to start comparing 2 or more heroku application environment var
63
67
 
64
68
  When only one application name is specified, output is shown in cli. Otherwise, your default browser is launched.
65
69
 
66
- ## Compariing environment variables
70
+ ## Comparing environment variables
67
71
 
68
72
  ### Show **differences** **default*
69
73
  ```bash
@@ -88,15 +92,22 @@ ec diff --theme light heroku-app-name1 heroku-app-name2
88
92
  ## Updating environment variables across multiple apps
89
93
 
90
94
  You can use `ec update` to set or clear an environment variable across multiple Heroku
91
- applications.
95
+ applications. This includes the options:
92
96
 
93
- ### Update an environment variable
97
+ - `--key=` is required. The name of the Heroku environment variable you want to update.
98
+ - `--value=` is optional. The value of the environment variable you want to update. If not provided, will unset the environment variable.
99
+ - `--force` is a default option. Updates the environment variable, or adds it if not present.
100
+ - `--no-force` is optional. Only update the environment variable if present in the application.
101
+
102
+ ### Examples
103
+
104
+ #### Update an environment variable
94
105
 
95
106
  ```bash
96
107
  ec update heroku-app-name1 heroku-app-name2 heroku-app-name3 --key=MY_KEY --value=asdf
97
108
  ```
98
109
 
99
- ### Clear an environment variable
110
+ #### Clear an environment variable
100
111
 
101
112
  The default key value is nil; omit the `--key` argument if you want to clear an
102
113
  environment variable.
@@ -104,6 +115,7 @@ environment variable.
104
115
  ```bash
105
116
  ec update heroku-app-name1 heroku-app-name2 heroku-app-name3 --key=MY_KEY
106
117
  ```
118
+
107
119
  ## Development
108
120
 
109
121
  To test this on your machine locally, after cloning the repo:
@@ -112,6 +124,22 @@ To test this on your machine locally, after cloning the repo:
112
124
  bundle
113
125
  bundle exec ec diff heroku-app-name1 heroku-app-name2
114
126
 
127
+ You can also optionally build & install the gem locally to test:
128
+
129
+ rake build
130
+ gem install pkg/env_compare.<version_number>.gem
131
+
132
+ Then, use the `ec` command as normal.
133
+ ### Publishing the gem
134
+
135
+ If you have access to publish the gem on rubygems:
136
+
137
+ rake build
138
+ cd pkg
139
+ gem push env_compare.<version_number>.gem
140
+
115
141
  ## Contributing
116
142
 
117
143
  Bug reports and pull requests are welcome on GitHub at https://github.com/jaydorsey/env_compare.
144
+
145
+ [![Repo Contributors](https://img.shields.io/github/contributors/jaydorsey/env_compare)](https://img.shields.io/github/contributors/jaydorsey/env_compare)
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'env_compare'
@@ -8,4 +9,18 @@ require 'env_compare'
8
9
 
9
10
  # (If you use this, don't forget to add pry to your Gemfile!)
10
11
  require 'pry'
12
+
13
+ def reload!
14
+ puts 'Reloading ...'
15
+
16
+ root_dir = File.expand_path('..', __dir__)
17
+ reload_dirs = %w[lib]
18
+
19
+ reload_dirs.each do |dir|
20
+ Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |file| load(file) }
21
+ end
22
+
23
+ true
24
+ end
25
+
11
26
  Pry.start
@@ -28,8 +28,8 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'launchy'
31
- spec.add_dependency 'thor'
32
31
  spec.add_dependency 'platform-api'
32
+ spec.add_dependency 'thor'
33
33
 
34
34
  spec.add_development_dependency 'pry'
35
35
  spec.add_development_dependency 'rspec'
data/exe/ec CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'env_compare'
4
5
 
@@ -41,13 +41,17 @@ module EnvCompare
41
41
  save_and_open_file(html)
42
42
  end
43
43
 
44
- # ec update app1 app2 KEY_NAME value
45
44
  option :key, type: :string, desc: 'Key name'
46
45
  option :value, type: :string, default: nil, desc: 'Value of key'
47
- desc 'update heroku-app-name-1 heroku-app-name-2 MY_KEY test', 'Update environment variable for 1+ environments'
46
+ option :force, type: :boolean, default: true, desc: 'Add the ENV, even if it does not exist'
47
+ desc 'update heroku-app-name-1 heroku-app-name-2 --key=MY_KEY --value=test', 'Update environment variable for 1+ environments'
48
48
  def update(*apps)
49
49
  apps.each do |app|
50
- update_config(app, { options[:key] => options[:value] })
50
+ if options.force
51
+ config_var_update(app, { options[:key] => options[:value] })
52
+ else
53
+ conditional_config_var_update(app, { options[:key] => options[:value] })
54
+ end
51
55
  end
52
56
  end
53
57
 
@@ -114,8 +118,14 @@ module EnvCompare
114
118
  @theme_path ||= File.join(File.dirname(__dir__), '..', 'themes', "#{file}.erb")
115
119
  end
116
120
 
117
- def update_config(app, body)
118
- heroku.config_var.update(app, body)
121
+ def config_var_update(app_name, env_hash)
122
+ heroku.config_var.update(app_name, env_hash)
123
+ end
124
+
125
+ def conditional_config_var_update(app_name, env_hash)
126
+ return if config_vars_for_app(app_name)[options[:key]].nil?
127
+
128
+ config_var_update(app_name, env_hash)
119
129
  end
120
130
  end
121
131
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnvCompare
4
- VERSION = '0.1.3-alpha'
4
+ VERSION = '0.1.3-beta'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: env_compare
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3.pre.alpha
4
+ version: 0.1.3.pre.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Dorsey
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-29 00:00:00.000000000 Z
11
+ date: 2020-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: thor
28
+ name: platform-api
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: platform-api
42
+ name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="