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, #run_if_clobber
Constructor Details
#initialize(options = {}) ⇒ MergeTask
Returns a new instance of MergeTask.
118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/sdoc_all/task.rb', line 118 def initialize( = {}) @doc_path = [:doc_path] @title = [:title] @tasks = [:tasks_options].map do || Task.new(.merge( :doc_path => "#{parts_path}/#{[:doc_path]}", :title => "#{title}: #{[:title]}" )) end @titles = [:tasks_options].map do || [:title] end end |
Instance Attribute Details
#doc_path ⇒ Object (readonly)
Returns the value of attribute doc_path.
117 118 119 |
# File 'lib/sdoc_all/task.rb', line 117 def doc_path @doc_path end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
117 118 119 |
# File 'lib/sdoc_all/task.rb', line 117 def tasks @tasks end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
117 118 119 |
# File 'lib/sdoc_all/task.rb', line 117 def title @title end |
#titles ⇒ Object (readonly)
Returns the value of attribute titles.
117 118 119 |
# File 'lib/sdoc_all/task.rb', line 117 def titles @titles end |
Instance Method Details
#clobber? ⇒ Boolean
159 160 161 162 163 |
# File 'lib/sdoc_all/task.rb', line 159 def clobber? return true if super tasks.any?(&:clobber?) end |
#for_hash ⇒ Object
155 156 157 |
# File 'lib/sdoc_all/task.rb', line 155 def for_hash [doc_path.to_s, title, tasks.map(&:for_hash)] end |
#occupied_doc_pathes ⇒ Object
165 166 167 |
# File 'lib/sdoc_all/task.rb', line 165 def occupied_doc_pathes [doc_path, parts_path] end |
#parts_path ⇒ Object
132 133 134 |
# File 'lib/sdoc_all/task.rb', line 132 def parts_path "#{doc_path}_parts" end |
#run(options = {}) ⇒ Object
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/sdoc_all/task.rb', line 136 def run( = {}) run_if_clobber do tasks.each do |task| Progress.start(task.title) do task.run() end end Base.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 |