Class: Paperwork::Tasks::RootHelpers
- Includes:
- Rake::DSL
- Defined in:
- lib/paperwork/tasks/root_helpers.rb
Overview
task generator for root_helpers.rb that will provide url path to the root page
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(dir, root, *dependencies) ⇒ RootHelpers
constructor
A new instance of RootHelpers.
- #tasks ⇒ Object
Methods inherited from Base
#create_tasks, explain, #register, #registered?, #registered_tasks
Constructor Details
#initialize(dir, root, *dependencies) ⇒ RootHelpers
Returns a new instance of RootHelpers.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/paperwork/tasks/root_helpers.rb', line 18 def initialize(dir, root, *dependencies) super( File.join(dir, "lib", "root_helpers.rb"), dir, *dependencies ) Template.new(dir) @root = File.basename(root, ".md") + ".html" end |
Instance Attribute Details
#root ⇒ Object (readonly)
Returns the value of attribute root.
14 15 16 |
# File 'lib/paperwork/tasks/root_helpers.rb', line 14 def root @root end |
Instance Method Details
#tasks ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/paperwork/tasks/root_helpers.rb', line 29 def tasks file self.name => self.dependencies do File.write( name, <<~ROOT_HELPERS module RootHelpers def root_path relative_link "#{self.root}" end def custom_css ["#{Paperwork::Config[:custom_css].join("\", \"")}"] end def custom_js ["#{Paperwork::Config[:custom_js].join("\", \"")}"] end end ROOT_HELPERS ) end end |