class AmsLayout::Config::Del

Public Instance Methods

credentials(envname) click to toggle source
# File lib/ams_layout/cli/config.rb, line 133
def credentials(envname)
  with_loaded_config do
    if AmsLayout.configuration.credentials.key?(envname.to_sym)
      AmsLayout.configuration.credentials.delete(envname.to_sym)
    end
  end
end
env(envname) click to toggle source
# File lib/ams_layout/cli/config.rb, line 122
def env(envname)
  with_loaded_config do
    if AmsLayout.configuration.base_urls.key?(envname.to_sym)
      AmsLayout.configuration.base_urls.delete(envname.to_sym)
    end
  end

  credentials(envname)
end

Private Instance Methods

with_loaded_config() { || ... } click to toggle source
# File lib/ams_layout/cli/config.rb, line 143
def with_loaded_config &block
  fail "expecting block" unless block_given?

  unless AmsLayout.load_configuration
    say "Configuration file not found!", :red
    say "Have you tried 'config init' first?"
    return
  end

  yield

  AmsLayout.save_configuration
end