Class: SecretHub::Commands::Bulk
- Defined in:
- lib/secret_hub/commands/bulk.rb
Instance Method Summary collapse
- #clean_command ⇒ Object
- #init_command ⇒ Object
- #list_command ⇒ Object
- #save_command ⇒ Object
- #show_command ⇒ Object
Methods inherited from Base
Instance Method Details
#clean_command ⇒ Object
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/secret_hub/commands/bulk.rb', line 76 def clean_command dry = args['--dry'] config.each do |repo, secrets| say "!txtblu!#{repo}" clean_repo repo, secrets.keys, dry end say "\nDry run, nothing happened" if dry end |
#init_command ⇒ Object
37 38 39 40 41 |
# File 'lib/secret_hub/commands/bulk.rb', line 37 def init_command raise SecretHubError, "File #{config_file} already exists" if File.exist? config_file FileUtils.cp config_template, config_file say "!txtgrn!Saved #{config_file}" end |
#list_command ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/secret_hub/commands/bulk.rb', line 52 def list_command config.each_repo do |repo| say "!txtblu!#{repo}:" github.secrets(repo).each do |secret| say "- !txtpur!#{secret}" end end end |
#save_command ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/secret_hub/commands/bulk.rb', line 61 def save_command dry = args['--dry'] skipped = 0 config.each do |repo, secrets| say "!txtblu!#{repo}" skipped += update_repo repo, secrets, dry clean_repo repo, secrets.keys, dry if args['--clean'] end puts "\n" if skipped > 0 or dry say "Skipped #{skipped} missing secrets" if skipped > 0 say "Dry run, nothing happened" if dry end |
#show_command ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/secret_hub/commands/bulk.rb', line 43 def show_command config.each do |repo, secrets| say "!txtblu!#{repo}:" secrets.each do |key, value| show_secret key, value, args['--visible'] end end end |