Class: RailsCredentialsManager::Diff
- Defined in:
- lib/rails_credentials_manager/diff.rb
Constant Summary
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#config_has_keys?, #configs, #initialize, #pastel, #print_key_and_value
Constructor Details
This class inherits a constructor from RailsCredentialsManager::Base
Instance Method Details
#perform(branch_to_compare) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_credentials_manager/diff.rb', line 5 def perform(branch_to_compare) cmd = TTY::Command.new(pty: true, printer: :null) configs.each do |env, config| puts pastel.green("#{env}:") result = cmd.run!("echo `git show origin/#{branch_to_compare}:config/credentials/#{env}.yml.enc`") encripted_file_content = result.out.strip if encripted_file_content.blank? puts "❗️ Can not find #{env} credentials file in origin/#{branch_to_compare} branch" next end branch_config = config_to_compare_for(env, encripted_file_content) deep_print_diff(HashDiff.diff(branch_config, config)) end end |