lib/boson/manager.rb in boson-0.0.1 vs lib/boson/manager.rb in boson-0.1.0
- old
+ new
@@ -2,10 +2,11 @@
# Base class for library loading errors. Raised mostly in Boson::Loader and rescued by Boson::Manager.
class LoaderError < StandardError; end
# Raised when a library's append_features returns false.
class AppendFeaturesFalseError < StandardError; end
+ # Handles loading and reloading of libraries and commands.
class Manager
class <<self
# Loads a library or an array of libraries with options. Manager loads the first library subclass
# to meet a library subclass' criteria in this order: ModuleLibrary, FileLibrary, GemLibrary, RequireLibrary.
# ==== Examples:
@@ -60,11 +61,11 @@
FileLibrary.reset_file_cache(library.to_s)
print_error_message "Unable to #{load_method} library #{library}. Reason: #{e.message}"
rescue Exception=>e
FileLibrary.reset_file_cache(library.to_s)
print_error_message "Unable to #{load_method} library #{library}. Reason: #{$!}" + "\n" +
- e.backtrace.slice(0,3).join("\n")
+ e.backtrace.slice(0,3).map {|e| " " + e }.join("\n")
ensure
Inspector.disable if Inspector.enabled
end
def print_error_message(message)
@@ -101,10 +102,10 @@
end.compact
end
def loader_create(source)
lib_class = Library.handle_blocks.find {|k,v| v.call(source) } or raise(LoaderError, "Library #{source} not found.")
- lib_class[0].new(:name=>source, :index=>@options[:index])
+ lib_class[0].new(@options.merge(:name=>source))
end
def after_load
create_commands(@library)
add_library(@library)
\ No newline at end of file