time_tree 2.2.1 → 2.3.1
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/BUGS.txt +1 -0
- data/fixtures/time/jun2.txt +2 -1
- data/fixtures/time/jun3.txt +1 -1
- data/lib/time_tree/file_parser.rb +8 -6
- data/lib/time_tree/version.rb +1 -1
- data/spec/file_parser_spec.rb +29 -3
- metadata +3 -2
data/BUGS.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Pending When filter is used activities using & are ignored even if the ywould have matched
|
data/fixtures/time/jun2.txt
CHANGED
data/fixtures/time/jun3.txt
CHANGED
@@ -29,7 +29,8 @@ module TimeTree
|
|
29
29
|
def set_date(date)
|
30
30
|
@date = date
|
31
31
|
@prev_mins = nil
|
32
|
-
@
|
32
|
+
@prev_activity = nil
|
33
|
+
@prev_context = nil
|
33
34
|
@prev_comment = nil
|
34
35
|
end
|
35
36
|
|
@@ -66,12 +67,12 @@ module TimeTree
|
|
66
67
|
set_date($1)
|
67
68
|
true
|
68
69
|
|
69
|
-
when /^(\d\d\d\d) +([
|
70
|
+
when /^(\d\d\d\d) +([-&\w\/]+) *(.*)$/
|
70
71
|
if minutes = mins($1)
|
71
72
|
unless @prev_mins.nil?
|
72
73
|
if minutes > @prev_mins
|
73
|
-
if @
|
74
|
-
process_line(minutes, @
|
74
|
+
if @prev_activity != '-' && selected?(@date, @prev_context)
|
75
|
+
process_line(minutes, @prev_context, @prev_comment)
|
75
76
|
end
|
76
77
|
else
|
77
78
|
add_error(line, 'time does not advance')
|
@@ -80,7 +81,8 @@ module TimeTree
|
|
80
81
|
end
|
81
82
|
|
82
83
|
@prev_mins = minutes
|
83
|
-
@
|
84
|
+
@prev_activity = $2
|
85
|
+
@prev_context = $2 unless %w{- &}.include?($2)
|
84
86
|
@prev_comment = $3.size > 0 ? $3 : nil
|
85
87
|
true
|
86
88
|
else
|
@@ -142,4 +144,4 @@ module TimeTree
|
|
142
144
|
end
|
143
145
|
end
|
144
146
|
end
|
145
|
-
end
|
147
|
+
end
|
data/lib/time_tree/version.rb
CHANGED
data/spec/file_parser_spec.rb
CHANGED
@@ -126,9 +126,7 @@ module TimeTree
|
|
126
126
|
end
|
127
127
|
|
128
128
|
context "time lines" do
|
129
|
-
before
|
130
|
-
parser.set_date('2013/01/02')
|
131
|
-
end
|
129
|
+
before { parser.set_date('2013/01/02') }
|
132
130
|
|
133
131
|
context "normal activities" do
|
134
132
|
it "returns true and remains valid" do
|
@@ -180,6 +178,34 @@ module TimeTree
|
|
180
178
|
end
|
181
179
|
end
|
182
180
|
|
181
|
+
context "ampersand for activity (ditto last activity)" do
|
182
|
+
before { parser.set_date('2013/01/02') }
|
183
|
+
|
184
|
+
it "returns true and remains valid" do
|
185
|
+
parser.parse_line("1634 &").should be_true
|
186
|
+
parser.valid?.should be_true
|
187
|
+
end
|
188
|
+
|
189
|
+
context "Previous activity immediately before" do
|
190
|
+
it "calls ActivityTree#load with previous activity" do
|
191
|
+
tree.should_receive(:load).with(%w{foo}, 1, nil).twice
|
192
|
+
parser.parse_line("1634 foo")
|
193
|
+
parser.parse_line("1635 &")
|
194
|
+
parser.parse_line("1636 bar")
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
198
|
+
context "Previous activity separated by -" do
|
199
|
+
it "calls ActivityTree#load with previous activity" do
|
200
|
+
tree.should_receive(:load).with(%w{foo}, 1, nil).twice
|
201
|
+
parser.parse_line("1633 foo")
|
202
|
+
parser.parse_line("1634 -")
|
203
|
+
parser.parse_line("1635 &")
|
204
|
+
parser.parse_line("1636 bar")
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
183
209
|
context "comment lines" do
|
184
210
|
it "should return true" do
|
185
211
|
parser.parse_line("# a comment").should be_true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: time_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -37,6 +37,7 @@ extra_rdoc_files: []
|
|
37
37
|
files:
|
38
38
|
- .gitignore
|
39
39
|
- .rvmrc
|
40
|
+
- BUGS.txt
|
40
41
|
- Gemfile
|
41
42
|
- LICENSE.txt
|
42
43
|
- README.md
|