timecrunch 0.0.2 → 0.0.3
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/lib/timecrunch.rb +1 -0
- data/lib/timecrunch/cli.rb +2 -0
- data/lib/timecrunch/notifiers/beep.rb +9 -0
- data/lib/timecrunch/version.rb +1 -1
- data/spec/integration/cli_spec.rb +24 -9
- data/spec/notifiers/beep_spec.rb +15 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e17b40eee0c7fb33bd24f4436f3b96993f7ea5d7
|
4
|
+
data.tar.gz: 65ef081ded359d4de5759173321e910c347037dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c55c321ca80dac2c6acd99273a1e814036f10d6e306b7bceebec46b16c5bacefc4682a910faa4b27964223c8d4802c9ef85dc61341a41d64d3183d1da328314
|
7
|
+
data.tar.gz: 773ecae2c960eafb504db058b9798f51990b617da07d0f4201f87bcfd74ce57c22b59202e988185d6c44b85ae24dca2a31862e4f57b9dd1339850bd13c672adc
|
data/lib/timecrunch.rb
CHANGED
data/lib/timecrunch/cli.rb
CHANGED
@@ -6,12 +6,14 @@ module Timecrunch
|
|
6
6
|
desc "start MINUTES", "Starts a new timer for MINUTES"
|
7
7
|
option :s, :banner => "seconds"
|
8
8
|
option :growl, :type => :boolean, :banner => "notification center"
|
9
|
+
option :beep, :type => :boolean, :banner => "beep when timer is done"
|
9
10
|
def start(minutes=0)
|
10
11
|
seconds = options[:s].nil? ? 0 : options[:s].to_i
|
11
12
|
minutes = minutes.to_i
|
12
13
|
timer = Timer.new(minutes: minutes, seconds: seconds)
|
13
14
|
timer.notifiers << Notifiers::Console.new
|
14
15
|
timer.notifiers << Notifiers::NotificationCenter.new if options[:growl]
|
16
|
+
timer.notifiers << Notifiers::Beep.new if options[:beep]
|
15
17
|
timer.start!
|
16
18
|
end
|
17
19
|
end
|
data/lib/timecrunch/version.rb
CHANGED
@@ -22,18 +22,33 @@ describe "CLI" do
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
describe "specifying notifiers" do
|
26
|
+
let(:timer) { instance_double("Timer", notifiers: []) }
|
27
|
+
let(:console) { double() }
|
28
|
+
let(:notifier) { double() }
|
29
|
+
|
30
|
+
before do
|
30
31
|
allow(Timecrunch::Notifiers::Console).to receive(:new) { console }
|
31
|
-
allow(Timecrunch::Notifiers::NotificationCenter).to receive(:new) { growl }
|
32
32
|
expect(Timecrunch::Timer).to receive(:new) { timer }
|
33
|
-
|
34
33
|
expect(timer).to receive(:start!)
|
35
|
-
|
36
|
-
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when the growl command is added" do
|
37
|
+
it "should send a console notification and a growl notification" do
|
38
|
+
allow(Timecrunch::Notifiers::NotificationCenter).to receive(:new) {
|
39
|
+
notifier
|
40
|
+
}
|
41
|
+
Timecrunch::CLI.start(["start", "--growl"])
|
42
|
+
expect(timer.notifiers).to eq [console, notifier]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "when the beep command is added" do
|
47
|
+
it "should send a console notification and beep" do
|
48
|
+
allow(Timecrunch::Notifiers::Beep).to receive(:new) { notifier }
|
49
|
+
Timecrunch::CLI.start(["start", "--beep"])
|
50
|
+
expect(timer.notifiers).to eq [console, notifier]
|
51
|
+
end
|
37
52
|
end
|
38
53
|
end
|
39
54
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'timecrunch'
|
2
|
+
|
3
|
+
describe Timecrunch::Notifiers::Beep do
|
4
|
+
describe "#notify!" do
|
5
|
+
before do
|
6
|
+
$stdout = StringIO.new
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should display output" do
|
10
|
+
notifier = Timecrunch::Notifiers::Beep.new
|
11
|
+
notifier.notify!
|
12
|
+
expect($stdout.string).to match("\a")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timecrunch
|
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
|
- Chris Keathley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -103,11 +103,13 @@ files:
|
|
103
103
|
- bin/tc
|
104
104
|
- lib/timecrunch.rb
|
105
105
|
- lib/timecrunch/cli.rb
|
106
|
+
- lib/timecrunch/notifiers/beep.rb
|
106
107
|
- lib/timecrunch/notifiers/console.rb
|
107
108
|
- lib/timecrunch/notifiers/notification_center.rb
|
108
109
|
- lib/timecrunch/timer.rb
|
109
110
|
- lib/timecrunch/version.rb
|
110
111
|
- spec/integration/cli_spec.rb
|
112
|
+
- spec/notifiers/beep_spec.rb
|
111
113
|
- spec/notifiers/console_spec.rb
|
112
114
|
- spec/notifiers/notification_center_spec.rb
|
113
115
|
- spec/timer_spec.rb
|
@@ -138,6 +140,7 @@ specification_version: 4
|
|
138
140
|
summary: A timer for timing things that need timing
|
139
141
|
test_files:
|
140
142
|
- spec/integration/cli_spec.rb
|
143
|
+
- spec/notifiers/beep_spec.rb
|
141
144
|
- spec/notifiers/console_spec.rb
|
142
145
|
- spec/notifiers/notification_center_spec.rb
|
143
146
|
- spec/timer_spec.rb
|