tps_reporter 0.4.2 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03ea58ca429e75041b42ccc50c6d18b3a85631f8
4
- data.tar.gz: fda6800b011ff0e5d59f0623ca012e00750d66da
3
+ metadata.gz: 42257e91f5dd1536461f61bcb04fb9237ae4f850
4
+ data.tar.gz: 54636995c94cee9252da033f5db98dd5d9556132
5
5
  SHA512:
6
- metadata.gz: c585aa40dcb38e9ac2d26e898424e7d29603abc3a95baab5b2e1c3d9f38887320d763e1e8aac183c3ee51bb65720671aee7bb00d0a69d3a14debc82c5cda3e9c
7
- data.tar.gz: 89793ef06977e9b0605445130b516966a936ffb6a0b12d10698e9497857b8c0faa7be26d458fed1787e185de610ed2aac65009ab9a456245162263e39bbb6481
6
+ metadata.gz: 4a50835503a18037b7f0bb5cd1fd45197cb09b0f492a3d90777759036708d7b1b0c4282c7b84708791f2816d59222dd50fb41dcfecffd2d656526d476eaf0fed
7
+ data.tar.gz: 602f6567d09fb0312d07187ea1bbfc0b912817afcab419b0ee552d88aaec5d37cce665bde9c2dc3a9bb09d6760d49252ef066b5876674dcab1377df4ef5d6718
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  *.json
2
2
  *.cson
3
3
  Gemfile.lock
4
+ .ruby-version
5
+ _*
data/HISTORY.md CHANGED
@@ -1,3 +1,10 @@
1
+ v0.5.0 - Dec 11, 2014
2
+ ---------------------
3
+
4
+ * Add support for spaces instead of tabs.
5
+ * Add support for GitHub Markdown-style tasks.
6
+ * CLI reporter: use nicer unicode chars in `tps print`.
7
+
1
8
  v0.4.2 - Dec 03, 2013
2
9
  ---------------------
3
10
 
data/README.md CHANGED
@@ -56,44 +56,7 @@ Edit it, then generate the report:
56
56
  Format
57
57
  ------
58
58
 
59
- The tasks file, usually `tasks.taskpaper`, is in [TaskPaper] format.
60
-
61
- They're simply a hierarchy of projects and tasks.
62
-
63
- ``` yaml
64
- Edit users:
65
- - Register and signup
66
- - Login and logout
67
- ```
68
-
69
- You can tag some projects or tasks.
70
-
71
- ``` yaml
72
- Facebook connect:
73
- - Register via Facebook @done
74
- - Capture email
75
-
76
- Manage employees: @done
77
- - Create user
78
- - Edit user
79
- ```
80
-
81
- The following tags are recognized:
82
-
83
- - `@done`
84
- - `@in_progress`
85
- - `@pt/2839478` *(Pivotal tracker ID. Links to a Pivotal tracker story.)*
86
- - `@tr/LabxGP3` *(Trello card short name. Links to a Trello card.)*
87
- - `@0pt` *(points; influences percentage. needs to end in __pt__ or __pts__.)*
88
- - `@10%` *(task progress. implies __in progress__.)*
89
-
90
- Example:
91
-
92
- ``` yaml
93
- Employee management:
94
- - Creating employees @40%
95
- - Editing employees @done @2pts
96
- ```
59
+ See [docs/Format.md](docs/Format.md).
97
60
 
98
61
  Exporting to PDF or image
99
62
  -------------------------
data/data/index.haml CHANGED
@@ -431,6 +431,9 @@
431
431
  %a.meta{href: task.pivotal_url, target: '_blank'}= "PT ##{task.pivotal_id}"
432
432
  - if task.trello_id
433
433
  %a.meta{href: list.trello_board_url, target: '_blank'}= "Trello ##{task.trello_id}"
434
+ - if task.url
435
+ %a.meta{href: task.url, target: '_blank', class: "ext"}
436
+ != task.url_label ? task.url_label : "›"
434
437
 
435
438
  - if task.tags.any?
436
439
  - task.tags.each do |tag|
