saga 0.12.1 → 0.12.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d18e2c22c8c89b35a6084f86bb148829c1576bacf4e5546934cd55e0806462ba
4
- data.tar.gz: ec2706d977d2f83765aaea6ceb9bb3093ec0716313f3bfca2e5b6795ca1ee7d6
3
+ metadata.gz: 6b03eae8f29e0063947c22d3bc4a13560c53261568d7a708c4dbeaeef6bb26b3
4
+ data.tar.gz: 219bd772b93ee7311859b97b4af056649f17db729a581bfac4a007b53aad182c
5
5
  SHA512:
6
- metadata.gz: 440813c32f4605c53bf4f9dfcaa69f921675555ba908496ccc090dc17b66cc27607f13828804e2b6a49aeb72347c2445457a9150d2afbdfd09cb6e057a17fced
7
- data.tar.gz: 584700270816924160bbaf8ce873ce954774093fccdaa80b1c2dc4516ce106306316d132580e6cc5d46cd6c94c37166e36cc3110a77743695309e977bb30e34a
6
+ metadata.gz: cb93fea044cf3dade2ad640d28e33762c79d08cd37963fa82eff4a47c9da1fb4302d4216d962881c446ac8a7fe40e01f850b28ffaf07dcc8c38217b8308c4ae5
7
+ data.tar.gz: 943c9205ced09c32ecadff5113e86bdae93a01513da578cd0809cd38c11eb643534744fa5ead5874c873b9f4bc4b286a248f7b1645336b244575790f0605c8cb
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Saga
4
- VERSION = '0.12.1'.freeze
4
+ VERSION = '0.12.2'.freeze
5
5
  end
