Module: Boson
- Extended by:
- Boson
- Included in:
- Boson
- Defined in:
- lib/boson.rb,
lib/boson/pipe.rb,
lib/boson/repo.rb,
lib/boson/util.rb,
lib/boson/view.rb,
lib/boson/index.rb,
lib/boson/pipes.rb,
lib/boson/loader.rb,
lib/boson/runner.rb,
lib/boson/command.rb,
lib/boson/library.rb,
lib/boson/manager.rb,
lib/boson/options.rb,
lib/boson/version.rb,
lib/boson/inspector.rb,
lib/boson/namespace.rb,
lib/boson/scientist.rb,
lib/boson/repo_index.rb,
lib/boson/option_parser.rb,
lib/boson/option_command.rb,
lib/boson/runners/bin_runner.rb,
lib/boson/libraries/gem_library.rb,
lib/boson/libraries/file_library.rb,
lib/boson/runners/console_runner.rb,
lib/boson/libraries/module_library.rb,
lib/boson/inspectors/method_inspector.rb,
lib/boson/inspectors/comment_inspector.rb
Overview
This module stores the libraries, commands, repos and main object used throughout Boson.
Useful documentation links:
-
Boson::BinRunner - Runs the boson executable
-
Boson::ConsoleRunner - Runs Boson from the ruby console
-
Boson::Repo.config - Explains main config file
-
Boson::Library - All about libraries
-
Boson::FileLibrary - Explains creating libraries as files
-
Boson::Loader - Explains library module callbacks
-
Boson::OptionParser - All about options
Defined Under Namespace
Modules: ArgumentInspector, Commands, CommentInspector, Index, Inspector, Loader, MethodInspector, Options, Pipe, Pipes, Scientist, Universe, Util, View Classes: AppendFeaturesFalseError, BinRunner, Command, ConsoleRunner, FileLibrary, GemLibrary, IndifferentAccessHash, Library, LoaderError, LocalFileLibrary, Manager, MethodConflictError, ModuleLibrary, Namespace, OptionCommand, OptionParser, Repo, RepoIndex, RequireLibrary, Runner
Constant Summary collapse
- NAMESPACE =
Delimits namespace from command
'.'- VERSION =
'0.304.1'
Instance Attribute Summary collapse
-
#commands ⇒ Object
Array of loaded Boson::Command objects.
-
#libraries ⇒ Object
Array of loaded Boson::Library objects.
-
#main_object ⇒ Object
(also: #higgs)
The object which holds and executes all command functionality.
Instance Method Summary collapse
-
#can_invoke?(meth, priv = true) ⇒ Boolean
Boolean indicating if the main object can invoke the given method/command.
-
#full_invoke(cmd, args) ⇒ Object
Invoke command string even with namespaces.
-
#global_repo ⇒ Object
Optional global repository at /etc/boson.
-
#invoke(*args, &block) ⇒ Object
Invoke an action on the main object.
-
#library(query, attribute = 'name') ⇒ Object
:nodoc:.
-
#local_repo ⇒ Object
An optional local repository which defaults to ./lib/boson or ./.boson.
-
#repo ⇒ Object
The main required repository which defaults to ~/.boson.
-
#repos ⇒ Object
The array of loaded repositories containing the main repo and possible local and global repos.
-
#start(options = {}) ⇒ Object
Start Boson by loading repositories and their configured libraries.
Instance Attribute Details
#commands ⇒ Object
Array of loaded Boson::Command objects.
35 36 37 |
# File 'lib/boson.rb', line 35 def commands @commands end |
#libraries ⇒ Object
Array of loaded Boson::Library objects.
30 31 32 |
# File 'lib/boson.rb', line 30 def libraries @libraries end |
#main_object ⇒ Object Also known as: higgs
The object which holds and executes all command functionality
25 26 27 |
# File 'lib/boson.rb', line 25 def main_object @main_object end |
Instance Method Details
#can_invoke?(meth, priv = true) ⇒ Boolean
Boolean indicating if the main object can invoke the given method/command.
91 92 93 |
# File 'lib/boson.rb', line 91 def can_invoke?(meth, priv=true) Boson.main_object.respond_to? meth, priv end |
#full_invoke(cmd, args) ⇒ Object
Invoke command string even with namespaces
84 85 86 87 88 |
# File 'lib/boson.rb', line 84 def full_invoke(cmd, args) #:nodoc: command, subcommand = cmd.include?(NAMESPACE) ? cmd.split(NAMESPACE, 2) : [cmd, nil] dispatcher = subcommand ? Boson.invoke(command) : Boson.main_object dispatcher.send(subcommand || command, *args) end |
#global_repo ⇒ Object
Optional global repository at /etc/boson
60 61 62 |
# File 'lib/boson.rb', line 60 def global_repo File.exists?('/etc/boson') ? Repo.new('/etc/boson') : nil end |
#invoke(*args, &block) ⇒ Object
Invoke an action on the main object.
79 80 81 |
# File 'lib/boson.rb', line 79 def invoke(*args, &block) main_object.send(*args, &block) end |
#library(query, attribute = 'name') ⇒ Object
:nodoc:
68 69 70 |
# File 'lib/boson.rb', line 68 def library(query, attribute='name') #:nodoc: libraries.find {|e| e.send(attribute) == query } end |
#local_repo ⇒ Object
An optional local repository which defaults to ./lib/boson or ./.boson.
45 46 47 48 49 50 51 52 |
# File 'lib/boson.rb', line 45 def local_repo @local_repo ||= begin ignored_dirs = (repo.config[:ignore_directories] || []).map {|e| File.(e) } dir = ["lib/boson", ".boson"].find {|e| File.directory?(e) && File.(e) != repo.dir && !ignored_dirs.include?(File.('.')) } Repo.new(dir) if dir end end |
#repo ⇒ Object
The main required repository which defaults to ~/.boson.
40 41 42 |
# File 'lib/boson.rb', line 40 def repo @repo ||= Repo.new("#{Util.find_home}/.boson") end |
#repos ⇒ Object
The array of loaded repositories containing the main repo and possible local and global repos
55 56 57 |
# File 'lib/boson.rb', line 55 def repos @repos ||= [repo, local_repo, global_repo].compact end |
#start(options = {}) ⇒ Object
Start Boson by loading repositories and their configured libraries. See ConsoleRunner.start for its options.
74 75 76 |
# File 'lib/boson.rb', line 74 def start(={}) ConsoleRunner.start() end |