data/docs/Format.md ADDED
@@ -0,0 +1,86 @@
1
+ File format
2
+ ===========
3
+
4
+ The tasks file, usually `tasks.taskpaper`, is loosely based off of the [TaskPaper] format.
5
+
6
+ They're simply a hierarchy of projects and tasks. Projects are lines that end with `:`, and tasks are lines that begin with `- `, with indentation.
7
+
8
+ ``` yaml
9
+ Edit users:
10
+ - Register and signup
11
+ - Login and logout
12
+ ```
13
+
14
+ ### Nesting
15
+
16
+ You can nest tasks as deep as you like.
17
+
18
+ ``` yaml
19
+ Edit users:
20
+ - Register and signup
21
+ - Login and logout
22
+ - Design for the pages
23
+ - Responsive
24
+ - Implement functionality
25
+ ```
26
+
27
+ ### Tagging
28
+
29
+ You can tag some projects or tasks using `@`. For projects, you may put the tags after the colon.
30
+
31
+ ``` yaml
32
+ Facebook connect:
33
+ - Register via Facebook @done
34
+ - Capture email
35
+
36
+ Manage employees: @done
37
+ - Create user
38
+ - Edit user
39
+ ```
40
+
41
+ ### Done
42
+
43
+ Mark tasks as done by adding a `@done` tag, or using `x` instead of `-`.
44
+
45
+ ``` yaml
46
+ Manage user records:
47
+ - Create user
48
+ x Edit user
49
+ x Delete user
50
+ - Update user
51
+ ```
52
+
53
+ ### GitHub Flavored Markdown style
54
+
55
+ You can make your lists GitHub-compatible by using `- [ ]` and `- [x]` in your tasks. Projects in Markdown headings (`### heading`) are also supported.
56
+
57
+ ``` yaml
58
+ ### Manage user records
59
+
60
+ - [ ] Create user
61
+ - [x] Edit user
62
+ - [x] Delete user
63
+ - [ ] Update user
64
+ ```
65
+
66
+ ### Done
67
+
68
+ ### Tags
69
+
70
+ The following tags are recognized:
71
+
72
+ - `@done`
73
+ - `@in_progress`
74
+ - `@pt/2839478` *(Pivotal tracker ID. Links to a Pivotal tracker story.)*
75
+ - `@tr/LabxGP3` *(Trello card short name. Links to a Trello card.)*
76
+ - `@0pt` *(points; influences percentage. needs to end in __pt__ or __pts__.)*
77
+ - `@10%` *(task progress. implies __in progress__.)*
78
+
79
+ Example:
80
+
81
+ ``` yaml
82
+ Employee management:
83
+ - Creating employees @40%
84
+ - Editing employees @done @2pts
85
+ ```
86
+
data/docs/Sprints.md ADDED
@@ -0,0 +1,27 @@
1
+ Sprint support
2
+ ==============
3
+
4
+ First, make a sprints block, preferrably at the top of your `tasks.yml` file.
5
+ List down the sprints.
6
+
7
+ Then simply add the sprint ID to your tasks.
8
+
9
+ # tasks.taskpaper
10
+ Sprints:
11
+ s1: Sprint 1 (Nov 1-15)
12
+ s2: Sprint 2 (Nov 16-30)
13
+ s3: Sprint 3 (Dec 1-15)
14
+
15
+ Beta release:
16
+ - Account
17
+ - Login @s1
18
+ - Logout @s1 @done
19
+ - Signup @s2
20
+
21
+ It's also recursive--you can put sprints in your parent tasks under `_`:
22
+
23
+ Beta release:
24
+ - Blog @s3
25
+ - Create posts
26
+ - Read posts
27
+ - Delete posts
data/docs/Trello.md ADDED
@@ -0,0 +1,22 @@
1
+ Trello card linking support
2
+ ===========================
3
+
4
+ **DEPRECATED**: this feature has been deprecated and is not guaranteed to work.
5
+
6
+ Simply link the card shortcut under each item using `tr/XXXX`, where *XXXX* is
7
+ the short URL ID for the Trello card. You can see the short ID in Trello by
8
+ clicking "more..." inside the card popup.
9
+
10
+ Beta release:
11
+ - Blog @tr/Xh3pAGp1
12
+ - Account management
13
+
14
+ You can also link the card numbers, but you have to define the main Trello board
15
+ URL. Simply add `Trello URL: ____` to the top of the file.
16
+
17
+
18
+ Trello URL: https://trello.com/board/trello-resources/4f84a60f0cbdcb7e7d40e099
19
+
20
+ Beta release:
21
+ - Blog @tr/42
22
+ - Account management @tr/12
data/lib/tps.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'haml'
2
3
  require 'tilt'
3
4
 
4
5
  # Common usage:
@@ -30,7 +30,7 @@ module TPS
30
30
  ' '*19
31
31
  end
32
32
 
33
- pref = c("-"*80, 30)+"\n" if task.feature?
33
+ pref = c(""*80, 30)+"\n" if task.feature?
34
34
 
35
35
  # Put together
36
36
  "#{pref}" + "%-88s%s\n" % [ c1, c2 ]
@@ -55,14 +55,14 @@ module TPS
55
55
  end
56
56
 
57
57
  def status
58
- l = c("(", 30)
59
- r = c(")", 30)
58
+ l = c("", 30)
59
+ r = c(" ", 30)
60
60
  if task.done?
61
- l + c('##', color) + r
61
+ l + c('', color) + r
62
62
  elsif task.in_progress?
63
- l + c('--', color) + r
63
+ l + c('', color) + r
64
64
  else
65
- l + c(' ', color) + r
65
+ l + c(' ', color) + r
66
66
  end
67
67
  end
68
68
 
@@ -71,7 +71,7 @@ module TPS
71
71
  len = (task.percent * max).to_i
72
72
 
73
73
  prog = ("%-#{max}s" % ["="*len])
74
- prog = c("|"*len, color) + c("."*(max-len), 30)
74
+ prog = c(""*len, color) + c(""*(max-len), 30)
75
75
 
76
76
  prog
77
77
  end
data/lib/tps/task.rb CHANGED
@@ -11,6 +11,7 @@ module TPS
11
11
  attr_reader :parent
12
12
  attr_reader :tags
13
13
  attr_reader :list # the root TaskList
14
+ attr_reader :url
14
15
  attr_reader :id
15
16
 
16
17
  def initialize(parent, name, data=nil, list)
@@ -31,6 +32,15 @@ module TPS
31
32
  tasks = data
32
33
  end
33
34
 
35
+ # Parse crap from name
36
+ if @name
37
+ @name = @name.dup
38
+
39
+ # Get URL
40
+ @name.gsub!(/https?:\/\/[^ ]+/) { |url| @url = url; "" }
41
+ @name.strip!
42
+ end
43
+
34
44
  # Parse tags.
35
45
  tags.each do |t|
36
46
  # [done]
@@ -69,6 +79,14 @@ module TPS
69
79
  @id = list.get_id if list
70
80
  end
71
81
 
82
+ # The label of the link, if applicable.
83
+ def url_label
84
+ return unless url
85
+ if url =~ /github\.com\/.*?\/(\d+)$/
86
+ $1.strip
87
+ end
88
+ end
89
+
72
90
  def status
73
91
  # If no status is given, infer the status based on tasks.
74
92
  if !@status && tasks?
data/lib/tps/taskpaper.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # node.level #=> 1 (depth)
7
7
  #
8
8
  # node.text #=> 'do things @done'
9
- # node.plain_text #=> 'do things'
9
+ # node.text #=> 'do things'
10
10
  # node.tags #=> ['@done']
11
11
  #
12
12
  # node.node_type
@@ -22,16 +22,21 @@ module TPS::TaskPaper
22
22
  attr_reader :children
23
23
  attr_reader :parent
24
24
 
25
+ TAG_REGEX = %r[(?:^|\s*)@[^\s]*(?:\([^\)]*\))?]
26
+
25
27
  DEFAULTS = {
26
28
  :level => 0,
27
29
  :node_type => :root,
28
30
  :text => ''
29
31
  }
30
32
 
31
- def initialize(options)
33
+ def initialize(options = {})
32
34
  options = DEFAULTS.merge(options)
33
35
  options.each { |k, v| instance_variable_set :"@#{k}", v }
34
- @children = options[:children].map { |data| Node.new data.merge(:parent => self) }
36
+
37
+ @children = options[:children].map { |data|
38
+ Node.new data.merge(:parent => self)
39
+ }
35
40
  end
36
41
 
37
42
  def project?
@@ -58,18 +63,8 @@ module TPS::TaskPaper
58
63
  (parent? ? parent.breadcrumbs : []) + [self]
59
64
  end
60
65
 
61
- TAG_REGEX = %r[(?:^|\s*)@[^\s]*(?:\([^\)]*\))?]
62
-
63
- # Returns text without tags
64
- def plain_text
65
- text
66
- .gsub(TAG_REGEX, '')
67
- .gsub(/\s*:\s*$/, '')
68
- .strip
69
- end
70
-
71
66
  def tags
72
- text.scan(TAG_REGEX).map(&:strip)
67
+ @tags || []
73
68
  end
74
69
 
75
70
  def description
@@ -89,32 +84,75 @@ module TPS::TaskPaper
89
84
  end
90
85
 
91
86
  def to_line_s
87
+ tags_str = tags.any? ? (tags.map { |t| " #{t}" }.join("")) : ""
88
+
92
89
  if project?
93
- "#{text}:"
90
+ "#{text}:#{tags_str}"
94
91
  elsif task?
95
- "- #{text}"
92
+ "- #{text}#{tags_str}"
96
93
  else
97
94
  "#{text}"
98
95
  end
99
96
  end
100
97
 
101
- # Returns a hash from a line
98
+ def self.parse_text(text)
99
+ [
100
+ text
101
+ .gsub(TAG_REGEX, '')
102
+ .gsub(/\s*:\s*$/, '')
103
+ .strip,
104
+ text.scan(TAG_REGEX).map(&:strip)
105
+ ]
106
+ end
107
+
108
+ # Returns a hash from a line.
109
+ #
110
+ # The `root` reference serves as the context.
102
111
  #
103
- # parse_line("\t- Hello")
112
+ # parse_line("\t- Hello", root)
104
113
  # #=> { node_type: :task, level: 2, text: "Hello" }
105
114
  #
106
- def self.parse_line(line)
115
+ def self.parse_line(line, root={})
107
116
  node = {}
108
117
 
109
- node[:level] = line.match(/^(\t*)/) && ($1.length + 1)
118
+ # find indentation level
119
+ if line =~ /^(\s+)/
120
+ if root[:indent]
121
+ node[:level] = $1.length / root[:indent].length + 1
122
+ else
123
+ root[:indent] = $1
124
+ node[:level] = 2
125
+ end
126
+ else
127
+ node[:level] = 1
128
+ end
110
129
 
111
130
  line = line.strip
112
- if line =~ /^\- +(.*)$/
131
+
132
+ # GitHub-style task
133
+ if line =~ /^- \[([ x])\] +(.*)$/
134
+ node[:node_type] = :task
135
+ node[:text] = $1
136
+ node[:text], node[:tags] = parse_text($2)
137
+ node[:tags] << "@done" if $1 == "x"
138
+
139
+ elsif line =~ /^([\-x]) +(.*)$/
113
140
  node[:node_type] = :task
114
141
  node[:text] = $1