@@ -0,0 +1,79 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Requirements <%= title %></title>
6
+ <link rel="stylesheet" type="text/css" media="all" href="http://resources.fngtps.com/2019/doc.css" />
7
+ </head>
8
+ <body id="doc" class="requirements">
9
+ <h1>Requirements<br><%= title %></h1>
10
+
11
+ <% authors.each do |author| %>
12
+ <p class="author"><%= format_author(author) %></p>
13
+ <% end %>
14
+
15
+ <% introduction.each do |paragraph| %>
16
+ <p><%=h paragraph %></p>
17
+ <% end %>
18
+
19
+ <% unless stories.empty? %>
20
+ <h2>User stories</h2>
21
+ <% stories.each do |header, stories| %>
22
+ <% unless header.strip == '' %>
23
+ <h3><%=h header %></h3>
24
+ <% end %>
25
+ <table class="review">
26
+ <tr>
27
+ <th></th>
28
+ <th title="id">#</th>
29
+ <th title="Estimate">e</th>
30
+ <th title="Iteration">i</th>
31
+ <th title="Status">s</th>
32
+ </tr>
33
+ <% stories.each do |story| %>
34
+ <tr class="<%= story[:status] %>" id="story<%= story[:id] %>">
35
+ <td class="story"><%=h story[:description] %></td>
36
+ <td class="meta id"><%=h story[:id] %></td>
37
+ <td class="meta estimate"><%= format_estimate(*story[:estimate]) if story[:estimate] %></td>
38
+ <td class="meta iteration"><%=h story[:iteration] %></td>
39
+ <td class="meta status"><%=h story[:status] %></td>
40
+ </tr>
41
+ <% if story[:notes] %>
42
+ <tr class="<%= story[:status] %>">
43
+ <td class="notes" colspan="5"><%=h story[:notes] %></td>
44
+ </tr>
45
+ <% end %>
46
+ <% if story[:stories] %>
47
+ <% story[:stories].each do |nested| %>
48
+ <tr class="nested <%= nested[:status] %>" id="story<%= nested[:id] %>">
49
+ <td class="story"><%=h nested[:description] %></td>
50
+ <td class="meta id"><%=h nested[:id] %></td>
51
+ <td class="meta estimate"><%= format_estimate(*nested[:estimate]) if nested[:estimate] %></td>
52
+ <td class="meta iteration"><%=h nested[:iteration] %></td>
53
+ <td class="meta status"><%=h nested[:status] %></td>
54
+ </tr>
55
+ <% if nested[:notes] %>
56
+ <tr class="nested <%= nested[:status] %>">
57
+ <td class="notes" colspan="5"><%=h nested[:notes] %></td>
58
+ </tr>
59
+ <% end %>
60
+ <% end %>
61
+ <% end %>
62
+ <% end %>
63
+ </table>
64
+ <% end %>
65
+ <% end %>
66
+
67
+ <% definitions.each do |header, definitions| %>
68
+ <% unless header.strip == '' %>
69
+ <h2><%= format_header(header) %></h2>
70
+ <% end %>
71
+ <dl>
72
+ <% definitions.each do |definition| %>
73
+ <dt><%=h definition[:title] %></dt>
74
+ <dd><%=h definition[:definition] %></dd>
75
+ <% end %>
76
+ </dl>
77
+ <% end %>
78
+ </body>
79
+ </html>
@@ -0,0 +1,30 @@
1
+ def format_author(author)
2
+ parts = []
3
+ parts << author[:name] if author[:name]
4
+ parts << "<a href=\"mailto:#{author[:email]}\">#{author[:email]}</a>" if author[:email]
5
+ if author[:website] && author[:company]
6
+ parts << "<a href=\"#{author[:website]}\">#{author[:company]}</a>"
7
+ elsif author[:company]
8
+ parts << author[:company]
9
+ end
10
+ parts.join(', ')
11
+ end
12
+
13
+ def format_header(header)
14
+ "#{header[0, 1].upcase}#{header[1..-1].downcase}"
15
+ end
16
+
17
+ def pluralize(cardinality, singular, plural)
18
+ [cardinality, cardinality == 1 ? singular : plural].join(' ')
19
+ end
20
+
21
+ def format_estimate(cardinality, interval)
22
+ case interval
23
+ when :days
24
+ pluralize(cardinality, 'day', 'days')
25
+ when :weeks
26
+ pluralize(cardinality, 'week', 'days')
27
+ else
28
+ cardinality.to_s
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ Requirements <%= title %>
2
+
3
+ - <%= author %>
4
+
5
+ USER STORIES
6
+
7
+ As a developer I would like to write stories so I know what to develop. - #1 todo
@@ -0,0 +1,28 @@
1
+ Requirements <%= title %>
2
+ <% unless authors.empty? %>
3
+ <% authors.each do |author| -%>
4
+ - <%= format_author(author) %>
5
+ <% end -%>
6
+ <% end -%>
7
+ <% introduction.each do |paragraph| %>
8
+ <%= paragraph %>
9
+ <% end %>
10
+ USER STORIES
11
+ <% stories.each do |header, stories| -%>
12
+ <% if header.strip == '' %>
13
+ <% else -%>
14
+ <%= "\n#{header}\n\n" %>
15
+ <% end -%>
16
+ <% stories.each do |story| -%>
17
+ <%= format_story(story) %>
18
+ <% end -%>
19
+ <% end -%>
20
+ <% definitions.each do |header, definitions| -%>
21
+ <% if header.strip == '' -%>
22
+ <% else -%>
23
+ <%= "\n#{header}\n\n" %>
24
+ <% end %>
25
+ <% definitions.each do |definition| -%>
26
+ <%= format_definition(definition) %>
27
+ <% end %>
28
+ <% end %>
@@ -0,0 +1,40 @@
1
+ def format_author(author)
2
+ %i[name email company website].map do |key|
3
+ author[key]
4
+ end.compact.join(', ')
5
+ end
6
+
7
+ def format_estimate(cardinality, interval)
8
+ case interval
9
+ when :days
10
+ "#{cardinality}d"
11
+ when :weeks
12
+ "#{cardinality}w"
13
+ else
14
+ cardinality.to_s
15
+ end
16
+ end
17
+
18
+ def format_story(story, kind = :regular)
19
+ story_attributes = []
20
+ story_attributes << "##{story[:id]}" if story[:id]
21
+ story_attributes << story[:status] if story[:status]
22
+ story_attributes << format_estimate(*story[:estimate]) if story[:estimate]
23
+ story_attributes << "i#{story[:iteration]}" if story[:iteration]
24
+
25
+ prefix = kind == :nested ? '| ' : ''
26
+ formatted = "#{prefix}#{story[:description]}"
27
+ formatted << " - #{story_attributes.join(' ')}" unless story_attributes.empty?
28
+ formatted << "\n"
29
+ formatted << "#{prefix} #{story[:notes]}\n" if story[:notes]
30
+ if story[:stories]
31
+ story[:stories].each do |nested|
32
+ formatted << format_story(nested, :nested)
33
+ end
34
+ end
35
+ formatted
36
+ end
37
+
38
+ def format_definition(definition)
39
+ [definition[:title], definition[:definition]].join(': ')
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Manfred Stienstra
@@ -59,6 +59,11 @@ files:
59
59
  - lib/saga/runner.rb
60
60
  - lib/saga/tokenizer.rb
61
61
  - lib/saga/version.rb
62
+ - templates/default/document.erb
63
+ - templates/default/helpers.rb
64
+ - templates/requirements.txt.erb
65
+ - templates/saga/document.erb
66
+ - templates/saga/helpers.rb
62
67
  homepage: https://github.com/Fingertips/saga
63
68
  licenses:
64
69
  - MIT