Module: Cabal::CLI
- Defined in:
- lib/cabal/cli.rb,
lib/cabal/cli/key.rb,
lib/cabal/cli/ssh.rb,
lib/cabal/cli/list.rb,
lib/cabal/cli/main.rb,
lib/cabal/cli/authenticated.rb
Overview
Bootstrap and configure the CLI application
Defined Under Namespace
Modules: Authenticated Classes: Key, List, Main, SSH
Constant Summary collapse
- NoConfig =
The expected config file does not exist
Class.new(StandardError)
- NoURLDefinition =
The config file does not contain a :url
Class.new(StandardError)
- NoPrivateConfig =
The config file does not contain :access_key and :secret_key
Class.new(StandardError)
Class Method Summary collapse
-
.cabal_yml ⇒ String
Calculates the expected path of the Cabal config file.
-
.config ⇒ Hash
The global config for the CLI.
-
.reset ⇒ nil
Clears the global configuration.
-
.setup ⇒ nil
Parses the config file and sets up the global configuration.
Class Method Details
.cabal_yml ⇒ String
Calculates the expected path of the Cabal config file
22 23 24 |
# File 'lib/cabal/cli.rb', line 22 def self.cabal_yml File.(File.join(ENV['HOME'], '.cabal.yml')) end |
.config ⇒ Hash
The global config for the CLI
40 41 42 |
# File 'lib/cabal/cli.rb', line 40 def self.config @config ||= {} end |
.reset ⇒ nil
Clears the global configuration
46 47 48 |
# File 'lib/cabal/cli.rb', line 46 def self.reset @config = {} end |
.setup ⇒ nil
Parses the config file and sets up the global configuration
28 29 30 31 32 33 34 35 36 |
# 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 |