tacgo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/tacgo +44 -12
- data/tacgo.gemspec +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: 72112fda85742ac175d7809c27f0568c5221555e
|
4
|
+
data.tar.gz: dd860e32dbd0a0414d64d64b7067f459a6e0335f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad40617d73679ca7f4f3002570f1f709e42fe171be4532c16f56f01d97056a9070e32f90cc241c74047f6909a90b8f796567950410863ad111db9b00c712e0a0
|
7
|
+
data.tar.gz: c44089ba2aa0bba5584f9368eab9813d667f3cd68b6f854e931c76072a857e1eb6137a6cac1a1111d386c4152ebcb77f899777c9371d81802dc56049b7a6a2d6
|
data/bin/tacgo
CHANGED
@@ -38,7 +38,33 @@ Task = Struct.new(:id, :label) do
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
Pomodoro = Struct.new(:task, :started, :completed) do
|
41
|
+
Pomodoro = Struct.new(:task, :duration, :started, :completed) do
|
42
|
+
attr_accessor :restarted, :canceled
|
43
|
+
|
44
|
+
def initialize(task = nil, duration = 25 * 60, started = nil, completed = nil)
|
45
|
+
super task, duration, started, completed
|
46
|
+
end
|
47
|
+
|
48
|
+
def active?
|
49
|
+
canceled.nil? and progress < duration
|
50
|
+
end
|
51
|
+
|
52
|
+
def canceled?
|
53
|
+
!canceled.nil?
|
54
|
+
end
|
55
|
+
|
56
|
+
def progress
|
57
|
+
[ Time.now - (restarted || started), duration ].min
|
58
|
+
end
|
59
|
+
|
60
|
+
def restart
|
61
|
+
self.restarted = Time.now
|
62
|
+
end
|
63
|
+
|
64
|
+
def cancel
|
65
|
+
self.canceled = Time.now
|
66
|
+
end
|
67
|
+
|
42
68
|
def start(store)
|
43
69
|
self.started = Time.now
|
44
70
|
store.transaction do
|
@@ -61,21 +87,27 @@ def start
|
|
61
87
|
task = fetch_top_task
|
62
88
|
pomodoro = Pomodoro.new(task)
|
63
89
|
pomodoro.start(store)
|
64
|
-
|
65
|
-
duration
|
66
|
-
|
90
|
+
progress = ProgressBar.create(title: task.label[0..40],
|
91
|
+
total: pomodoro.duration,
|
92
|
+
format: '%t: |%B| %p%%')
|
67
93
|
|
68
94
|
Thread.abort_on_exception = true
|
69
|
-
Thread.new(pomodoro,
|
70
|
-
|
71
|
-
|
72
|
-
|
95
|
+
Thread.new(pomodoro, progress) do |pomodoro, progress|
|
96
|
+
$stdin.echo = false
|
97
|
+
Signal.trap('INT') { pomodoro.cancel }
|
98
|
+
Signal.trap('QUIT') { pomodoro.restart }
|
99
|
+
|
100
|
+
while pomodoro.active?
|
101
|
+
progress.progress = pomodoro.progress
|
102
|
+
sleep 0.1
|
73
103
|
end
|
74
|
-
end.join
|
75
|
-
progress.finish
|
76
104
|
|
77
|
-
|
78
|
-
|
105
|
+
unless pomodoro.canceled?
|
106
|
+
progress.finish
|
107
|
+
pomodoro.complete store
|
108
|
+
`osascript -e 'display notification "Pomodoro complete" with title "Pomodoro complete" sound name "Glass"'`
|
109
|
+
end
|
110
|
+
end.join
|
79
111
|
end
|
80
112
|
|
81
113
|
def store
|
data/tacgo.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tacgo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Marburger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|