lib/boson/runners/console_runner.rb in boson-0.3.2 vs lib/boson/runners/console_runner.rb in boson-0.3.3
- old
+ new
@@ -6,11 +6,13 @@
class <<self
# Starts Boson by loading configured libraries. If no default libraries are specified in the config,
# it will load up all detected libraries. Options:
# [:libraries] Array of libraries to load.
# [:verbose] Boolean to be verbose about libraries loading. Default is true.
- # [:no_defaults] Boolean which turns off loading any default libraries. Default is false.
+ # [:no_defaults] Boolean or :all which turns off loading default libraries. If set to true,
+ # effects loading user's console default libraries. If set to :all, effects
+ # all libraries including boson's. Default is false.
# [:autoload_libraries] Boolean which makes any command execution easier. It redefines
# method_missing on Boson.main_object so that commands with unloaded
# libraries are automatically loaded. Default is false.
def start(options={})
@options = {:verbose=>true}.merge options
@@ -42,18 +44,15 @@
define_autoloader if @options[:autoload_libraries]
@initialized = true
end
def default_libraries #:nodoc:
- defaults = super
- unless @options[:no_defaults]
- new_defaults = Boson.repos.map {|e| e.config[:console_defaults] }.flatten
- new_defaults = detected_libraries if new_defaults.empty?
- defaults += new_defaults
- defaults.uniq!
- end
- defaults
+ return [] if @options[:no_defaults] == :all
+ return super if @options[:no_defaults]
+ defaults = super + Boson.repos.map {|e| e.config[:console_defaults] }.flatten
+ defaults += detected_libraries if defaults.empty?
+ defaults.uniq
end
end
end
end
-
\ No newline at end of file
+