saga 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.1
1
+ 0.10.0
@@ -12,14 +12,29 @@ module Saga
12
12
  @definitions = ActiveSupport::OrderedHash.new
13
13
  end
14
14
 
15
- def stories_as_flat_list
15
+ def copy_story(story)
16
+ copied = {}
17
+ [:id, :iteration, :status, :estimate, :description].each do |attribute|
18
+ copied[attribute] = story[attribute] if story[attribute]
19
+ end; copied
20
+ end
21
+
22
+ def flatten_stories(stories)
16
23
  stories_as_flat_list = []
17
- stories.values.flatten.each do |story|
18
- stories_as_flat_list << story
19
- stories_as_flat_list.concat(story[:stories]) if story[:stories]
24
+ stories.flatten.each do |story|
25
+ if story[:stories]
26
+ stories_as_flat_list << copy_story(story)
27
+ stories_as_flat_list.concat(story[:stories])
28
+ else
29
+ stories_as_flat_list << story
30
+ end
20
31
  end; stories_as_flat_list
21
32
  end
22
33
 
34
+ def stories_as_flat_list
35
+ flatten_stories(stories.values)
36
+ end
37
+
23
38
  def _binding
24
39
  binding
25
40
  end
@@ -53,10 +68,19 @@ module Saga
53
68
  length == 0
54
69
  end
55
70
 
71
+ def _autofill_ids(stories, unused_ids)
72
+ stories.each do |story|
73
+ story[:id] ||= unused_ids.shift
74
+ if story[:stories]
75
+ _autofill_ids(story[:stories], unused_ids)
76
+ end
77
+ end
78
+ end
79
+
56
80
  def autofill_ids
57
81
  unused_ids = unused_ids(length - used_ids.length)
58
- stories_as_flat_list.each do |story|
59
- story[:id] ||= unused_ids.shift
82
+ stories.each do |section, data|
83
+ _autofill_ids(data, unused_ids)
60
84
  end
61
85
  end
62
86
  end
@@ -35,6 +35,16 @@ module Saga
35
35
  unestimated
36
36
  end
37
37
 
38
+ def range_estimated
39
+ range_estimated = 0
40
+ @document.stories_as_flat_list.each do |story|
41
+ if story[:estimate] && story[:estimate][1] == :range
42
+ range_estimated += 1
43
+ end
44
+ end
45
+ range_estimated
46
+ end
47
+
38
48
  def statusses
39
49
  statusses = {}
40
50
  @document.stories_as_flat_list.each do |story|
@@ -61,6 +71,7 @@ module Saga
61
71
  if unestimated > 0 or !statusses.empty?
62
72
  parts << ''
63
73
  parts << self.class.format_unestimated(unestimated) if unestimated > 0
74
+ parts << self.class.format_range_estimated(range_estimated) if range_estimated > 0
64
75
  parts << self.class.format_statusses(statusses) unless statusses.empty?
65
76
  end
66
77
  parts.shift if parts[0] == ''
@@ -76,6 +87,8 @@ module Saga
76
87
  estimate[0] * 8
77
88
  when :weeks
78
89
  estimate[0] * 40
90
+ when :range
91
+ 0
79
92
  else
80
93
  estimate[0]
81
94
  end
@@ -87,12 +100,20 @@ module Saga
87
100
  else
88
101
  label = 'Total'
89
102
  end
90
- story_column = (properties[:story_count] == 1) ? "#{properties[:story_count]} story" : "#{properties[:story_count]} stories"
103
+ story_column = format_stories_count(properties[:story_count])
91
104
  "#{label.ljust(FIRST_COLUMN_WIDTH)}: #{properties[:estimate_total_in_hours]} (#{story_column})"
92
105
  end
93
106
 
94
107
  def self.format_unestimated(unestimated)
95
- "Unestimated : #{unestimated > 1 ? "#{unestimated} stories" : 'one story' }"
108
+ "Unestimated : #{format_stories_count(unestimated)}"
109
+ end
110
+
111
+ def self.format_range_estimated(range_estimated)
112
+ "Range-estimate: #{format_stories_count(range_estimated)}"
113
+ end
114
+
115
+ def self.format_stories_count(count)
116
+ count > 1 ? "#{count} stories" : 'one story'
96
117
  end
97
118
 
98
119
  def self.format_statusses(statusses)
