trebbiatrice 0.2.3 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trebbiatrice/harvest.rb +13 -2
- data/lib/trebbiatrice/trebbia.rb +3 -6
- data/lib/trebbiatrice/trebbiatrice.rb +12 -4
- data/lib/trebbiatrice/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8d9ec205fd99b391308137e51a7c121d5936a39
|
4
|
+
data.tar.gz: 953a6f7fe4a80c99d601f8a9aab204308f1c6bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 773ac236d2f72ee26635070c0d602338fe83fa022c39bc767f379737647fdda2d778a5c332ccac0cf3109c1f68b519214c0ba35454b910eb009b0e4621381098
|
7
|
+
data.tar.gz: 037494c92697ab0cda72032fd0d951a4ea515f60e6fb86f722798ed1b459d8805cb5c62919a34890bf184af545a26c562594af368979432133786d95f18d3c3b
|
data/lib/trebbiatrice/harvest.rb
CHANGED
@@ -18,8 +18,19 @@ module Trebbiatrice
|
|
18
18
|
@harvest.time.trackable_projects
|
19
19
|
end
|
20
20
|
|
21
|
-
def new_entry!(
|
22
|
-
|
21
|
+
def new_entry!(entry_data, find = true)
|
22
|
+
if find
|
23
|
+
entry = @harvest.time.all.select { |entry| entry[:project_id].to_s == entry_data[:project_id].to_s }.last
|
24
|
+
|
25
|
+
if entry
|
26
|
+
toggle!(entry[:id])
|
27
|
+
entry
|
28
|
+
else
|
29
|
+
new_entry!(entry_data, false)
|
30
|
+
end
|
31
|
+
else
|
32
|
+
@harvest.time.create(entry_data)
|
33
|
+
end
|
23
34
|
end
|
24
35
|
|
25
36
|
def toggle!(entry_id)
|
data/lib/trebbiatrice/trebbia.rb
CHANGED
@@ -33,12 +33,8 @@ module Trebbiatrice
|
|
33
33
|
def track!(task = 'Development', notes = '')
|
34
34
|
return if tracking?
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
else
|
39
|
-
task_id = get_task(task)[:id]
|
40
|
-
@entry = @harvest.new_entry! notes: notes, hours: 0, spent_at: today, project_id: @project[:id], task_id: task_id
|
41
|
-
end
|
36
|
+
task_id = get_task(task)[:id]
|
37
|
+
@entry = @harvest.new_entry! notes: notes, hours: 0, spent_at: today, project_id: @project[:id], task_id: task_id
|
42
38
|
|
43
39
|
@tracking = true
|
44
40
|
end
|
@@ -47,6 +43,7 @@ module Trebbiatrice
|
|
47
43
|
if @entry && tracking?
|
48
44
|
@tracking = false
|
49
45
|
@harvest.toggle!(@entry[:id])
|
46
|
+
@entry = nil
|
50
47
|
end
|
51
48
|
end
|
52
49
|
|
@@ -19,14 +19,13 @@ module Trebbiatrice
|
|
19
19
|
end.last
|
20
20
|
|
21
21
|
if response[:status] == 'failure' || !trebbia.working_on
|
22
|
-
|
23
|
-
puts "stopping #{trebbia.project[:name]}" if trebbia.project
|
24
|
-
trebbia.stop_tracking!
|
25
|
-
end
|
22
|
+
stop_tracking!(trebbia)
|
26
23
|
|
27
24
|
last_project = nil
|
28
25
|
else
|
29
26
|
if trebbia.working_on && (last_project != trebbia.working_on || !trebbia.project)
|
27
|
+
stop_tracking!(trebbia)
|
28
|
+
|
30
29
|
trebbia.project = trebbia.active_projects.last
|
31
30
|
trebbia.track! task
|
32
31
|
|
@@ -38,5 +37,14 @@ module Trebbiatrice
|
|
38
37
|
sleep frequency
|
39
38
|
end
|
40
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def stop_tracking!(trebbia)
|
44
|
+
if trebbia.tracking?
|
45
|
+
puts "stopping #{trebbia.project[:name]}" if trebbia.project
|
46
|
+
trebbia.stop_tracking!
|
47
|
+
end
|
48
|
+
end
|
41
49
|
end
|
42
50
|
end
|
data/lib/trebbiatrice/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trebbiatrice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Capuano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: harvested
|