module Cabal::CLI
Bootstrap and configure the CLI
application
Constants
- NoConfig
The expected config file does not exist
- NoPrivateConfig
The config file does not contain :access_key and :secret_key
- NoURLDefinition
The config file does not contain a :url
Public Class Methods
cabal_yml()
click to toggle source
Calculates the expected path of the Cabal
config file @return [String] the config file path
# File lib/cabal/cli.rb, line 22 def self.cabal_yml File.expand_path(File.join(ENV['HOME'], '.cabal.yml')) end
config()
click to toggle source
The global config for the CLI
@return [Hash] the current configuration
# File lib/cabal/cli.rb, line 40 def self.config @config ||= {} end
reset()
click to toggle source
Clears the global configuration @return [nil]
# File lib/cabal/cli.rb, line 46 def self.reset @config = {} end
setup()
click to toggle source
Parses the config file and sets up the global configuration @return [nil]
# File lib/cabal/cli.rb, line 28 def self.setup if File.exist?(cabal_yml) @config = YAML.load(File.read(cabal_yml)) raise NoURLDefinition.new("#{cabal_yml} must contain a :url: definition") unless config[:url] else raise NoConfig.new("Please create #{cabal_yml} and try again") end end