class Paperwork::Tasks::RootHelpers

task generator for root_helpers.rb that will provide url path to the root page

Attributes

root[R]

Public Class Methods

new(dir, root, *dependencies) click to toggle source
Calls superclass method Paperwork::Tasks::Base::new
# 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

Public Instance Methods

tasks() click to toggle source
# 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