Class: EncryptedEnv::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/encrypted_env/cli.rb

Instance Method Summary collapse

Instance Method Details

#bash(*args) ⇒ Object



8
9
10
11
12
# File 'lib/encrypted_env/cli.rb', line 8

def bash(*args)
  encrypt(*args) do |key,value|
    puts %Q(export "#{key}"="#{value}")
  end
end

#decrypt(*args) ⇒ Object



36
37
38
39
40
41
# File 'lib/encrypted_env/cli.rb', line 36

def decrypt(*args)
  EncryptedEnv.default_options = {:key => options[:key]}
  args.each do |key|
    puts "#{key}: #{::ENV.decrypt key}" rescue nil
  end
end

#heroku(*args) ⇒ Object



17
18
19
20
21
22
# File 'lib/encrypted_env/cli.rb', line 17

def heroku(*args)
  heroku_opt = "-r #{options[:remote]}" if options[:remote]
  encrypt(*args) do |key,value|
    puts %Q(heroku config:add #{heroku_opt} "#{key}=#{value}")
  end
end