@@ -49,6 +49,10 @@ module Saga
49
49
  end
50
50
  end
51
51
 
52
+ RE_STORY_NUMBER = /\#(\d+)/
53
+ RE_STORY_ITERATION = /i(\d+)/
54
+ RE_STORY_ESTIMATE_PART = /(\d+)(d|w|h|)/
55
+
52
56
  def self.tokenize_story_attributes(input)
53
57
  return {} if input.nil?
54
58
 
@@ -59,11 +63,14 @@ module Saga
59
63
  parts.each do |part|
60
64
  if part.strip == ''
61
65
  next
62
- elsif match = /\#(\d+)/.match(part)
66
+ elsif match = RE_STORY_NUMBER.match(part)
63
67
  attributes[:id] = match[1].to_i
64
- elsif match = /i(\d+)/.match(part)
68
+ elsif match = RE_STORY_ITERATION.match(part)
65
69
  attributes[:iteration] = match[1].to_i
66
- elsif match = /(\d+)(d|w|h|)/.match(part)
70
+ elsif match = /#{RE_STORY_ESTIMATE_PART}-#{RE_STORY_ESTIMATE_PART}/.match(part)
71
+ estimate = "#{match[1,2].join}-#{match[3,2].join}"
72
+ attributes[:estimate] = [estimate, :range]
73
+ elsif match = RE_STORY_ESTIMATE_PART.match(part)
67
74
  attributes[:estimate] = [match[1].to_i, interval(match[2])]
68
75
  else
69
76
  rest << part
metadata CHANGED
@@ -1,90 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: saga
3
- version: !ruby/object:Gem::Version
4
- hash: 57
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 1
10
- version: 0.9.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Manfred Stienstra
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-07-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: erubis
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70121805102580 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 15
29
- segments:
30
- - 2
31
- - 6
32
- version: "2.6"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '2.6'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: activesupport
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70121805102580
25
+ - !ruby/object:Gem::Dependency
26
+ name: activesupport
27
+ requirement: &70121805101940 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 2
46
- - 3
47
- version: "2.3"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '2.3'
48
33
  type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: bacon
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70121805101940
36
+ - !ruby/object:Gem::Dependency
37
+ name: bacon
38
+ requirement: &70121805101480 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
62
44
  type: :development
63
- version_requirements: *id003
64
- - !ruby/object:Gem::Dependency
65
- name: mocha-on-bacon
66
45
  prerelease: false
67
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70121805101480
47
+ - !ruby/object:Gem::Dependency
48
+ name: mocha-on-bacon
49
+ requirement: &70121805100960 !ruby/object:Gem::Requirement
68
50
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
- - 0
75
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
76
55
  type: :development
77
- version_requirements: *id004
56
+ prerelease: false
57
+ version_requirements: *70121805100960
78
58
  description: Saga is a tool to convert stories syntax to a nicely formatted document.
79
59
  email: manfred@fngtps.com
80
- executables:
60
+ executables:
81
61
  - saga
82
62
  extensions: []
83
-
84
- extra_rdoc_files:
63
+ extra_rdoc_files:
85
64
  - LICENSE
86
65
  - README.rdoc
87
- files:
66
+ files:
88
67
  - LICENSE
89
68
  - README.rdoc
90
69
  - Rakefile
@@ -104,36 +83,26 @@ files:
104
83
  - bin/saga
105
84
  homepage:
106
85
  licenses: []
107
-
108
86
  post_install_message:
109
87
  rdoc_options: []
110
-
111
- require_paths:
88
+ require_paths:
112
89
  - lib
113
- required_ruby_version: !ruby/object:Gem::Requirement
90
+ required_ruby_version: !ruby/object:Gem::Requirement
114
91
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
- version: "0"
122
- required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
97
  none: false
124
- requirements:
125
- - - ">="
126
- - !ruby/object:Gem::Version
127
- hash: 3
128
- segments:
129
- - 0
130
- version: "0"
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
131
102
  requirements: []
132
-
133
103
  rubyforge_project:
134
- rubygems_version: 1.8.18
104
+ rubygems_version: 1.8.11
135
105
  signing_key:
136
106
  specification_version: 3
137
107
  summary: Saga is a tool to convert stories syntax to a nicely formatted document.
138
108
  test_files: []
139
-