tmuxodoro 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e09e03af89e8b2a3ad8a547245ed87cdaddf2373
4
- data.tar.gz: 3ab70098e7a9503f31256975bf2220b7e5b0fe87
3
+ metadata.gz: 0e3a2d5b139d887365645589ec3071612a116a8e
4
+ data.tar.gz: 3ef177fe2b4d5cbfd2a94fa8de825275488cf289
5
5
  SHA512:
6
- metadata.gz: 49269d25b60572ce93b8788fbf4a30442a909e9b1030ca5cf9e5828ce38e05871e68f7a95842c9023b0bd984d037a7529ee7d40b6bd72fa6bdd5f08c33f89a63
7
- data.tar.gz: f61d465bd347594aebd83035bb9b5ffcd0bb391e09641fba86c9c2bbe79dac18e1b7820f5d913d56d00691088a3c4073ab4b48427b1fd5301347cecada910166
6
+ metadata.gz: ee6117d7ac981c065d3f3b444394104b258994ef11204f9ddd8bc00f9aeb1309c3bb9f62f590d881b6fdb472eed625160e96d69e351c6c1ea144aaadcfb88468
7
+ data.tar.gz: a10be0223de1095ce490357ded338e8144cd10a1a8c909763a233de3777dd0d4523f5be640ce9c6153b9cd894160c43d2bea5a437e8f5e14bc508d429511d886
data/lib/tmuxodoro.rb CHANGED
@@ -22,7 +22,7 @@ module Tmuxodoro
22
22
  server.mount_proc('/restart') do |req, resp|
23
23
  pomodoro = Pomodoro.new(args)
24
24
  resp['Content-Type'] = 'text/plain'
25
- resp.body = "Tomatos have been reset\n"
25
+ resp.body = "Tomatoes have been reset\n"
26
26
  end
27
27
 
28
28
  server.start
@@ -1,10 +1,10 @@
1
1
  class Pomodoro
2
2
  MINUTE = 60
3
3
 
4
- attr_reader :tomatoes, :tomato_time, :rest_time, :stop_at
4
+ attr_reader :tomatoes, :tomato_time, :rest_time, :stop_at, :initial_tomatoes
5
5
 
6
6
  def initialize(tomatoes: nil, tomato_time: nil, rest_time: nil)
7
- @tomatoes = tomatoes || 8
7
+ @tomatoes = @initial_tomatoes = tomatoes || 8
8
8
  @tomato_time = tomato_time || 25 * MINUTE
9
9
  @rest_time = rest_time || 5 * MINUTE
10
10
  end
@@ -17,11 +17,12 @@ class Pomodoro
17
17
  "rest: #{remaining_rest_time} min\n"
18
18
  end
19
19
  else
20
- "🍅 #{tomatoes}\n"
20
+ remain_tomatoes_status
21
21
  end
22
22
  end
23
23
 
24
24
  def start
25
+ @tomatoes = initial_tomatoes if tomatoes == 0
25
26
  @tomatoes -= 1
26
27
  @stop_at = Time.now + tomato_time
27
28
  end
@@ -45,4 +46,8 @@ class Pomodoro
45
46
  return unless stop_at
46
47
  ((stop_at + rest_time - Time.now) / MINUTE).ceil
47
48
  end
49
+
50
+ def remain_tomatoes_status
51
+ tomatoes > 0 ? "🍅 #{tomatoes}\n" : "work is done\n"
52
+ end
48
53
  end
@@ -1,3 +1,3 @@
1
1
  module Tmuxodoro
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmuxodoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timur Yanberdin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler