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

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: e51a067d2f76fb50f8d90005c51ff3a538d4d426087f9a36da38321050736b32
4
- data.tar.gz: 370af34407e7666e1484d405d8a36bb31daf2c925d9a690caa7099184ade4ec8
3
+ metadata.gz: d4b3d3f36b43327e20252ce4cd37aa306d25de324d0ea234f0003f89910a8f4a
4
+ data.tar.gz: 4598c0fa7b5f40783d5d11c4511535e2cc771527eaa28a24c1b030d6dd13d6e9
5
5
  SHA512:
6
- metadata.gz: 1d78e742eb5556f34b52d19d15c34f8d653a3bd7d65586b4cc24d88607cdbc1c24b2b28a63b5b45b25ad3a1a8e868559ea162e7abd57591645f1828946c7e896
7
- data.tar.gz: a57c5325cc82f97815170ba3f9e31cb9845efae58fc7115bdd8ba2e4c8ea1c978a73b2cb1c3fa8dd10034a73926a46389e3636c45ef2b277444b8c7daa087c61
6
+ metadata.gz: e645f7ac2ee563e461646372f8e24e44ea84b1c72a3e41982e516ffd700ce2a0eb5be08432f649bf91eba41e577f61f2ba55425732cfbf4f094decadb4594882
7
+ data.tar.gz: 007ce621b0bd9c3c9f86094fe070a0b19ca4c8d3bd9e839c756ddc8424ef2e1bc1a72098af6a1b3524c589bb28480f6ae19da51b97c6061c53f9725ef26565fd
@@ -13,156 +13,20 @@
13
13
  require:
14
14
  - rubocop-performance
15
15
 
16
+ AllCops:
17
+ NewCops: enable
18
+
16
19
  Layout/LineLength:
17
20
  Max: 120
18
21
 
19
22
  Layout/DotPosition:
20
23
  EnforcedStyle: trailing
21
24
 
22
- Layout/EmptyLinesAroundAttributeAccessor:
23
- Enabled: true
24
-
25
25
  Layout/MultilineMethodCallIndentation:
26
26
  EnforcedStyle: indented
27
27
 
28
- Layout/SpaceAroundMethodCallOperator:
29
- Enabled: true
30
-
31
-
32
- Lint/BinaryOperatorWithIdenticalOperands:
33
- Enabled: true
34
-
35
- Lint/DeprecatedOpenSSLConstant:
36
- Enabled: true
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
-
53
- Lint/MixedRegexpCaptureTypes:
54
- Enabled: true
55
-
56
- Lint/OutOfRangeRegexpRef:
57
- Enabled: true
58
-
59
- Lint/RaiseException:
60
- Enabled: true
61
-
62
- Lint/SelfAssignment:
63
- Enabled: true
64
-
65
- Lint/StructNewOverride:
66
- Enabled: true
67
-
68
- Lint/TopLevelReturnWithArgument:
69
- Enabled: true
70
-
71
- Lint/UnreachableLoop:
72
- Enabled: true
73
-
74
-
75
28
  Metrics/MethodLength:
76
29
  Max: 15
77
30
 
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
-
116
31
  Style/Documentation:
117
32
  Enabled: false
118
-
119
- Style/ExponentialNotation:
120
- Enabled: true
121
-
122
- Style/ExplicitBlockArgument:
123
- Enabled: true
124
-
125
- Style/GlobalStdStream:
126
- Enabled: true
127
-
128
- Style/HashAsLastArrayItem:
129
- Enabled: true
130
-
131
- Style/HashEachMethods:
132
- Enabled: true
133
-
134
- Style/HashLikeCase:
135
- Enabled: true
136
-
137
- Style/HashTransformKeys:
138
- Enabled: true
139
-
140
- Style/HashTransformValues:
141
- Enabled: true
142
-
143
- Style/OptionalBooleanParameter:
144
- Enabled: true
145
-
146
- Style/RedundantAssignment:
147
- Enabled: true
148
-
149
- Style/RedundantFetchBlock:
150
- Enabled: true
151
-
152
- Style/RedundantRegexpCharacterClass:
153
- Enabled: true
154
-
155
- Style/RedundantRegexpEscape:
156
- Enabled: true
157
-
158
- Style/RedundantFileExtensionInRequire:
159
- Enabled: true
160
-
161
- Style/SingleArgumentDig:
162
- Enabled: true
163
-
164
- Style/SlicingWithRange:
165
- Enabled: true
166
-
167
- Style/StringConcatenation:
168
- Enabled: true
@@ -1,16 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
- ## [Unreleased]
4
- ## [0.1.3.pre.beta]
3
+ ## main (unreleased)
4
+ - WIP
5
+
6
+ ## 0.1.3.pre.beta (2020-09-02)
5
7
  - Added `force` and `no-force` options for updating environment variables.
6
8
 
7
- ## [Released]
8
- ### [0.1.3.pre.alpha] - 2020-07-29
9
+ ## 0.1.3.pre.alpha (2020-07-29)
9
10
  - Added Heroku Oauth.
10
11
  - Added ability to update/remove environment variables.
11
12
 
12
- ### [0.1.1] - 2020-06-12
13
+ ## 0.1.1 (2020-06-12)
13
14
  - Improve description example on `diff` option.
14
15
 
15
- ### [0.1.0] - 2020-06-12
16
+ ## 0.1.0 (2020-06-12)
16
17
  - Initial release. Includes a `diff` option & 2 themes.
@@ -36,7 +36,7 @@ GEM
36
36
  pry (0.13.1)
37
37
  coderay (~> 1.1)
38
38
  method_source (~> 1.0)
39
- public_suffix (4.0.5)
39
+ public_suffix (4.0.6)
40
40
  rainbow (3.0.0)
41
41
  rake (12.3.3)
42
42
  rate_throttle_client (0.1.2)
@@ -55,7 +55,7 @@ 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.89.1)
58
+ rubocop (0.90.0)
59
59
  parallel (~> 1.10)
60
60
  parser (>= 2.7.1.1)
61
61
  rainbow (>= 2.2.2, < 4.0)
@@ -66,8 +66,8 @@ GEM
66
66
  unicode-display_width (>= 1.4.0, < 2.0)
67
67
  rubocop-ast (0.3.0)
68
68
  parser (>= 2.7.1.4)
69
- rubocop-performance (1.7.1)
70
- rubocop (>= 0.82.0)
69
+ rubocop-performance (1.8.0)
70
+ rubocop (>= 0.87.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
@@ -96,8 +96,8 @@ applications. This includes the options:
96
96
 
97
97
  - `--key=` is required. The name of the Heroku environment variable you want to update.
98
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.
99
+ - `--force` is a default option. Updates the environment variable, or adds it if not present. ** 0.1.3.pre.beta **
100
+ - `--no-force` is optional. Only update the environment variable if present in the application. ** 0.1.3.pre.beta **
101
101
 
102
102
  ### Examples
103
103
 
@@ -11,16 +11,8 @@ require 'env_compare'
11
11
  require 'pry'
12
12
 
13
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
14
+ puts 'Reloading...'
15
+ exec 'bin/console'
24
16
  end
25
17
 
26
18
  Pry.start
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'env_compare/template'
3
4
  require 'env_compare/errors'
4
- require 'env_compare/name_space'
5
5
  require 'env_compare/version'
6
6
  require 'env_compare/cli'
7
7
 
@@ -31,12 +31,12 @@ module EnvCompare
31
31
 
32
32
  heroku_results(envs)
33
33
 
34
- # https://stackoverflow.com/a/5462069/2892779
35
34
  html =
36
- theme(options[:theme]).
37
- result(
38
- ::EnvCompare::NameSpace.new(data: calculated_output(envs), headers: ['KEY', envs].flatten).get_binding
39
- )
35
+ ::EnvCompare::Template.new(
36
+ data: calculated_output(envs),
37
+ headers: ['KEY', envs].flatten,
38
+ theme_base_path: theme_base_path
39
+ ).render('dark.html.erb')
40
40
 
41
41
  save_and_open_file(html)
42
42
  end
@@ -105,17 +105,19 @@ module EnvCompare
105
105
  end
106
106
 
107
107
  def heroku
108
- @heroku ||= PlatformAPI.connect_oauth(ENV['OAUTH_TOKEN'])
108
+ @heroku ||= PlatformAPI.connect_oauth(ENV.fetch('OAUTH_TOKEN'))
109
109
  end
110
110
 
111
- def theme(file)
112
- return ERB.new(File.read(theme_path(file))) if File.exist?(theme_path(file))
111
+ def theme_path(file)
112
+ path = File.join(theme_base_path, "#{file}.html.erb")
113
+
114
+ return path if File.exist?(path)
113
115
 
114
116
  raise MissingThemeError
115
117
  end
116
118
 
117
- def theme_path(file)
118
- @theme_path ||= File.join(File.dirname(__dir__), '..', 'themes', "#{file}.erb")
119
+ def theme_base_path
120
+ @theme_base_path ||= File.expand_path(File.join(File.dirname(__dir__), '..', 'themes'))
119
121
  end
120
122
 
121
123
  def config_var_update(app_name, env_hash)
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # https://stackoverflow.com/a/10241263/2892779
4
+ module EnvCompare
5
+ class Template
6
+ def initialize(data:, headers:, theme_base_path:)
7
+ @data = data
8
+ @headers = headers
9
+ @theme_base_path = theme_base_path
10
+ end
11
+
12
+ def render(path)
13
+ content = File.read(File.join(@theme_base_path, path))
14
+ t = ERB.new(content)
15
+ t.result(binding)
16
+ end
17
+ end
18
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EnvCompare
4
- VERSION = '0.1.3-beta'
4
+ VERSION = '0.1.4-alpha'
5
5
  end
@@ -43,7 +43,6 @@
43
43
  </style>
44
44
  </head>
45
45
  <body>
46
- <% table_template = EnvCompare::NameSpace.new(headers: headers, data: data) %>
47
- <%= ERB.new(File.new("themes/table_template.erb").read).result(table_template.get_binding) %>
46
+ <%= render 'table_template.html.erb' %>
48
47
  </body>
49
48
  </html>
@@ -42,7 +42,6 @@
42
42
  </style>
43
43
  </head>
44
44
  <body>
45
- <% table_template = EnvCompare::NameSpace.new(headers: headers, data: data) %>
46
- <%= ERB.new(File.new("themes/table_template.erb").read).result(table_template.get_binding) %>
45
+ <%= render 'table_template.html.erb' %>
47
46
  </body>
48
47
  </html>
@@ -1,17 +1,17 @@
1
1
  <table>
2
2
  <thead>
3
3
  <tr>
4
- <% headers.each_with_index do |header, idx| %>
4
+ <% @headers.each_with_index do |header, idx| %>
5
5
  <th>
6
6
  <%= header %>&nbsp;
7
- (<%= data.map { |col| col[idx] }.compact.size %>)
7
+ (<%= @data.map { |col| col[idx] }.compact.size %>)
8
8
  </th>
9
9
  <% end %>
10
10
  </tr>
11
11
  </thead>
12
12
 
13
13
  <tbody>
14
- <% data.each do |row| %>
14
+ <% @data.each do |row| %>
15
15
  <tr>
16
16
  <% row.each do |cell| %>
17
17
  <td>
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.beta
4
+ version: 0.1.4.pre.alpha
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-09-02 00:00:00.000000000 Z
11
+ date: 2020-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -133,11 +133,11 @@ files:
133
133
  - lib/env_compare.rb
134
134
  - lib/env_compare/cli.rb
135
135
  - lib/env_compare/errors.rb
136
- - lib/env_compare/name_space.rb
136
+ - lib/env_compare/template.rb
137
137
  - lib/env_compare/version.rb
138
- - themes/dark.erb
139
- - themes/light.erb
140
- - themes/table_template.erb
138
+ - themes/dark.html.erb
139
+ - themes/light.html.erb
140
+ - themes/table_template.html.erb
141
141
  homepage: https://jaydorsey.com/
142
142
  licenses: []
143
143
  metadata:
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module EnvCompare
4
- class NameSpace
5
- def initialize(hash)
6
- hash.each do |key, value|
7
- singleton_class.send(:define_method, key) { value }
8
- end
9
- end
10
-
11
- def get_binding
12
- binding
13
- end
14
- end
15
- end