Module: Dawn::CLI::Env

Extended by:
Helpers
Defined in:
lib/dawn/cli/commands/env.rb

Class Method Summary collapse

Methods included from Helpers

current_app, current_app_name, extract_app_in_dir, extract_app_remote_from_git_config, git, git_add_dawn_remote, git_dawn_remote?, git_remotes, git_remove_dawn_remote, has_git?, try_create_app

Methods included from OutputFormatter

#format_apps, #format_domains, #format_drains, #format_gears, #format_keys, #table_style

Class Method Details

.get(*keys) ⇒ Object

“Get an ENV var”



17
18
19
20
21
22
23
# File 'lib/dawn/cli/commands/env.rb', line 17

def self.get(*keys)
  app = current_app
  env = app.env
  keys.each do |k|
    say "#{k}=#{env[k]}"
  end
end

.listObject

displays all the current app’s ENV variables



10
11
12
13
14
# File 'lib/dawn/cli/commands/env.rb', line 10

def self.list
  current_app.env.each do |k, v|
    say "#{k}=#{v}"
  end
end

.set(hash) ⇒ Object

“Set multiple ENV variables”



26
27
28
29
30
# File 'lib/dawn/cli/commands/env.rb', line 26

def self.set(hash)
  app = current_app
  app.env.update(app.env.merge(hash)) # this is a Hash method
  app.env.save                        # this is a API method
end

.unset(*keys) ⇒ Object

“Deletes an ENV var”



33
34
35
36
37
38
39
# File 'lib/dawn/cli/commands/env.rb', line 33

def self.unset(*keys)
  app = current_app
  keys.each do |k|
    app.env.delete(k)
  end
  app.env.save
end