142
+ node[:text], node[:tags] = parse_text($2)
143
+ node[:tags] << "@done" if $1 == "x"
144
+
145
+ # Project
115
146
  elsif line =~ /^(.*):((?:\s*#{TAG_REGEX})+)?$/m
116
147
  node[:node_type] = :project
117
- node[:text] = "#{$1}#{$2}"
148
+ node[:text], node[:tags] = parse_text("#{$1}#{$2}")
149
+
150
+ # GitHub-style project
151
+ elsif line =~ /^#+ (.*)$/
152
+ node[:node_type] = :project
153
+ node[:text], node[:tags] = parse_text($1)
154
+
155
+ # Note
118
156
  else
119
157
  node[:node_type] = :note
120
158
  node[:text] = line
@@ -147,7 +185,7 @@ module TPS::TaskPaper
147
185
  lines.each_with_index do |line, i|
148
186
  next if line.strip == ""
149
187
 
150
- node = Node.parse_line(line)
188
+ node = Node.parse_line(line, root)
151
189
 
152
190
  if node[:level] <= level # Sibling
153
191
  ancestry[node[:level]-1][:children] << node
@@ -32,15 +32,15 @@ module TPS::TaskPaperShim
32
32
 
33
33
  # Load children
34
34
  node.children.each do |child|
35
- text = child.plain_text
35
+ text = child.text
36
36
 
37
37
  # For "Trello URL: xxx" settings
38
38
  if is_setting?(child)
39
- child.plain_text =~ /^(.*?): (.*)$/
39
+ child.text =~ /^(.*?): (.*)$/
40
40
  hash[$1] = $2
41
41
 
42
42
  # For "s1: Sprint 1" notes
43
- elsif node.plain_text == "Sprints"
43
+ elsif node.text == "Sprints"
44
44
  text.match(/^(.*?): (.*)$/) && hash[$1] = $2
45
45
 
46
46
  # For everything else
@@ -55,7 +55,7 @@ module TPS::TaskPaperShim
55
55
  # Checks if a given node is a settings node
56
56
  def is_setting?(node)
57
57
  if node.note?
58
- SETTINGS.any? { |tag| node.plain_text =~ /^#{tag}:/ }
58
+ SETTINGS.any? { |tag| node.text =~ /^#{tag}:/ }
59
59
  end
60
60
  end
61
61
 
data/lib/tps/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module TPS
2
2
  def self.version
3
- "0.4.2"
3
+ version = "0.5.0"
4
4
  end
5
5
  end
data/test/bar_test.rb CHANGED
@@ -1,45 +1,45 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class BarTest < UnitTest
4
- setup do
3
+ describe "Bar test" do
4
+ before do
5
5
  @list = TPS::TaskList.new :yaml => f('markers.yml')
6
6
  @milestone = @list.tasks.first
7
7
 
8
8
  @week = %w[w0 w1 w2 w3 w4 w5 w6].map { |id| @list.sprints[id] }
9
9
  end
10
10
 
11
- test "basic sanity check" do
11
+ it "basic sanity check" do
12
12
  assert_equal 2, @list.find("Login").sprints.length
13
13
  end
14
14
 
15
- context "#index_segments" do
16
- test "disjointed" do
15
+ describe "#index_segments" do
16
+ it "disjointed" do
17
17
  task = @list.find("Disjointed")
18
18
  bar = task.bar_formatter
19
19
  assert_equal [(1..2), (4..4)], bar.index_segments
20
20
  end
21
21
 
22
- test "continuous" do
22
+ it "continuous" do
23
23
  task = @list.find("Continuous")
24
24
  bar = task.bar_formatter
25
25
  assert_equal [(1..4)], bar.index_segments
26
26
  end
27
27
 
28
- test "disjointed with head" do
28
+ it "disjointed with head" do
29
29
  task = @list.find("Disjointed with head")
30
30
  bar = task.bar_formatter
31
31
  assert_equal [(1..1), (3..4)], bar.index_segments
32
32
  end
33
33
 
34
- test "disjointed with two segments" do
34
+ it "disjointed with two segments" do
35
35
  task = @list.find("Disjointed with two segments")
36
36
  bar = task.bar_formatter
37
37
  assert_equal [(2..3), (5..6)], bar.index_segments
38
38
  end
39
39
  end
40
40
 
41
- context "#segments" do
42
- test "disjointed" do
41
+ describe "#segments" do
42
+ it "disjointed" do
43
43
  task = @list.find("Disjointed")
44
44
  bar = task.bar_formatter
45
45
  end
data/test/html_test.rb CHANGED
@@ -1,19 +1,17 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class HtmlTest < UnitTest
4
- TESTS = %w[hello.yml multi_sprints.yml sprint_points.yml sprints.yml]
3
+ TESTS = %w[hello.yml multi_sprints.yml sprint_points.yml sprints.yml]
5
4
 
6
- TESTS.each do |yml_file|
7
- context yml_file do
8
- setup do
9
- @list = TPS::TaskList.new :yaml => f(yml_file)
10
- end
5
+ TESTS.each do |yml_file|
6
+ describe yml_file do
7
+ before do
8
+ @list = TPS::TaskList.new :yaml => f(yml_file)
9
+ end
11
10
 
12
- test "HTML" do
13
- html = @list.to_html
14
- assert html.include?("span")
15
- assert html.include?("body")
16
- end
11
+ it "HTML" do
12
+ html = @list.to_html
13
+ assert html.include?("span")
14
+ assert html.include?("body")
17
15
  end
18
16
  end
19
17
  end
@@ -1,14 +1,14 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class MultiSprintsTest < UnitTest
4
- setup do
3
+ describe "Multi sprints" do
4
+ before do
5
5
  @list = TPS::TaskList.new :yaml => f('multi_sprints.yml')
6
6
  @milestone = @list.tasks.first
7
7
 
8
8
  @week = %w[_ w1 w2 w3 w4].map { |id| @list.sprints[id] }
9
9
  end
10
10
 
11
- test "Sprints" do
11
+ it "Sprints" do
12
12
  sprints = @list.find('Login').sprints
13
13
 
14
14
  assert_equal 2, sprints.length
@@ -16,11 +16,11 @@ class MultiSprintsTest < UnitTest
16
16
  assert sprints.include?(@week[2])
17
17
  end
18
18
 
19
- test "points (1)" do
19
+ it "points (1)" do
20
20
  assert_equal 6, @week[1].points
21
21
  end
22
22
 
23
- test "points (2)" do
23
+ it "points (2)" do
24
24
  assert_equal 2, @week[2].points
25
25
  end
26
26
  end
@@ -1,11 +1,11 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class SettingsTest < UnitTest
4
- setup do
3
+ describe "Settings" do
4
+ before do
5
5
  @hash = TPS::TaskPaperShim.parse("Trello URL: http://xyz\nVersion 1:\n\t- Hello")
6
6
  end
7
7
 
8
- test "use setting" do
8
+ it "use setting" do
9
9
  assert_equal "http://xyz", @hash["Trello URL"]
10
10
  end
11
11
  end
@@ -1,29 +1,29 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class SprintPointsTest < UnitTest
4
- setup do
3
+ describe "Sprint points" do
4
+ before do
5
5
  @list = TPS::TaskList.new :yaml => f('sprint_points.yml')
6
6
  @milestone = @list.tasks.first
7
7
  @s = %w[_ s1 s2 s3 s4 s5].map { |id| @list.sprints[id] }
8
8
  end
9
9
 
10
- test "S1 points" do
10
+ it "S1 points" do
11
11
  assert_equal 1.0, @s[1].points
12
12
  end
13
13
 
14
- test "S2 points" do
14
+ it "S2 points" do
15
15
  assert_equal 3.0, @s[2].points
16
16
  end
17
17
 
18
- test "S3 points" do
18
+ it "S3 points" do
19
19
  assert_equal 0.0, @s[3].points
20
20
  end
21
21
 
22
- test "S4 points" do
22
+ it "S4 points" do
23
23
  assert_equal 2.5, @s[4].points
24
24
  end
25
25
 
26
- test "S5 points" do
26
+ it "S5 points" do
27
27
  assert_equal 1.0, @s[5].points
28
28
  end
29
29
  end
data/test/sprint_test.rb CHANGED
@@ -1,62 +1,62 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class SprintTest < UnitTest
4
- setup do
3
+ describe "Sprint" do
4
+ before do
5
5
  @list = TPS::TaskList.new :yaml => f('sprints.yml')
6
6
  @milestone = @list.tasks.first
7
7
  @s1 = @list.sprints['s1']
8
8
  @s2 = @list.sprints['s2']
9
9
  end
10
10
 
11
- test "Sprints" do
11
+ it "Sprints" do
12
12
  assert_equal 2, @list.sprints.size
13
13
  assert_equal 'Sprint one', @s1.name
14
14
  assert_equal 'Sprint two', @s2.name
15
15
  end
16
16
 
17
- test "Sprint model attributes" do
17
+ it "Sprint model attributes" do
18
18
  sprint = @list.sprints['s1']
19
19
  assert_equal 'Sprint one', sprint.name
20
20
  assert_equal @list, sprint.list
21
21
  end
22
22
 
23
- test "Tasks should be assigned to sprints" do
23
+ it "Tasks should be assigned to sprints" do
24
24
  assert @list['Version 1']['Account']['Login'].sprints.include?(@s1)
25
25
  end
26
26
 
27
- test "Task#contains_sprint?" do
27
+ it "Task#contains_sprint?" do
28
28
  assert @list.contains_sprint?(@s1)
29
29
  assert @list.contains_sprint?(@s2)
30
30
  end
31
31
 
32
- test "Task#contains_sprint? part 2" do
32
+ it "Task#contains_sprint? part 2" do
33
33
  task = @list['Version 1']['Account']['Login']
34
34
  assert task.contains_sprint?(@s1)
35
35
  assert ! task.contains_sprint?(@s2)
36
36
  end
37
37
 
38
- test "Task#filter_by_sprint" do
38
+ it "Task#filter_by_sprint" do
39
39
  list = @list.filter_by_sprint(@s1)
40
40
  assert ! list['Version 1']['Account']['Login'].nil?
41
41
  assert list['Version 1']['Account']['Signup'].nil?
42
42
  end
43
43
 
44
- test "Sub-tasks of a sprint task" do
44
+ it "Sub-tasks of a sprint task" do
45
45
  list = @list.filter_by_sprint(@s1)
46
46
  task = list['Version 1']['Comments']['Creating']
47
47
  assert ! task.nil?
48
48
  end
49
49
 
50
- test "Sprint#index" do
50
+ it "Sprint#index" do
51
51
  assert_equal 0, @list.sprints['s1'].index
52
52
  assert_equal 1, @list.sprints['s2'].index
53
53
  end
54
54
 
55
- test "Sprint#points" do
55
+ it "Sprint#points" do
56
56
  assert_equal 5, @s1.points
57
57
  end
58
58
 
59
- test "Sprint#points_done" do
59
+ it "Sprint#points_done" do
60
60
  assert_equal 3, @s1.points_done
61
61
  end
62
62
  end
@@ -1,28 +1,142 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class TaskpaperTest < UnitTest
4
- test "parseable" do
3
+ describe "Taskpaper" do
4
+ it "parseable" do
5
5
  data = File.read('tasks.taskpaper')
6
6
  root = TPS::TaskPaper.parse(data)
7
7
  end
8
8
 
9
9
  describe "basic doc" do
10
- setup do
10
+ before do
11
11
  @source = "Version 1:\n\t- Log in @done"
12
12
  @node = TPS::TaskPaper.parse(@source)
13
13
  end
14
14
 
15
- test "should work" do
15
+ it "exports back to its original state" do
16
16
  assert_equal @node.to_s.strip, @source
17
17
  end
18
18
  end
19
19
 
20
- describe "shim" do
21
- setup do
20
+ describe "2 spaces as tabs" do
21
+ before do
22
+ @source = "Version 1:\n - Log in\n - Sign up"
23
+ @node = TPS::TaskPaper.parse(@source)
24
+ end
25
+
26
+ it "should work" do
27
+ assert_equal @node.to_s.strip, @source.gsub(' ', "\t")
28
+ end
29
+ end
30
+
31
+ describe "single lines" do
32
+ it "parses a basic task" do
33
+ @node = TPS::TaskPaper.parse("- hello").children[0]
34
+ assert_equal @node.text, "hello"
35
+ assert_equal @node.task?, true
36
+ assert_equal @node.level, 1
37
+ assert_equal @node.to_line_s, "- hello"
38
+ end
39
+
40
+ it "parses a done task" do
41
+ @node = TPS::TaskPaper.parse("x hello").children[0]
42
+ assert_equal @node.text, "hello"
43
+ assert_equal @node.task?, true
44
+ assert_equal @node.level, 1
45
+ assert_equal @node.tags, ["@done"]
46
+ end
47
+
48
+ it "parses a task with tags" do
49
+ @node = TPS::TaskPaper.parse("- hello @done").children[0]
50
+ assert_equal @node.text, "hello"
51
+ assert_equal @node.tags, ["@done"]
52
+ assert_equal @node.task?, true
53
+ assert_equal @node.level, 1
54
+ assert_equal @node.to_line_s, "- hello @done"
55
+ end
56
+
57
+ it "parses a note" do
58
+ @node = TPS::TaskPaper.parse("hello").children[0]
59
+ assert_equal @node.text, "hello"
60
+ assert_equal @node.note?, true
61
+ assert_equal @node.level, 1
62
+ assert_equal @node.to_line_s, "hello"
63
+ end
64
+
65
+ it "parses a note with fake tags" do
66
+ @node = TPS::TaskPaper.parse("hello @done").children[0]
67
+ assert_equal @node.text, "hello @done"
68
+ assert_equal @node.note?, true
69
+ assert_equal @node.level, 1
70
+ assert_equal @node.to_line_s, "hello @done"
71
+ end
72
+
73
+ it "parses a task with multiple tags" do
74
+ @node = TPS::TaskPaper.parse("- hello @ok @done").children[0]
75
+ assert_equal @node.text, "hello"
76
+ assert_equal @node.tags, ["@ok", "@done"]
77
+ assert_equal @node.task?, true
78
+ assert_equal @node.level, 1
79
+ assert_equal @node.to_line_s, "- hello @ok @done"
80
+ end
81
+
82
+ it "parses a basic project" do
83
+ @node = TPS::TaskPaper.parse("hello:").children[0]
84
+ assert_equal @node.text, "hello"
85
+ assert_equal @node.project?, true
86
+ assert_equal @node.level, 1
87
+ end
88
+
89
+ it "parses a project with tags" do
90
+ @node = TPS::TaskPaper.parse("hello: @done").children[0]
91
+ assert_equal @node.text, "hello"
92
+ assert_equal @node.tags, ["@done"]
93
+ assert_equal @node.project?, true
94
+ assert_equal @node.level, 1
95
+ end
96
+ end
97
+
98
+ describe "github style" do
99
+ it "parses a basic task" do
100
+ @node = TPS::TaskPaper.parse("- [ ] hello").children[0]
101
+ assert_equal @node.text, "hello"
102
+ assert_equal @node.task?, true
103
+ assert_equal @node.tags, []
104
+ assert_equal @node.level, 1
105
+ end
106
+
107
+ it "parses a basic task as done" do
108
+ @node = TPS::TaskPaper.parse("- [x] hello").children[0]
109
+ assert_equal @node.text, "hello"
110
+ assert_equal @node.task?, true
111
+ assert_equal @node.tags, ["@done"]
112
+ assert_equal @node.level, 1
113
+ end
114
+
115
+ it "parses a basic project" do
116
+ @node = TPS::TaskPaper.parse("## hello").children[0]
117
+ assert_equal @node.text, "hello"
118
+ assert_equal @node.project?, true
119
+ assert_equal @node.tags, []
120
+ assert_equal @node.level, 1
121
+ end
122
+
123
+ it "parses a basic task as done" do
124
+ @node = TPS::TaskPaper.parse("## hello @done").children[0]
125
+ assert_equal @node.text, "hello"
126
+ assert_equal @node.project?, true
127
+ assert_equal @node.tags, ["@done"]
128
+ assert_equal @node.level, 1
129
+ end
130
+ end
131
+
132
+
133
+
134
+ describe "TaskPaperShim" do
135
+ before do
22
136
  @hash = TPS::TaskPaperShim.load('tasks.taskpaper')
23
137
  end
24
138
 
25
- test "should work" do
139
+ it "should work" do
26
140
  expected = {"Sprints"=>{"s1"=>"Sprint 1 (November)", "s2"=>"Sprint 2 (Jan)", "s3"=>"Sprint 3 (December)"}, "Version 1"=>{"User signup"=>{"_"=>["s1"], "Register for an account"=>nil, "Log in"=>["done"], "Forget password"=>nil}, "Manage users"=>{"_"=>["in progress", "s1"], "Create users"=>["in progress", "s3"], "Delete users"=>nil, "User profile page"=>nil}, "Blog"=>{"Creating new posts"=>["done"], "Comments"=>["done"], "Moderating comments"=>nil}}}
27
141
  assert_equal expected, @hash
28
142
  end
data/test/test_helper.rb CHANGED
@@ -1,13 +1,15 @@
1
1
  $:.unshift File.expand_path('../../lib', __FILE__)
2
- require 'contest'
2
+ require 'minitest/autorun'
3
+
4
+ require 'minitest/reporters'
5
+ Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new
6
+
3
7
  require 'tps'
4
8
 
5
- class UnitTest < Test::Unit::TestCase
6
- def f(*a)
7
- File.join fixture_root, *a
8
- end
9
+ def f(*a)
10
+ File.join fixture_root, *a
11
+ end
9
12
 
10
- def fixture_root
11
- File.expand_path('../fixtures', __FILE__)
12
- end
13
+ def fixture_root
14
+ File.expand_path('../fixtures', __FILE__)
13
15
  end
data/test/tps_test.rb CHANGED
@@ -1,25 +1,25 @@
1
1
  require File.expand_path('../test_helper', __FILE__)
2
2
 
3
- class MyTest < UnitTest
4
- setup do
3
+ describe "TPS" do
4
+ before do
5
5
  @list = TPS::TaskList.new :yaml => f('hello.yml')
6
6
  @milestone = @list.tasks.first
7
7
  end
8
8
 
9
- test "Has tasks" do
9
+ it "Has tasks" do
10
10
  assert @list.tasks?
11
11
  assert_equal 2, @list.tasks.size
12
12
  assert @list.tasks.first.tasks.size >= 2
13
13
  end
14
14
 
15
- test "Explicit percent" do
15
+ it "Explicit percent" do
16
16
  task = @milestone.tasks[0]
17
17
  assert task.in_progress?
18
18
  assert_equal :in_progress, task.status
19
19
  assert_equal 0.25, task.percent
20
20
  end
21
21
 
22
- test "Overriding percent" do
22
+ it "Overriding percent" do
23
23
  task = @milestone.tasks[2]
24
24
  assert_equal "Overridden percent", task.name
25
25
  assert task.in_progress?
@@ -27,32 +27,32 @@ class MyTest < UnitTest
27
27
  assert_equal 0.5, task.percent
28
28
  end
29
29
 
30
- test "Points" do
30
+ it "Points" do
31
31
  task = @milestone.tasks[1]
32
32
  assert_equal 2.0, task.points
33
33
  end
34
34
 
35
- test "Explicit points" do
35
+ it "Explicit points" do
36
36
  task = @milestone.tasks[3]
37
37
  assert_equal 15, task.points
38
38
  assert_equal 0.75, task.percent
39
39
  assert_equal 11.25, task.points_done
40
40
  end
41
41
 
42
- test "Compound points" do
42
+ it "Compound points" do
43
43
  task = @milestone.tasks[4]
44
44
  assert_equal 6, task.points
45
45
  assert_equal 0.50, task.percent
46
46
  end
47
47
 
48
- test "Point rescaling" do
48
+ it "Point rescaling" do
49
49
  task = @milestone.tasks[5]
50
50
  assert_equal 8, task.points
51
51
  assert_equal 4.0, task.points_done
52
52
  assert_equal 0.5, task.percent
53
53
  end
54
54
 
55
- test "In progress" do
55
+ it "In progress" do
56
56
  task = @milestone.tasks[6]
57
57
  assert_equal 2, task.tasks.size
58
58
  assert task.tasks[1].in_progress?
@@ -61,48 +61,48 @@ class MyTest < UnitTest
61
61
  assert_equal 0.25, task.percent
62
62
  end
63
63
 
64
- test "Progress override" do
64
+ it "Progress override" do
65
65
  task = @milestone.tasks[7]
66
66
  assert_equal 0.2, task.percent
67
67
  assert_equal 0.4, task.points_done
68
68
  end
69
69
 
70
- test "Milestone" do
70
+ it "Milestone" do
71
71
  assert @milestone.milestone?
72
72
  end
73
73
 
74
- test "Not milestone" do
74
+ it "Not milestone" do
75
75
  @milestone.tasks.each do |t|
76
76
  assert ! t.milestone?
77
77
  end
78
78
  end
79
79
 
80
- test "HTML works" do
80
+ it "HTML works" do
81
81
  assert @list.to_html
82
82
  end
83
83
 
84
- test "Lookup" do
84
+ it "Lookup" do
85
85
  assert_equal @milestone, @list['Milestone 1']
86
86
  end
87
87
 
88
- context "Task#find" do
89
- test "self name" do
88
+ describe "Task#find" do
89
+ it "self name" do
90
90
  end
91
91
 
92
- test "descendant" do
92
+ it "descendant" do
93
93
  assert_equal @list['Milestone 1'], @list.find('Milestone 1')
94
94
  end
95
95
 
96
- test "Grand-child" do
96
+ it "Grand-child" do
97
97
  assert_equal @list.tasks[0].tasks[1], @list.find('User login')
98
98
  end
99
99
 
100
- test "non-existent" do
100
+ it "non-existent" do
101
101
  assert_equal nil, @list.find("X")
102
102
  end
103
103
  end
104
104
 
105
- test "Task#breadcrumbs" do
105
+ it "Task#breadcrumbs" do
106
106
  crumbs = @list['Milestone 1']['User login']['Signup'].breadcrumbs
107
107
  expected = [
108
108
  @list['Milestone 1'],
@@ -112,7 +112,7 @@ class MyTest < UnitTest
112
112
  assert_equal expected, crumbs
113
113
  end
114
114
 
115
- test "Task#breadcrumbs(false)" do
115
+ it "Task#breadcrumbs(false)" do
116
116
  crumbs = @list['Milestone 1']['User login']['Signup'].breadcrumbs(false)
117
117
  expected = [
118
118
  @list['Milestone 1'],
data/test/url_test.rb ADDED
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../test_helper', __FILE__)
2
+
3
+ describe "URLs" do
4
+ before do
5
+ @list = TPS::TaskList.new data: [
6
+ "Hello http://google.com"
7
+ ]
8
+
9
+ @task = @list.tasks[0]
10
+ end
11
+
12
+ it "use setting" do
13
+ assert_equal "Hello", @task.name
14
+ assert_equal "http://google.com", @task.url
15
+ end
16
+ end
data/tps_reporter.gemspec CHANGED
@@ -15,5 +15,5 @@ Gem::Specification.new do |s|
15
15
  s.add_dependency "tilt", "~> 1.4.1"
16
16
  s.add_dependency "haml", "~> 4.0.0"
17
17
  s.add_development_dependency "rake"
18
- s.add_development_dependency "contest", "0.1.3"
18
+ s.add_development_dependency "minitest-reporters"
19
19
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tps_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rico Sta. Cruz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tilt
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.4.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: haml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 4.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: contest
56
+ name: minitest-reporters
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 0.1.3
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 0.1.3
68
+ version: '0'
69
69
  description: A YAML-powered, simple command-line task report builder.
70
70
  email:
71
71
  - rico@sinefunc.com
@@ -74,9 +74,8 @@ executables:
74
74
  extensions: []
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - .gitignore
78
- - .travis.yml
79
- - GUIDE.md
77
+ - ".gitignore"
78
+ - ".travis.yml"
80
79
  - Gemfile
81
80
  - HISTORY.md
82
81
  - Notes.md
@@ -85,6 +84,9 @@ files:
85
84
  - bin/tps
86
85
  - data/index.haml
87
86
  - data/sample.taskpaper
87
+ - docs/Format.md
88
+ - docs/Sprints.md
89
+ - docs/Trello.md
88
90
  - lib/tps.rb
89
91
  - lib/tps/bar_formatter.rb
90
92
  - lib/tps/cli_reporter.rb
@@ -111,6 +113,7 @@ files:
111
113
  - test/taskpaper_test.rb
112
114
  - test/test_helper.rb
113
115
  - test/tps_test.rb
116
+ - test/url_test.rb
114
117
  - tps_reporter.gemspec
115
118
  homepage: http://github.com/rstacruz/tps_reporter
116
119
  licenses:
@@ -122,19 +125,18 @@ require_paths:
122
125
  - lib
123
126
  required_ruby_version: !ruby/object:Gem::Requirement
124
127
  requirements:
125
- - - '>='
128
+ - - ">="
126
129
  - !ruby/object:Gem::Version
127
130
  version: '0'
128
131
  required_rubygems_version: !ruby/object:Gem::Requirement
129
132
  requirements:
130
- - - '>='
133
+ - - ">="
131
134
  - !ruby/object:Gem::Version
132
135
  version: '0'
133
136
  requirements: []
134
137
  rubyforge_project:
135
- rubygems_version: 2.0.2
138
+ rubygems_version: 2.2.2
136
139
  signing_key:
137
140
  specification_version: 4
138
141
  summary: Task progress sheet reporter.
139
142
  test_files: []
140
- has_rdoc:
data/GUIDE.md DELETED
@@ -1,53 +0,0 @@
1
- Guide
2
- =====
3
-
4
- Advanced usage guide!
5
-
6
- Sprint support
7
- --------------
8
-
9
- First, make a sprints block, preferrably at the top of your `tasks.yml` file.
10
- List down the sprints.
11
-
12
- Then simply add the sprint ID to your tasks.
13
-
14
- # tasks.taskpaper
15
- Sprints:
16
- s1: Sprint 1 (Nov 1-15)
17
- s2: Sprint 2 (Nov 16-30)
18
- s3: Sprint 3 (Dec 1-15)
19
-
20
- Beta release:
21
- - Account
22
- - Login @s1
23
- - Logout @s1 @done
24
- - Signup @s2
25
-
26
- It's also recursive--you can put sprints in your parent tasks under `_`:
27
-
28
- Beta release:
29
- - Blog @s3
30
- - Create posts
31
- - Read posts
32
- - Delete posts
33
-
34
- Trello card linking support
35
- ---------------------------
36
-
37
- Simply link the card shortcut under each item using `tr/XXXX`, where *XXXX* is
38
- the short URL ID for the Trello card. You can see the short ID in Trello by
39
- clicking "more..." inside the card popup.
40
-
41
- Beta release:
42
- - Blog @tr/Xh3pAGp1
43
- - Account management
44
-
45
- You can also link the card numbers, but you have to define the main Trello board
46
- URL. Simply add `Trello URL: ____` to the top of the file.
47
-
48
-
49
- Trello URL: https://trello.com/board/trello-resources/4f84a60f0cbdcb7e7d40e099
50
-
51
- Beta release:
52
- Blog: [tr/42]
53
- Account management: [tr/12, done]