rooster 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.
@@ -2,6 +2,6 @@
2
2
 
3
3
  require 'rooster'
4
4
 
5
- # TODO input validation
5
+ # TODO input validation, print usage, --help?
6
6
 
7
7
  Rooster::EggTimer.new(ARGV[0], ARGV[1])
@@ -2,11 +2,23 @@ module Rooster
2
2
 
3
3
  class EggTimer
4
4
 
5
+ ONE_MINUTE = 60
6
+
5
7
  def initialize mins, text
6
- @text = text
8
+ # @start = Time.now
7
9
 
8
- sleep(mins.to_f * 60)
10
+ @text = text
11
+ @mins = mins.to_i
9
12
 
13
+ run
14
+ end
15
+
16
+ def run
17
+ while @mins > 0
18
+ puts "\"#{@text}\" in #{@mins} minutes"
19
+ sleep ONE_MINUTE
20
+ @mins -= 1
21
+ end
10
22
  alarm
11
23
  end
12
24
 
@@ -16,6 +28,8 @@ module Rooster
16
28
  TerminalNotifier.notify @text, :title => 'Egg Timer'
17
29
 
18
30
  puts @text
31
+
32
+ # puts "* Duration: #{Time.now - @start} seconds"
19
33
  end
20
34
 
21
35
  protected
@@ -1,3 +1,3 @@
1
1
  module Rooster
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rooster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: