Class: Neetob::CLI::Heroku::ConfigVars::Audit
- Defined in:
- lib/neetob/cli/heroku/config_vars/audit.rb
Constant Summary
Constants inherited from Base
Constants inherited from Base
Instance Attribute Summary collapse
-
#apps ⇒ Object
Returns the value of attribute apps.
-
#expected_config_vars_json_file_path ⇒ Object
Returns the value of attribute expected_config_vars_json_file_path.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(apps, expected_config_vars_json_file_path = "", sandbox = false) ⇒ Audit
constructor
A new instance of Audit.
- #run ⇒ Object
Methods inherited from Base
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize(apps, expected_config_vars_json_file_path = "", sandbox = false) ⇒ Audit
Returns a new instance of Audit.
15 16 17 18 19 20 |
# File 'lib/neetob/cli/heroku/config_vars/audit.rb', line 15 def initialize(apps, expected_config_vars_json_file_path = "", sandbox = false) super() @apps = apps @expected_config_vars_json_file_path = expected_config_vars_json_file_path @sandbox = sandbox end |
Instance Attribute Details
#apps ⇒ Object
Returns the value of attribute apps.
13 14 15 |
# File 'lib/neetob/cli/heroku/config_vars/audit.rb', line 13 def apps @apps end |
#expected_config_vars_json_file_path ⇒ Object
Returns the value of attribute expected_config_vars_json_file_path.
13 14 15 |
# File 'lib/neetob/cli/heroku/config_vars/audit.rb', line 13 def expected_config_vars_json_file_path @expected_config_vars_json_file_path end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
13 14 15 |
# File 'lib/neetob/cli/heroku/config_vars/audit.rb', line 13 def sandbox @sandbox end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/neetob/cli/heroku/config_vars/audit.rb', line 22 def run matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox) table_rows = [] expected_config = read_json_file(expected_config_vars_json_file_path || default_config_vars_json_file_path) return unless expected_config matching_apps.each do |app| actual_config = `heroku config -a #{app} --json` unless $?.success? ui.error("There is a problem in accessing the app with name \"#{app}\" in your account.") ui.error("Please check the specified app name and ensure you're authorized to view that app.") next end actual_config_json = JSON.parse(actual_config) table_rows.concat(compare_config_and_build_rows(app, expected_config, actual_config_json)) end table = Terminal::Table.new headings: ["App", "Config var", "Expected", "Result"], rows: table_rows ui.success(table) end |