Class: Boson::BinRunner

Inherits:
BareRunner show all
Extended by:
API
Defined in:
lib/boson/bin_runner.rb

Overview

This class handles the boson executable.

Usage for the boson shell command looks like this:

boson [GLOBAL OPTIONS] [COMMAND] [ARGS] [COMMAND OPTIONS]

The boson executable comes with several global options: :version, :execute, :ruby_debug, :debug, and :load_path.

Defined Under Namespace

Modules: API

Constant Summary

Constants inherited from BareRunner

Boson::BareRunner::DEFAULT_LIBRARIES, Boson::BareRunner::GLOBAL_OPTIONS

Instance Attribute Summary

Attributes included from API

#command

Class Method Summary collapse

Methods included from API

command_name, command_not_found?, default_error_message, early_option?, eval_execute_option, execute_option_or_command, no_method_error_message, print_usage, print_usage_header, verbose

Methods inherited from BareRunner

allowed_argument_error?, execute_command, no_command_error, option_parser

Methods included from Boson::BareRunner::API

#abort_with, #all_libraries, #default_libraries, #init, #start

Class Method Details

.optionsObject

Hash of global options passed in from commandline



110
111
112
# File 'lib/boson/bin_runner.rb', line 110

def self.options
  @options ||= {}
end

.start(args = ARGV) ⇒ Object

Starts, processes and ends a commandline request.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/boson/bin_runner.rb', line 91

def self.start(args=ARGV)
  super
  @command, @options, @args = parse_args(args)

  $:.unshift(*options[:load_path].split(":")) if options[:load_path]
  Boson.debug = true if options[:debug]
  $DEBUG = true if options[:ruby_debug]
  return if early_option?(args)
  Boson.in_shell = true

  init
  execute_option_or_command(@options, @command, @args)
rescue NoMethodError
  abort_with no_method_error_message($!)
rescue
  abort_with default_error_message($!)
end