trebbiatrice 0.1.1 → 0.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 +4 -4
- data/bin/trebbiatrice +1 -1
- data/lib/trebbiatrice/trebbia.rb +5 -39
- data/lib/trebbiatrice/trebbiatrice.rb +36 -0
- data/lib/trebbiatrice/version.rb +1 -1
- data/lib/trebbiatrice.rb +1 -0
- data/trebbiatrice.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a80063d2dc3e210891f3e8ce8c69a90cc35528dd
|
4
|
+
data.tar.gz: 0f26c4d8765e4cdaa50631b1e99c25dd8dc16189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62693076e41d52c1acfc8b159a8f759020f53a1f14547a9408b1398dbf523468977d1ce16f4c4e148b56db6f77c05802c425450cff3cc4c0864f0bf258044cb3
|
7
|
+
data.tar.gz: adfc713277f1f482af215e8bdc37fd13d2ef8f003ae61d7e5474c98e2e24d4a3548d6271a9d79854483686093dfe75bb903ed3248015de82ac767e749d4d7752
|
data/bin/trebbiatrice
CHANGED
data/lib/trebbiatrice/trebbia.rb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
module Trebbiatrice
|
12
12
|
class Trebbia
|
13
|
-
attr_accessor :working_on
|
13
|
+
attr_accessor :working_on, :project
|
14
14
|
|
15
15
|
def initialize(login_data)
|
16
16
|
@harvest = Harvest.new(login_data)
|
@@ -18,9 +18,11 @@ module Trebbiatrice
|
|
18
18
|
@tracking = false
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
@project
|
21
|
+
def active_projects
|
22
|
+
@harvest.projects.select { |project| /#{project[:name]}/i.match(@working_on) }
|
23
|
+
end
|
23
24
|
|
25
|
+
def get_task(name)
|
24
26
|
@project.tasks.select { |t| t.name == name }.last
|
25
27
|
end
|
26
28
|
|
@@ -48,42 +50,6 @@ module Trebbiatrice
|
|
48
50
|
!!@tracking
|
49
51
|
end
|
50
52
|
|
51
|
-
def active_projects
|
52
|
-
@harvest.projects.select { |project| /#{project[:name]}/i.match(@working_on) }
|
53
|
-
end
|
54
|
-
|
55
|
-
def run!(task, testata, frequency)
|
56
|
-
last_project, project = nil
|
57
|
-
|
58
|
-
loop do
|
59
|
-
response = Trebbia.invoke!(testata[:engine], testata[:name])
|
60
|
-
@working_on = response[:contents].select do |content|
|
61
|
-
@working_on = content
|
62
|
-
active_projects.any?
|
63
|
-
end.last
|
64
|
-
|
65
|
-
if response[:status] == 'failure' || !@working_on
|
66
|
-
if tracking?
|
67
|
-
p "stopping #{project[:name]}" if project
|
68
|
-
stop_tracking!
|
69
|
-
end
|
70
|
-
|
71
|
-
last_project = nil
|
72
|
-
sleep frequency
|
73
|
-
else
|
74
|
-
if @working_on && (last_project != @working_on || !project)
|
75
|
-
last_project = @working_on
|
76
|
-
track!(task)
|
77
|
-
|
78
|
-
project = active_projects.last
|
79
|
-
p "tracking #{project[:name]}"
|
80
|
-
end
|
81
|
-
|
82
|
-
sleep frequency
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
53
|
class << self
|
88
54
|
def invoke!(*input)
|
89
55
|
stdin, stdout, stderr = Open3.popen3(*input)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Trebbiatrice
|
2
|
+
class << self
|
3
|
+
def run!(login_data, task, testata, frequency)
|
4
|
+
trebbia = Trebbia.new(login_data)
|
5
|
+
last_project, project = nil
|
6
|
+
|
7
|
+
loop do
|
8
|
+
response = Trebbia.invoke!(testata[:engine], testata[:name])
|
9
|
+
|
10
|
+
trebbia.working_on = response[:contents].select do |content|
|
11
|
+
trebbia.working_on = content
|
12
|
+
trebbia.active_projects.any?
|
13
|
+
end.last
|
14
|
+
|
15
|
+
if response[:status] == 'failure' || !trebbia.working_on
|
16
|
+
if trebbia.tracking?
|
17
|
+
p "stopping #{trebbia.project[:name]}" if trebbia.project
|
18
|
+
trebbia.stop_tracking!
|
19
|
+
end
|
20
|
+
|
21
|
+
last_project = nil
|
22
|
+
else
|
23
|
+
if trebbia.working_on && (last_project != trebbia.working_on || !trebbia.project)
|
24
|
+
trebbia.project = trebbia.active_projects.last
|
25
|
+
trebbia.track! task
|
26
|
+
|
27
|
+
last_project = trebbia.working_on
|
28
|
+
p "tracking #{trebbia.project[:name]}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
sleep frequency
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/trebbiatrice/version.rb
CHANGED
data/lib/trebbiatrice.rb
CHANGED
data/trebbiatrice.gemspec
CHANGED
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.version = Trebbiatrice::VERSION
|
6
6
|
s.author = 'Giovanni Capuano'
|
7
7
|
s.email = 'webmaster@giovannicapuano.net'
|
8
|
-
s.homepage = 'https://github.com/
|
8
|
+
s.homepage = 'https://github.com/mozestudio/Trebbiatrice'
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.summary = "Track the time on Harvest automatically watching what you're working on."
|
11
11
|
s.description = "Track the time on Harvest automatically watching what you're working on. So you've just to work without thinking about starting and stopping the tracker."
|
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.2'
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: harvested
|
@@ -42,9 +42,10 @@ files:
|
|
42
42
|
- lib/trebbiatrice.rb
|
43
43
|
- lib/trebbiatrice/harvest.rb
|
44
44
|
- lib/trebbiatrice/trebbia.rb
|
45
|
+
- lib/trebbiatrice/trebbiatrice.rb
|
45
46
|
- lib/trebbiatrice/version.rb
|
46
47
|
- trebbiatrice.gemspec
|
47
|
-
homepage: https://github.com/
|
48
|
+
homepage: https://github.com/mozestudio/Trebbiatrice
|
48
49
|
licenses:
|
49
50
|
- WTFPL
|
50
51
|
metadata: {}
|