lib/brief/briefcase.rb in brief-1.14.2 vs lib/brief/briefcase.rb in brief-1.14.3
- old
+ new
@@ -23,12 +23,23 @@
@href_builder = options.fetch(:href_builder) { Brief.href_builder }
@asset_finder = options.fetch(:asset_finder) { method(:find_asset) }
Brief.cases[root.basename.to_s] ||= self
+
+ load_lib_entries()
end
+ def load_lib_entries
+ begin
+ etc = Dir[briefcase_lib_path.join("**/*.rb")]
+ etc.each {|f| require(f) } if briefcase_lib_path.exist?
+ rescue
+
+ end
+ end
+
# Runs a command
#
# Commands are defined in the briefcase configuration.
#
# You define a command by passing a block. This block will
@@ -41,10 +52,15 @@
else
raise 'Command not found'
end
end
+ # runs a command but does not raise an error
+ def run_command!(name, *args)
+ run_command(name, *args) rescue nil
+ end
+
# Returns a Hash object which presents some
# view of the briefcase. Accepts a params hash
# of options that will be passed to the presenter.
#
# The default presenter is Brief::Briefcase#as_default
@@ -89,11 +105,12 @@
root: root.to_s,
paths:{
docs_path: docs_path.to_s,
assets_path: assets_path.to_s,
models_path: models_path.to_s,
- data_path: data_path.to_s
+ data_path: data_path.to_s,
+ lib_path: briefcase_lib_path.to_s
}
}
end
def get_href_for(brief_uri)
@@ -271,9 +288,13 @@
root.join(options.fetch(:docs_path) { config.docs_path }).expand_path
end
def data_path
root.join(options.fetch(:data_path) { config.data_path }).expand_path
+ end
+
+ def briefcase_lib_path
+ root.join(options.fetch(:lib_path) { config.lib_path }).expand_path
end
def assets_trail
@assets_trail ||= Hike::Trail.new(assets_path).tap do |trail|
trail.append_extensions '.svg', '.png', '.pdf', '.jpg', '.gif', '.mov'