thyme 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.
Files changed (3) hide show
  1. data/README.md +3 -1
  2. data/thyme.rb +8 -4
  3. metadata +3 -3
data/README.md CHANGED
@@ -14,7 +14,7 @@ Usage
14
14
  Start thyme with:
15
15
 
16
16
  $ thyme
17
- [=== ] 24:59
17
+ [= ] 24:59
18
18
 
19
19
  You'll have 25 minutes by default. `Ctrl-C` to interrupt. You can also start
20
20
  it in daemon mode, which is only useful if you've got tmux integration to notify
@@ -33,6 +33,7 @@ Thyme is configurable and extensible. All configurations live in the
33
33
 
34
34
  set :timer, 25
35
35
  set :tmux, true
36
+ set :seconds, true
36
37
 
37
38
  option :o, :open, 'open sheets' do
38
39
  `vim -O ~/.thyme-today.md ~/.thyme-records.md < \`tty\` > \`tty\``
@@ -50,6 +51,7 @@ The `set` method sets different configurations. There are only two:
50
51
 
51
52
  * `:timer` is the number of minutes to countdown from
52
53
  * `:tmux` is whether or not you want tmux integration on (off by default)
54
+ * `:seconds` determines whether to refresh the timer every second or minute
53
55
 
54
56
  The `option` method adds new options to the `thyme` command. In the above
55
57
  example, we can now execute `thyme -o`. Use `thyme -h` to see available
data/thyme.rb CHANGED
@@ -2,15 +2,16 @@ require 'ruby-progressbar'
2
2
  require 'date'
3
3
 
4
4
  class Thyme
5
- VERSION = '0.0.2'
5
+ VERSION = '0.0.3'
6
6
  CONFIG_FILE = "#{ENV['HOME']}/.thymerc"
7
7
  PID_FILE = "#{ENV['HOME']}/.thyme-pid"
8
8
  TMUX_FILE = "#{ENV['HOME']}/.thyme-tmux"
9
- OPTIONS = [:timer, :tmux]
9
+ OPTIONS = [:timer, :tmux, :seconds]
10
10
 
11
11
  def initialize
12
12
  @timer = 25
13
13
  @tmux = false
14
+ @seconds = true
14
15
  end
15
16
 
16
17
  def run
@@ -18,6 +19,7 @@ class Thyme
18
19
  start = @timer * 60
19
20
  start_time = DateTime.now
20
21
  seconds = start + 1
22
+ delta = @seconds ? 1 : 60
21
23
  min_length = (seconds / 60).floor.to_s.length
22
24
  tmux_file = File.open(TMUX_FILE, "w")
23
25
  bar = ProgressBar.create(
@@ -37,7 +39,7 @@ class Thyme
37
39
  tmux_file.write("#[default]#[fg=#{fg}]#{title}#[default]")
38
40
  tmux_file.flush
39
41
  end
40
- sleep(1)
42
+ sleep(delta)
41
43
  end
42
44
  rescue SignalException => e
43
45
  puts ""
@@ -100,7 +102,9 @@ class Thyme
100
102
  lead = ' ' * (min_length - min.to_s.length)
101
103
  sec = (seconds % 60).floor
102
104
  sec = "0#{sec}" if sec.to_s.length == 1
103
- "#{lead}#{min}:#{sec}"
105
+ @seconds ?
106
+ "#{lead}#{min}:#{sec}" :
107
+ "#{lead}#{min}m"
104
108
  end
105
109
 
106
110
  def color(seconds)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thyme
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:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: .
11
11
  cert_chain: []
12
- date: 2013-05-31 00:00:00.000000000 Z
12
+ date: 2013-06-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-progressbar
@@ -57,7 +57,7 @@ files:
57
57
  - README.md
58
58
  - thyme
59
59
  - ./thyme
60
- homepage: https://github.com/hughbien/thyme
60
+ homepage: http://thymerb.com
61
61
  licenses: []
62
62
  post_install_message:
63
63
  rdoc_options: []