Module: GemMirror::CLI
- Defined in:
- lib/gem_mirror/cli.rb
Overview
Namespace for classes and modules that handle the command line interface
Constant Summary collapse
- SLOP_OPTIONS =
Hash containing the default Slop options.
{ strict: true, banner: "Usage: gem_mirror [COMMAND] [OPTIONS]" }.freeze
Class Method Summary collapse
- .default_options ⇒ Slop
-
.load_configuration(config_file) ⇒ GemMirror::Configuration
Loads the specified configuration file or displays an error if it doesn’t exist.
- .options ⇒ Slop
-
.version_information ⇒ String
Returns a String containing some platform/version related information.
Class Method Details
.default_options ⇒ Slop
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/gem_mirror/cli.rb', line 43 def self. Slop.new(SLOP_OPTIONS.dup) do separator "\nOptions:\n" on :h, :help, "Shows this help message" do puts self exit end on :v, :version, "Shows the current version" do puts CLI.version_information end end end |
.load_configuration(config_file) ⇒ GemMirror::Configuration
Loads the specified configuration file or displays an error if it doesn’t exist.
31 32 33 34 35 36 37 38 |
# File 'lib/gem_mirror/cli.rb', line 31 def self.load_configuration(config_file) config_file ||= Configuration.default_configuration_file config_file = File.(config_file, Dir.pwd) abort "The configuration file #{config_file} does not exist" unless File.file?(config_file) require(config_file) end |
.options ⇒ Slop
20 21 22 |
# File 'lib/gem_mirror/cli.rb', line 20 def self. @options ||= end |