Class: SdocAll::MergeTask
Instance Attribute Summary collapse
-
#doc_path ⇒ Object
readonly
Returns the value of attribute doc_path.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#titles ⇒ Object
readonly
Returns the value of attribute titles.
Instance Method Summary collapse
- #clobber? ⇒ Boolean
- #for_hash ⇒ Object
-
#initialize(options = {}) ⇒ MergeTask
constructor
A new instance of MergeTask.
- #occupied_doc_pathes ⇒ Object
- #parts_path ⇒ Object
- #run(options = {}) ⇒ Object
Methods inherited from BaseTask
#config_hash, #config_hash_path, #created_rid_path, #last_build_time
Constructor Details
#initialize(options = {}) ⇒ MergeTask
Returns a new instance of MergeTask.
108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/sdoc_all/task.rb', line 108 def initialize( = {}) @doc_path = [:doc_path] @title = [:title] @tasks = [:tasks_options].map do || Task.new(.merge( :doc_path => "#{parts_path}/#{task_options[:doc_path]}", :title => "#{title}: #{task_options[:title]}" )) end @titles = [:tasks_options].map do || [:title] end end |
Instance Attribute Details
#doc_path ⇒ Object (readonly)
Returns the value of attribute doc_path.
107 108 109 |
# File 'lib/sdoc_all/task.rb', line 107 def doc_path @doc_path end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
107 108 109 |
# File 'lib/sdoc_all/task.rb', line 107 def tasks @tasks end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
107 108 109 |
# File 'lib/sdoc_all/task.rb', line 107 def title @title end |
#titles ⇒ Object (readonly)
Returns the value of attribute titles.
107 108 109 |
# File 'lib/sdoc_all/task.rb', line 107 def titles @titles end |
Instance Method Details
#clobber? ⇒ Boolean
150 151 152 153 154 |
# File 'lib/sdoc_all/task.rb', line 150 def clobber? return true if super tasks.any?(&:clobber?) end |
#for_hash ⇒ Object
146 147 148 |
# File 'lib/sdoc_all/task.rb', line 146 def for_hash [doc_path.to_s, title, tasks.map(&:config_hash).join(' ')] end |
#occupied_doc_pathes ⇒ Object
156 157 158 |
# File 'lib/sdoc_all/task.rb', line 156 def occupied_doc_pathes [doc_path, parts_path] end |
#parts_path ⇒ Object
122 123 124 |
# File 'lib/sdoc_all/task.rb', line 122 def parts_path "#{doc_path}_parts" end |
#run(options = {}) ⇒ Object
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/sdoc_all/task.rb', line 126 def run( = {}) p clobber? if clobber? Base.remove_if_present(Base.docs_path + doc_path) tasks.each do |task| task.run() end Dir.chdir(Base.docs_path) do cmd = %w(sdoc-merge) cmd << '-o' << Base.docs_path + doc_path cmd << '-t' << title cmd << '-n' << titles.join(',') cmd << '-u' << tasks.map{ |task| "../#{task.doc_path}" }.join(' ') Base.system(*cmd + tasks.map(&:doc_path)) end end end |