Class: Boson::Runner
- Inherits:
-
Object
- Object
- Boson::Runner
- Defined in:
- lib/boson/runner.rb
Overview
Base class for runners.
Direct Known Subclasses
Class Attribute Summary collapse
-
.debug ⇒ Object
Returns the value of attribute debug.
Class Method Summary collapse
- .add_load_path ⇒ Object
-
.all_libraries ⇒ Object
Libraries specified in config files and detected_libraries.
- .autoload_command(cmd, opts = {:verbose=>verbose?}) ⇒ Object
-
.default_libraries ⇒ Object
Libraries that come with Boson.
- .define_autoloader ⇒ Object
-
.detected_libraries ⇒ Object
Libraries detected in repositories.
- .in_shell=(val) ⇒ Object
-
.in_shell? ⇒ Boolean
Returns true if commands are being executed from a non-ruby shell i.e.
-
.init ⇒ Object
Enables view, adds local load path and loads default_libraries.
- .load_options ⇒ Object
-
.verbose=(val) ⇒ Object
:stopdoc:.
-
.verbose? ⇒ Boolean
Returns true if in commandline with verbose flag or if set explicitly.
Class Attribute Details
.debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/boson/runner.rb', line 5 def debug @debug end |
Class Method Details
.add_load_path ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/boson/runner.rb', line 49 def add_load_path Boson.repos.each {|repo| if repo.config[:add_load_path] || File.exists?(File.join(repo.dir, 'lib')) $: << File.join(repo.dir, 'lib') unless $:.include? File.(File.join(repo.dir, 'lib')) end } end |
.all_libraries ⇒ Object
Libraries specified in config files and detected_libraries
25 26 27 |
# File 'lib/boson/runner.rb', line 25 def all_libraries Boson.repos.map {|e| e.all_libraries }.flatten.uniq end |
.autoload_command(cmd, opts = {:verbose=>verbose?}) ⇒ Object
61 62 63 64 65 |
# File 'lib/boson/runner.rb', line 61 def autoload_command(cmd, opts={:verbose=>verbose?}) Index.read (lib = Index.find_library(cmd)) && Manager.load(lib, opts) lib end |
.default_libraries ⇒ Object
Libraries that come with Boson
15 16 17 |
# File 'lib/boson/runner.rb', line 15 def default_libraries Boson.repos.map {|e| e.config[:defaults] || [] }.flatten + [Boson::Commands::Core, Boson::Commands::WebCore] end |
.define_autoloader ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/boson/runner.rb', line 67 def define_autoloader class << ::Boson.main_object def method_missing(method, *args, &block) if Runner.autoload_command(method.to_s) send(method, *args, &block) if respond_to?(method) else super end end end end |
.detected_libraries ⇒ Object
Libraries detected in repositories
20 21 22 |
# File 'lib/boson/runner.rb', line 20 def detected_libraries Boson.repos.map {|e| e.detected_libraries }.flatten.uniq end |
.in_shell=(val) ⇒ Object
45 46 47 |
# File 'lib/boson/runner.rb', line 45 def in_shell=(val) @in_shell = val end |
.in_shell? ⇒ Boolean
Returns true if commands are being executed from a non-ruby shell i.e. bash. Returns false if in a ruby shell i.e. irb.
31 32 33 |
# File 'lib/boson/runner.rb', line 31 def in_shell? !!@in_shell end |
.init ⇒ Object
Enables view, adds local load path and loads default_libraries
8 9 10 11 12 |
# File 'lib/boson/runner.rb', line 8 def init View.enable add_load_path Manager.load default_libraries, end |
.load_options ⇒ Object
57 58 59 |
# File 'lib/boson/runner.rb', line 57 def {:verbose=>@options[:verbose]} end |
.verbose=(val) ⇒ Object
:stopdoc:
41 42 43 |
# File 'lib/boson/runner.rb', line 41 def verbose=(val) @verbose = val end |