Class: Sem::CLI::Secrets::Files
- Inherits:
-
Dracula
- Object
- Dracula
- Sem::CLI::Secrets::Files
- Defined in:
- lib/sem/cli/secrets.rb
Instance Method Summary collapse
Instance Method Details
#add(secrets_name) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/sem/cli/secrets.rb', line 127 def add(secrets_name) secret = Sem::API::Secret.find!(secrets_name) local_path = ["local-path"] abort "File #{local_path} not found" unless File.exist?(local_path) path = ["path-on-semaphore"] content = File.read(local_path) secret.add_config_file(:path => path, :content => content, :encrypted => true) puts "Added /home/runner/#{path} to #{secrets_name}." end |
#list(secret_name) ⇒ Object
107 108 109 110 111 112 113 114 115 116 |
# File 'lib/sem/cli/secrets.rb', line 107 def list(secret_name) secret = Sem::API::Secret.find!(secret_name) files = secret.files if !files.empty? Sem::Views::Files.list(files) else Sem::Views::Secrets.add_first_file(secret) end end |