Class: Paperwork::Tasks::Document

Inherits:
Base
  • Object
show all
Includes:
Rake::DSL
Defined in:
lib/paperwork/tasks/document.rb

Overview

main task generator for building the document

Instance Attribute Summary collapse

Attributes inherited from Base

#dependencies, #name

Instance Method Summary collapse

Methods inherited from Base

#create_tasks, explain, #register, #registered?, #registered_tasks

Constructor Details

#initialize(name, sources, *dependencies) ⇒ Document

Returns a new instance of Document.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/paperwork/tasks/document.rb', line 18

def initialize(name, sources, *dependencies)
    @dir = Paperwork::Tasks::Template.new(name).dir

    @sources_map = {}
    sources.each do |src|
        dst = get_destination(File.join(self.dir, "source"), src)
        BuildFile.new(dst, src)
        sources_map[src] = dst
        dependencies << dst
    end

    dependencies << RootHelpers.new(@dir, sources.first).name
    super(name, *dependencies)
end

Instance Attribute Details

#dirObject (readonly)

rubocop:disable Metrics/ClassLength



14
15
16
# File 'lib/paperwork/tasks/document.rb', line 14

def dir
  @dir
end

#sources_mapObject (readonly)

rubocop:disable Metrics/ClassLength



14
15
16
# File 'lib/paperwork/tasks/document.rb', line 14

def sources_map
  @sources_map
end

Instance Method Details

#tasksObject



33
34
35
36
# File 'lib/paperwork/tasks/document.rb', line 33

def tasks
    tasks_build
    tasks_nested
end