tomate 0.0.2 → 1.0.0

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: 0f98447e873b0bf5f05430411f386a79e1fb8ba3
4
- data.tar.gz: 2fceb92fc1b72ad8ad7acc967a5b84528c864b01
3
+ metadata.gz: 6b75b364b0e4c202aa62a5345076eb4e32a33f85
4
+ data.tar.gz: a03b87cbaaa9a5a748b90d5c2dfb747f479f5b46
5
5
  SHA512:
6
- metadata.gz: 10371171b311ab697469b4bf43bac958092cd975f052dd11e946c702fa8bb9631733835bb84d01353ba1bd01a37ec402f0b9f2192b114cc1e99de9a4b2891da7
7
- data.tar.gz: 7faf80d0c2f0043fc5a7ad5111152900be8f99603603d2ba6e22a21779f723957392b8430f872ae8392a3f0988b05d8bbd81acd584e1d03af1551017f9fed504
6
+ metadata.gz: 0d4ebac214f5be7013d08e108ad53e862e16d48bcddc11d57f6e01bfc3e17eb019fc4ce8b6b6c8107eb21b72caca2264b647e56ec55902f3898a2b55188b8713
7
+ data.tar.gz: e4a3f979864410661dc625d5e948dd60bfe8e9a18917655a77fbae3d43f35317ad42ac3b1a800c16c692e62fdb829e68e17b2878649aac425dc9bf80a23c5f26
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
- # Tomate [![Gem Version](https://badge.fury.io/rb/tomate.png)](http://badge.fury.io/rb/tomate) [![Dependency Status](https://gemnasium.com/tbuehlmann/tomate.png)](https://gemnasium.com/tbuehlmann/tomate)
1
+ # Tomate [![Gem Version](https://badge.fury.io/rb/tomate.png)](http://badge.fury.io/rb/tomate) [![Build Status](https://travis-ci.org/tbuehlmann/tomate.svg)](https://travis-ci.org/tbuehlmann/tomate) [![Dependency Status](https://gemnasium.com/tbuehlmann/tomate.png)](https://gemnasium.com/tbuehlmann/tomate)
2
2
  A Ruby based Pomodoro timer.
3
3
 
4
+ ![Pomodoro Start](/images/pomodoro_start.png?raw=true "Pomodoro Start")
5
+ ![Pomodoro Finish](/images/pomodoro_finish.png?raw=true "Pomodoro Finish")
6
+
4
7
  ## Requirements
5
8
  - Ruby ≥ 1.9.2
9
+ - Ability to fork (*nix)
6
10
  - libnotify-bin
7
11
 
8
12
  ## Installation
@@ -0,0 +1,5 @@
1
+ require 'rspec/core/rake_task'
2
+
3
+ RSpec::Core::RakeTask.new(:spec)
4
+
5
+ task default: :spec
data/bin/tomate CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require 'slop'
3
4
  require 'tomate'
4
5
 
5
6
  options = Slop.parse(help: true) do
@@ -1,9 +1,4 @@
1
- require 'slop'
2
-
3
1
  module Tomate
4
2
  require 'tomate/timer'
5
3
  require 'tomate/version'
6
-
7
- dir = File.dirname(File.realpath(__FILE__))
8
- POMODORO_PNG = File.join(dir, 'tomate', 'images', 'pomodoro.png')
9
4
  end
@@ -2,18 +2,24 @@ module Tomate
2
2
  class Timer
3
3
  DEFAULT_DELAY = 25*60
4
4
 
5
- def initialize(delay)
5
+ def initialize(delay = nil)
6
6
  @delay = Integer(delay || DEFAULT_DELAY)
7
7
  end
8
8
 
9
9
  def start
10
- pid = fork do
11
- Kernel.system('notify-send', '-i', POMODORO_PNG, 'Pomodoro', "Timer started: #{@delay} seconds.")
10
+ fork_only!
11
+
12
+ fork do
13
+ system('notify-send', '-i', 'Pomodoro', "Timer started: #{@delay} seconds.")
12
14
  sleep @delay
13
- Kernel.system('notify-send', '-u', 'critical', '-t', '60000', '-i',POMODORO_PNG, 'Pomodoro', 'Take a break, nerd!')
15
+ system('notify-send', '-u', 'critical', '-t', '60000', '-i', 'Pomodoro', 'Take a break, nerd!')
14
16
  end
17
+ end
18
+
19
+ private
15
20
 
16
- Process.detach(pid)
21
+ def fork_only!
22
+ fail 'Your operating system does not support forking.' unless Process.respond_to?(:fork)
17
23
  end
18
24
  end
19
25
  end
@@ -1,3 +1,3 @@
1
1
  module Tomate
