lib/dev_flow/roadmap.rb in dev_flow-0.6.1 vs lib/dev_flow/roadmap.rb in dev_flow-0.6.2
- old
+ new
@@ -1,7 +1,7 @@
module DevFlow
- # a road map represents a list of tasks
+ ## a road map represents a list of tasks
class RoadMap
attr_accessor :file, :config, :tasks,
:branch_tasks, # branch name to task hash
:ln_tasks, # line number to task hash, used for rewrite
:top_tasks # level 1 task list (used for id calculation)
@@ -15,11 +15,11 @@
end
def last_task
@tasks.last
end
-
+
def title
@config["title"]
end
def team_member_names
@@ -40,19 +40,19 @@
fh.each do |line|
if /^\%\s*\-\-\-+/ =~ line
in_header += 1
next
end
-
+
# before any task defined, parse line begin with % as head field:
if in_header == 1 and @tasks.size == 0
head_part += line
end
if /^\s*\[(?<plus_>[\+\s]+)\]\s(?<contents_>.+)/ =~ line
if @tasks.size == 0 and head_part.size > 0
- hhash = YAML.load(head_part)
+ hhash = YAML.load(head_part)
members = @config["members"] || {}
members.merge!(hhash["members"]) if hhash["members"] and hhash["members"].is_a?(Hash)
@config = @config.merge hhash
@config["members"] = members
end
@@ -117,10 +117,10 @@
if progress == 100
com_date = DateTime.now.strftime("%Y/%m/%d")
com_date = DateTime.now.strftime("%m/%d") if DateTime.now.year == @config["year"]
progress = com_date
end
-
+
new_line = line
if /(?<resource_>\@[a-z\@\;]+)(\:[PD\d\/]+)?/ =~ line
new_line.gsub!(/(?<resource_>\@[a-z\@\;]+)(\:[PD\d\/]+)?/, resource_ + ":" + progress.to_s)
elsif /(?<dep_>\-\>.+)$/ =~ line
new_line.gsub!(/\s*\-\>.+$/, '@' + self.config["leader"] + ":" + progress.to_s + " " + dep_)