Top Level Namespace
Defined Under Namespace
Modules: CodeObject, Configs, Document, Dom, Generator, Helper, Logger, Parser, Processor, Token Classes: Renderer, String, StringScanner, Thor
Instance Method Summary collapse
- #load_templates(template_path = nil) ⇒ Object
-
#setup_application(options = {}) ⇒ Object
‘#setup_application` is called during the initialization process of DocJs within DocJs#docjs.
Instance Method Details
#load_templates(template_path = nil) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/boot.rb', line 48 def load_templates(template_path = nil) if template_path.nil? and Configs.templates template_path = Configs.templates elsif template_path.nil? template_path =( Configs.root + 'templates').to_path else template_path = File.absolute_path(template_path) end require template_path + '/application.rb' end |
#setup_application(options = {}) ⇒ Object
‘#setup_application` is called during the initialization process of DocJs within DocJs#docjs
![Boot Activity Diagram](img/md_boot.svg)
It is responsible to configure the two application-wide Singleton Objects Logger and Configs and fill Configs with the given commandline arguments.
If the user is using it’s own custom templates (see CUSTOMIZE) those templates will be included before the processing can begin.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/boot.rb', line 23 def setup_application( = {}) # Initialize Logger Logger.setup :logfile => ([:logfile] && File.([:logfile], Dir.pwd)), :level => ([:loglevel] || :info).to_sym Logger.info "Setting up Application" # Process option-values and store them in our Configs-object Configs.set :options => , # Just store the options for now # Set the paths :wdir => Dir.pwd, # The current working directory :output => File.absolute_path([:output]), :templates => File.absolute_path([:templates]), :files => ([:files] && [:files].map {|path| Dir.glob(path) }.flatten), :docs => ([:docs] && [:docs].map {|path| Dir.glob(path) }.flatten) Logger.debug "Given options: #{}" Logger.debug "App Root: #{Configs.root}" Logger.debug "Working Dir: #{Configs.wdir}" Logger.debug "Output Dir: #{Configs.output}" Logger.debug "Template Dir: #{Configs.templates}" end |