2
- VERSION = Gem::Version.new('0.0.2')
2
+ VERSION = Gem::Version.new('1.0.0')
3
3
  end
@@ -0,0 +1,6 @@
1
+ require File.expand_path('../../lib/tomate', __FILE__)
2
+ require 'pry'
3
+
4
+ RSpec.configure do |config|
5
+ config.order = 'random'
6
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tomate::Timer do
4
+ describe '#initialize' do
5
+ it 'raises for an invalid delay' do
6
+ expect { described_class.new('foo') }.to raise_error(ArgumentError)
7
+ end
8
+ end
9
+
10
+ describe '#start' do
11
+ context 'with fork not available' do
12
+ before(:each) do
13
+ allow(Process).to receive(:respond_to?).with(:fork) { false }
14
+ end
15
+
16
+ it 'fails' do
17
+ expect { subject.start }.to raise_error(RuntimeError)
18
+ end
19
+ end
20
+
21
+ context 'with fork available' do
22
+ before(:each) do
23
+ allow(subject).to receive(:fork).and_yield
24
+ end
25
+
26
+ it 'sends notify-send notifications' do
27
+ expect(subject).to receive(:system).twice
28
+ expect(subject).to receive(:sleep).with(Tomate::Timer::DEFAULT_DELAY)
29
+
30
+ subject.start
31
+ end
32
+ end
33
+ end
34
+ end
@@ -13,12 +13,28 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = 'https://github.com/tbuehlmann/tomate'
14
14
  spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.require_paths = ['lib']
17
+ spec.files = %w(
18
+ .rspec
19
+ Gemfile
20
+ LICENSE
21
+ Rakefile
22
+ README.md
23
+ bin/tomate
24
+ lib/tomate.rb
25
+ lib/tomate/timer.rb
26
+ lib/tomate/version.rb
27
+ spec/spec_helper.rb
28
+ spec/timer_spec.rb
29
+ tomate.gemspec
30
+ )
17
31
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
32
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ['lib']
20
33
 
21
34
  spec.required_ruby_version = '>= 1.9.2'
22
- spec.add_dependency('slop', '~> 3.4')
23
- spec.add_development_dependency 'bundler', '~> 1.3'
35
+ spec.add_dependency('slop', '~> 3.5')
36
+ spec.add_development_dependency 'bundler', '~> 1.6'
37
+ spec.add_development_dependency 'rake', '~> 10.3'
38
+ spec.add_development_dependency 'rspec', '~> 2.14'
39
+ spec.add_development_dependency 'pry', '0.9.12.6'
24
40
  end
metadata CHANGED
@@ -1,43 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tomate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Bühlmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-17 00:00:00.000000000 Z
11
+ date: 2014-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.4'
19
+ version: '3.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.4'
26
+ version: '3.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1.6'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.6'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.14'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.14'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.12.6
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.12.6
41
83
  description: Starts a Pomodoro timer and notifies via notify-send.
42
84
  email:
43
85
  - tobias.buehlmann@gmx.de
@@ -46,15 +88,17 @@ executables:
46
88
  extensions: []
47
89
  extra_rdoc_files: []
48
90
  files:
49
- - .gitignore
91
+ - ".rspec"
50
92
  - Gemfile
51
93
  - LICENSE
52
94
  - README.md
95
+ - Rakefile
53
96
  - bin/tomate
54
97
  - lib/tomate.rb
55
- - lib/tomate/images/pomodoro.png
56
98
  - lib/tomate/timer.rb
57
99
  - lib/tomate/version.rb
100
+ - spec/spec_helper.rb
101
+ - spec/timer_spec.rb
58
102
  - tomate.gemspec
59
103
  homepage: https://github.com/tbuehlmann/tomate
60
104
  licenses:
@@ -66,18 +110,20 @@ require_paths:
66
110
  - lib
67
111
  required_ruby_version: !ruby/object:Gem::Requirement
68
112
  requirements:
69
- - - '>='
113
+ - - ">="
70
114
  - !ruby/object:Gem::Version
71
115
  version: 1.9.2
72
116
  required_rubygems_version: !ruby/object:Gem::Requirement
73
117
  requirements:
74
- - - '>='
118
+ - - ">="
75
119
  - !ruby/object:Gem::Version
76
120
  version: '0'
77
121
  requirements: []
78
122
  rubyforge_project:
79
- rubygems_version: 2.0.3
123
+ rubygems_version: 2.2.2
80
124
  signing_key:
81
125
  specification_version: 4
82
126
  summary: Ruby based Pomodoro timer.
83
- test_files: []
127
+ test_files:
128
+ - spec/spec_helper.rb
129
+ - spec/timer_spec.rb
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp