env_compare 0.1.1 → 0.1.3.pre.alpha
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
- data/.rubocop.yml +48 -6
- data/Gemfile +5 -3
- data/Gemfile.lock +16 -1
- data/LICENSE +21 -0
- data/README.md +73 -21
- data/Rakefile +5 -3
- data/bin/console +3 -3
- data/env_compare.gemspec +1 -0
- data/exe/ec +2 -2
- data/lib/env_compare.rb +1 -93
- data/lib/env_compare/cli.rb +121 -0
- data/lib/env_compare/version.rb +1 -1
- data/themes/dark.erb +19 -27
- data/themes/light.erb +18 -27
- data/themes/table_template.erb +26 -0
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1119534c3a09963aa5e16f2c11730ea7915f78c1a5efe8b3471d952bf3ec595
|
4
|
+
data.tar.gz: 79b778d047d032173624c4ea612d91684b897685268cfe18e20e22cded13df42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cf797bd514f23db0ccc51f81d29021fc8fb296031d52b119a82ffd327a033f48e778ff17892d05da68f6ab3fd0165a80db561661651210b3781074bff10b596
|
7
|
+
data.tar.gz: 3173d7ecf3810de57da910c86bbddbc5a70276a98056705251b8b80130f0379ad8506987f7055dfc14f528725753898abb1c95199e337b084fd32335c088f673
|
data/.rubocop.yml
CHANGED
@@ -16,14 +16,56 @@ require:
|
|
16
16
|
Layout/LineLength:
|
17
17
|
Max: 120
|
18
18
|
|
19
|
-
Style/Documentation:
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
Metrics/MethodLength:
|
23
|
-
Max: 15
|
24
|
-
|
25
19
|
Layout/DotPosition:
|
26
20
|
EnforcedStyle: trailing
|
27
21
|
|
22
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
23
|
+
Enabled: true
|
24
|
+
|
28
25
|
Layout/MultilineMethodCallIndentation:
|
29
26
|
EnforcedStyle: indented
|
27
|
+
|
28
|
+
Layout/SpaceAroundMethodCallOperator:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
|
32
|
+
Lint/DeprecatedOpenSSLConstant:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Lint/MixedRegexpCaptureTypes:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
Lint/RaiseException:
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
Lint/StructNewOverride:
|
42
|
+
Enabled: true
|
43
|
+
|
44
|
+
|
45
|
+
Metrics/MethodLength:
|
46
|
+
Max: 15
|
47
|
+
|
48
|
+
|
49
|
+
Style/Documentation:
|
50
|
+
Enabled: false
|
51
|
+
|
52
|
+
Style/ExponentialNotation:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Style/HashEachMethods:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
Style/HashTransformKeys:
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Style/HashTransformValues:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
Style/RedundantRegexpCharacterClass:
|
65
|
+
Enabled: true
|
66
|
+
|
67
|
+
Style/RedundantRegexpEscape:
|
68
|
+
Enabled: true
|
69
|
+
|
70
|
+
Style/SlicingWithRange:
|
71
|
+
Enabled: true
|
data/Gemfile
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in env_compare.gemspec
|
4
6
|
gemspec
|
5
7
|
|
6
|
-
gem
|
7
|
-
gem
|
8
|
+
gem 'rake', '~> 12.0'
|
9
|
+
gem 'rspec', '~> 3.0'
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
env_compare (0.1.
|
4
|
+
env_compare (0.1.3.pre.alpha)
|
5
5
|
launchy
|
6
|
+
platform-api
|
6
7
|
thor
|
7
8
|
|
8
9
|
GEM
|
@@ -13,18 +14,32 @@ GEM
|
|
13
14
|
ast (2.4.1)
|
14
15
|
coderay (1.1.3)
|
15
16
|
diff-lcs (1.3)
|
17
|
+
erubis (2.7.0)
|
18
|
+
excon (0.76.0)
|
19
|
+
heroics (0.1.1)
|
20
|
+
erubis (~> 2.0)
|
21
|
+
excon
|
22
|
+
moneta
|
23
|
+
multi_json (>= 1.9.2)
|
16
24
|
launchy (2.5.0)
|
17
25
|
addressable (~> 2.7)
|
18
26
|
method_source (1.0.0)
|
27
|
+
moneta (1.0.0)
|
28
|
+
multi_json (1.15.0)
|
19
29
|
parallel (1.19.1)
|
20
30
|
parser (2.7.1.3)
|
21
31
|
ast (~> 2.4.0)
|
32
|
+
platform-api (3.0.0)
|
33
|
+
heroics (~> 0.1.1)
|
34
|
+
moneta (~> 1.0.0)
|
35
|
+
rate_throttle_client (~> 0.1.0)
|
22
36
|
pry (0.13.1)
|
23
37
|
coderay (~> 1.1)
|
24
38
|
method_source (~> 1.0)
|
25
39
|
public_suffix (4.0.5)
|
26
40
|
rainbow (3.0.0)
|
27
41
|
rake (12.3.3)
|
42
|
+
rate_throttle_client (0.1.2)
|
28
43
|
regexp_parser (1.7.1)
|
29
44
|
rexml (3.2.4)
|
30
45
|
rspec (3.9.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Jay Dorsey
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -11,47 +11,99 @@ production environment variables
|
|
11
11
|
This gem helps pull down the environment variables and give you
|
12
12
|
a little interface to view & compare them with (via a UI)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
This gem wraps the heroku CLI tool to generates a small temporary
|
19
|
-
HTML file & opens it using [launchy](https://github.com/copiousfreetime/launchy)
|
14
|
+
The heavy lifting is done via the [heroku platform-api gem](https://github.com/heroku/platform-api)
|
15
|
+
to retrieve environment variables, format them in an HTML page, and
|
16
|
+
generate a small HTML file and open it with [launchy](https://github.com/copiousfreetime/launchy)
|
20
17
|
|
21
18
|
It automates a few things:
|
22
19
|
- Hides environment variables that match across all environments
|
23
20
|
- Puts them in alpha order
|
24
21
|
|
25
22
|
It's primarily intended to compare pre-production ENV variables
|
23
|
+
across similar/identical environments
|
26
24
|
|
27
25
|
## Installation
|
28
26
|
|
29
|
-
|
30
|
-
brew tap heroku/brew && brew install heroku
|
27
|
+
### Prerequisites
|
31
28
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
```bash
|
30
|
+
# Install Heroku CLI
|
31
|
+
brew tap heroku/brew && brew install heroku
|
32
|
+
|
33
|
+
# Login with Heroku CLI
|
34
|
+
heroku login
|
35
|
+
|
36
|
+
# Install the heroku oauth plugin to generate an OAuth token
|
37
|
+
heroku plugins:install heroku-cli-oauth
|
38
|
+
|
39
|
+
# Create a token to access your applications
|
40
|
+
heroku authorizations:create -d "Platform API token for environment variables"
|
41
|
+
|
42
|
+
# Set the Token from above to an environment variable
|
43
|
+
export OAUTH_TOKEN=<token>
|
44
|
+
```
|
45
|
+
|
46
|
+
If you want to add the environment variable to your shell permanently, you can
|
47
|
+
run a variation of the command below:
|
36
48
|
|
37
|
-
|
49
|
+
```bash
|
50
|
+
# Add permanently to `.bash_profile`
|
51
|
+
echo 'export OAUTH_TOKEN=<token>' >>~/.bash_profile
|
52
|
+
```
|
38
53
|
|
39
|
-
|
40
|
-
|
41
|
-
|
54
|
+
### Install gem
|
55
|
+
```bash
|
56
|
+
gem install env_compare
|
57
|
+
```
|
58
|
+
|
59
|
+
After installation you should have access to the `ec` executable wrapper.
|
42
60
|
|
43
61
|
## Usage
|
62
|
+
Use `ec` command to start comparing 2 or more heroku application environment variables.
|
63
|
+
|
64
|
+
When only one application name is specified, output is shown in cli. Otherwise, your default browser is launched.
|
65
|
+
|
66
|
+
## Compariing environment variables
|
67
|
+
|
68
|
+
### Show **differences** **default*
|
69
|
+
```bash
|
70
|
+
ec diff heroku-app-name1 heroku-app-name2 heroku-app-name3
|
71
|
+
```
|
72
|
+
|
73
|
+
### Show **all**
|
74
|
+
add `--all` option:
|
75
|
+
```bash
|
76
|
+
ec diff --all heroku-app-name1 heroku-app-name2 heroku-app-name3
|
77
|
+
```
|
78
|
+
|
79
|
+
### Themes
|
80
|
+
- `--theme dark` **default**
|
81
|
+
- `--theme light`
|
82
|
+
|
83
|
+
For Example:
|
84
|
+
```bash
|
85
|
+
ec diff --theme light heroku-app-name1 heroku-app-name2
|
86
|
+
```
|
87
|
+
|
88
|
+
## Updating environment variables across multiple apps
|
44
89
|
|
45
|
-
|
90
|
+
You can use `ec update` to set or clear an environment variable across multiple Heroku
|
91
|
+
applications.
|
46
92
|
|
47
|
-
|
93
|
+
### Update an environment variable
|
48
94
|
|
49
|
-
|
95
|
+
```bash
|
96
|
+
ec update heroku-app-name1 heroku-app-name2 heroku-app-name3 --key=MY_KEY --value=asdf
|
97
|
+
```
|
50
98
|
|
51
|
-
|
99
|
+
### Clear an environment variable
|
52
100
|
|
53
|
-
|
101
|
+
The default key value is nil; omit the `--key` argument if you want to clear an
|
102
|
+
environment variable.
|
54
103
|
|
104
|
+
```bash
|
105
|
+
ec update heroku-app-name1 heroku-app-name2 heroku-app-name3 --key=MY_KEY
|
106
|
+
```
|
55
107
|
## Development
|
56
108
|
|
57
109
|
To test this on your machine locally, after cloning the repo:
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'env_compare'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
require
|
10
|
+
require 'pry'
|
11
11
|
Pry.start
|
data/env_compare.gemspec
CHANGED
data/exe/ec
CHANGED
data/lib/env_compare.rb
CHANGED
@@ -3,99 +3,7 @@
|
|
3
3
|
require 'env_compare/errors'
|
4
4
|
require 'env_compare/name_space'
|
5
5
|
require 'env_compare/version'
|
6
|
-
require '
|
7
|
-
require 'launchy'
|
8
|
-
require 'securerandom'
|
9
|
-
require 'thor'
|
10
|
-
require 'pry'
|
6
|
+
require 'env_compare/cli'
|
11
7
|
|
12
8
|
module EnvCompare
|
13
|
-
class CLI < Thor
|
14
|
-
attr_accessor :envs
|
15
|
-
|
16
|
-
desc 'version', 'list version'
|
17
|
-
def version
|
18
|
-
puts EnvCompare::VERSION
|
19
|
-
end
|
20
|
-
|
21
|
-
desc 'list ENVIRONMENT', 'List environment variables for a single environment'
|
22
|
-
|
23
|
-
def list(environment)
|
24
|
-
output = `heroku config -a #{environment}`
|
25
|
-
puts output
|
26
|
-
end
|
27
|
-
|
28
|
-
option :theme, type: :string, default: 'dark', desc: 'Theme to use'
|
29
|
-
option :all, type: :boolean, default: false, desc: 'Display all ENV variables, including matches'
|
30
|
-
desc 'diff heroku-app-name-1 heroku-app-name-2', 'Compare environment variables for 2+ environments'
|
31
|
-
def diff(*envs)
|
32
|
-
return list(envs.first) if envs.size == 1
|
33
|
-
|
34
|
-
heroku_results(envs)
|
35
|
-
|
36
|
-
# https://stackoverflow.com/a/5462069/2892779
|
37
|
-
html =
|
38
|
-
theme(options[:theme]).
|
39
|
-
result(
|
40
|
-
::EnvCompare::NameSpace.new(data: calculated_output(envs), headers: ['KEY', envs].flatten).get_binding
|
41
|
-
)
|
42
|
-
|
43
|
-
save_and_open_file(html)
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def all_keys
|
49
|
-
@all_keys ||= Set.new
|
50
|
-
end
|
51
|
-
|
52
|
-
def calculated_output(envs)
|
53
|
-
all_keys.sort.map do |key|
|
54
|
-
results = envs.map { |env| heroku_results[env][key] }
|
55
|
-
next if results.uniq.size == 1 && !options[:all]
|
56
|
-
|
57
|
-
[key, *results]
|
58
|
-
end.compact
|
59
|
-
end
|
60
|
-
|
61
|
-
def heroku_results(envs = nil)
|
62
|
-
@heroku_results ||=
|
63
|
-
envs.each_with_object({}) do |env, obj|
|
64
|
-
obj[env] = {}
|
65
|
-
lines = `heroku config -a #{env}`.split("\n").drop(1)
|
66
|
-
|
67
|
-
lines.each do |line|
|
68
|
-
key, _, value = line.partition(':')
|
69
|
-
obj[env][key.strip] = value.strip
|
70
|
-
|
71
|
-
all_keys << key.strip
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def save_and_open_file(html)
|
77
|
-
filename = "#{SecureRandom.hex(32)}.html"
|
78
|
-
output = File.open(filename, 'w')
|
79
|
-
output.write(html)
|
80
|
-
output.close
|
81
|
-
|
82
|
-
full_path = File.join(Dir.pwd, output.path)
|
83
|
-
|
84
|
-
Launchy.open(full_path)
|
85
|
-
|
86
|
-
sleep(1)
|
87
|
-
|
88
|
-
File.delete(full_path)
|
89
|
-
end
|
90
|
-
|
91
|
-
def theme(file)
|
92
|
-
return ERB.new(File.read(theme_path(file))) if File.exist?(theme_path(file))
|
93
|
-
|
94
|
-
raise MissingThemeError
|
95
|
-
end
|
96
|
-
|
97
|
-
def theme_path(file)
|
98
|
-
@theme_path ||= File.join(File.dirname(__dir__), 'themes', "#{file}.erb")
|
99
|
-
end
|
100
|
-
end
|
101
9
|
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'erb'
|
4
|
+
require 'launchy'
|
5
|
+
require 'securerandom'
|
6
|
+
require 'platform-api'
|
7
|
+
require 'pry'
|
8
|
+
require 'thor'
|
9
|
+
|
10
|
+
module EnvCompare
|
11
|
+
class Cli < Thor
|
12
|
+
attr_accessor :envs
|
13
|
+
|
14
|
+
desc 'version', 'list version'
|
15
|
+
def version
|
16
|
+
puts EnvCompare::VERSION
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'list ENVIRONMENT', 'List environment variables for a single environment'
|
20
|
+
|
21
|
+
def list(environment)
|
22
|
+
output = `heroku config -a #{environment}`
|
23
|
+
puts output
|
24
|
+
end
|
25
|
+
|
26
|
+
option :theme, type: :string, default: 'dark', desc: 'Theme to use'
|
27
|
+
option :all, type: :boolean, default: false, desc: 'Display all ENV variables, including matches'
|
28
|
+
desc 'diff heroku-app-name-1 heroku-app-name-2', 'Compare environment variables for 2+ environments'
|
29
|
+
def diff(*envs)
|
30
|
+
return list(envs.first) if envs.size == 1
|
31
|
+
|
32
|
+
heroku_results(envs)
|
33
|
+
|
34
|
+
# https://stackoverflow.com/a/5462069/2892779
|
35
|
+
html =
|
36
|
+
theme(options[:theme]).
|
37
|
+
result(
|
38
|
+
::EnvCompare::NameSpace.new(data: calculated_output(envs), headers: ['KEY', envs].flatten).get_binding
|
39
|
+
)
|
40
|
+
|
41
|
+
save_and_open_file(html)
|
42
|
+
end
|
43
|
+
|
44
|
+
# ec update app1 app2 KEY_NAME value
|
45
|
+
option :key, type: :string, desc: 'Key name'
|
46
|
+
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'
|
48
|
+
def update(*apps)
|
49
|
+
apps.each do |app|
|
50
|
+
update_config(app, { options[:key] => options[:value] })
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def all_keys
|
57
|
+
@all_keys ||= Set.new
|
58
|
+
end
|
59
|
+
|
60
|
+
def calculated_output(envs)
|
61
|
+
all_keys.sort.map do |key|
|
62
|
+
results = envs.map { |env| heroku_results[env][key] }
|
63
|
+
next if results.uniq.size == 1 && !options[:all]
|
64
|
+
|
65
|
+
[key, *results]
|
66
|
+
end.compact
|
67
|
+
end
|
68
|
+
|
69
|
+
def heroku_results(app_names = nil)
|
70
|
+
@heroku_results ||=
|
71
|
+
app_names.each_with_object({}) do |app_name, obj|
|
72
|
+
obj[app_name] = {}
|
73
|
+
|
74
|
+
env_vars = config_vars_for_app(app_name)
|
75
|
+
|
76
|
+
env_vars.each do |key, value|
|
77
|
+
obj[app_name][key] = value
|
78
|
+
|
79
|
+
all_keys << key
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def save_and_open_file(html)
|
85
|
+
filename = "#{SecureRandom.hex(32)}.html"
|
86
|
+
output = File.open(filename, 'w')
|
87
|
+
output.write(html)
|
88
|
+
output.close
|
89
|
+
|
90
|
+
full_path = File.join(Dir.pwd, output.path)
|
91
|
+
|
92
|
+
Launchy.open(full_path)
|
93
|
+
|
94
|
+
sleep(1)
|
95
|
+
|
96
|
+
File.delete(full_path)
|
97
|
+
end
|
98
|
+
|
99
|
+
def config_vars_for_app(app_name)
|
100
|
+
heroku.config_var.info_for_app(app_name)
|
101
|
+
end
|
102
|
+
|
103
|
+
def heroku
|
104
|
+
@heroku ||= PlatformAPI.connect_oauth(ENV['OAUTH_TOKEN'])
|
105
|
+
end
|
106
|
+
|
107
|
+
def theme(file)
|
108
|
+
return ERB.new(File.read(theme_path(file))) if File.exist?(theme_path(file))
|
109
|
+
|
110
|
+
raise MissingThemeError
|
111
|
+
end
|
112
|
+
|
113
|
+
def theme_path(file)
|
114
|
+
@theme_path ||= File.join(File.dirname(__dir__), '..', 'themes', "#{file}.erb")
|
115
|
+
end
|
116
|
+
|
117
|
+
def update_config(app, body)
|
118
|
+
heroku.config_var.update(app, body)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
data/lib/env_compare/version.rb
CHANGED
data/themes/dark.erb
CHANGED
@@ -1,23 +1,34 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
3
|
<style>
|
4
|
+
:root {
|
5
|
+
--black: #000;
|
6
|
+
--blue: #409cff;
|
7
|
+
--gray-object-only: #636366;
|
8
|
+
--orange: #ffb340;
|
9
|
+
--purple: #da8fff;
|
10
|
+
}
|
11
|
+
|
4
12
|
body {
|
5
|
-
background:
|
13
|
+
background: var(--black);
|
6
14
|
font-family: Arial, Helvetica, sans-serif;
|
7
15
|
}
|
16
|
+
|
8
17
|
table {
|
9
|
-
color:
|
18
|
+
color: var(--purple);
|
10
19
|
table-layout: fixed;
|
11
20
|
width: 100%;
|
12
21
|
}
|
13
22
|
|
14
|
-
table,
|
15
|
-
|
23
|
+
table,
|
24
|
+
th,
|
25
|
+
td {
|
26
|
+
border: 1px solid var(--gray-object-only);
|
16
27
|
border-collapse: collapse;
|
17
28
|
}
|
18
29
|
|
19
30
|
th {
|
20
|
-
color:
|
31
|
+
color: var(--orange);
|
21
32
|
letter-spacing: 1px;
|
22
33
|
}
|
23
34
|
|
@@ -27,31 +38,12 @@
|
|
27
38
|
}
|
28
39
|
|
29
40
|
td:first-child {
|
30
|
-
color:
|
41
|
+
color: var(--blue);
|
31
42
|
}
|
32
43
|
</style>
|
33
44
|
</head>
|
34
45
|
<body>
|
35
|
-
|
36
|
-
|
37
|
-
<% headers.each_with_index do |header, idx| %>
|
38
|
-
<th>
|
39
|
-
<%= header %>
|
40
|
-
(<%= data.map { |col| col[idx] }.compact.size - 1 %> keys)
|
41
|
-
</th>
|
42
|
-
<% end %>
|
43
|
-
</tr>
|
44
|
-
<% data.each do |row| %>
|
45
|
-
<tr>
|
46
|
-
<% row.each do |cell| %>
|
47
|
-
<td>
|
48
|
-
<% unless cell.nil? %>
|
49
|
-
<code><%= cell %></code>
|
50
|
-
<% end %>
|
51
|
-
</td>
|
52
|
-
<% end %>
|
53
|
-
</tr>
|
54
|
-
<% end %>
|
55
|
-
</table>
|
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) %>
|
56
48
|
</body>
|
57
49
|
</html>
|
data/themes/light.erb
CHANGED
@@ -1,23 +1,33 @@
|
|
1
1
|
<html>
|
2
2
|
<head>
|
3
3
|
<style>
|
4
|
+
:root {
|
5
|
+
--black: #000;
|
6
|
+
--blue: #0040dd;
|
7
|
+
--gray: #545456;
|
8
|
+
--white: #fff;
|
9
|
+
}
|
10
|
+
|
4
11
|
body {
|
5
|
-
background:
|
12
|
+
background: var(--white);
|
6
13
|
font-family: Arial, Helvetica, sans-serif;
|
7
14
|
}
|
15
|
+
|
8
16
|
table {
|
9
|
-
color:
|
17
|
+
color: var(--black);
|
10
18
|
table-layout: fixed;
|
11
19
|
width: 100%;
|
12
20
|
}
|
13
21
|
|
14
|
-
table,
|
15
|
-
|
22
|
+
table,
|
23
|
+
th,
|
24
|
+
td {
|
25
|
+
border: 1px solid var(--gray);
|
16
26
|
border-collapse: collapse;
|
17
27
|
}
|
18
28
|
|
19
29
|
th {
|
20
|
-
color:
|
30
|
+
color: var(--black);
|
21
31
|
letter-spacing: 1px;
|
22
32
|
}
|
23
33
|
|
@@ -27,31 +37,12 @@
|
|
27
37
|
}
|
28
38
|
|
29
39
|
td:first-child {
|
30
|
-
color:
|
40
|
+
color: var(--blue);
|
31
41
|
}
|
32
42
|
</style>
|
33
43
|
</head>
|
34
44
|
<body>
|
35
|
-
|
36
|
-
|
37
|
-
<% headers.each_with_index do |header, idx| %>
|
38
|
-
<th>
|
39
|
-
<%= header %>
|
40
|
-
(<%= data.map { |col| col[idx] }.compact.size - 1 %> keys)
|
41
|
-
</th>
|
42
|
-
<% end %>
|
43
|
-
</tr>
|
44
|
-
<% data.each do |row| %>
|
45
|
-
<tr>
|
46
|
-
<% row.each do |cell| %>
|
47
|
-
<td>
|
48
|
-
<% unless cell.nil? %>
|
49
|
-
<code><%= cell %></code>
|
50
|
-
<% end %>
|
51
|
-
</td>
|
52
|
-
<% end %>
|
53
|
-
</tr>
|
54
|
-
<% end %>
|
55
|
-
</table>
|
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) %>
|
56
47
|
</body>
|
57
48
|
</html>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<table>
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<% headers.each_with_index do |header, idx| %>
|
5
|
+
<th>
|
6
|
+
<%= header %>
|
7
|
+
(<%= data.map { |col| col[idx] }.compact.size %>)
|
8
|
+
</th>
|
9
|
+
<% end %>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
|
13
|
+
<tbody>
|
14
|
+
<% data.each do |row| %>
|
15
|
+
<tr>
|
16
|
+
<% row.each do |cell| %>
|
17
|
+
<td>
|
18
|
+
<% unless cell.nil? %>
|
19
|
+
<code><%= cell %></code>
|
20
|
+
<% end %>
|
21
|
+
</td>
|
22
|
+
<% end %>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
</tbody>
|
26
|
+
</table>
|
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.
|
4
|
+
version: 0.1.3.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-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: launchy
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: platform-api
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: pry
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +123,7 @@ files:
|
|
109
123
|
- CHANGELOG.md
|
110
124
|
- Gemfile
|
111
125
|
- Gemfile.lock
|
126
|
+
- LICENSE
|
112
127
|
- README.md
|
113
128
|
- Rakefile
|
114
129
|
- bin/console
|
@@ -116,11 +131,13 @@ files:
|
|
116
131
|
- env_compare.gemspec
|
117
132
|
- exe/ec
|
118
133
|
- lib/env_compare.rb
|
134
|
+
- lib/env_compare/cli.rb
|
119
135
|
- lib/env_compare/errors.rb
|
120
136
|
- lib/env_compare/name_space.rb
|
121
137
|
- lib/env_compare/version.rb
|
122
138
|
- themes/dark.erb
|
123
139
|
- themes/light.erb
|
140
|
+
- themes/table_template.erb
|
124
141
|
homepage: https://jaydorsey.com/
|
125
142
|
licenses: []
|
126
143
|
metadata:
|
@@ -139,11 +156,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
156
|
version: 2.3.0
|
140
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
158
|
requirements:
|
142
|
-
- - "
|
159
|
+
- - ">"
|
143
160
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
161
|
+
version: 1.3.1
|
145
162
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
163
|
+
rubygems_version: 3.0.3
|
147
164
|
signing_key:
|
148
165
|
specification_version: 4
|
149
166
|
summary: Compare ENV variables across Heroku environments
|