pomato 0.0.3 → 0.0.4

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: 1809867009864c93d7006f1e5a7824f7c47000b1
4
- data.tar.gz: df303a5d703d86f3094fba112baa67de4b94ab6b
3
+ metadata.gz: b9be8524db2da9247a63d00806f7ab672bbbdbea
4
+ data.tar.gz: a8776fbdb2e6277b47942fca4049511bc50a8cad
5
5
  SHA512:
6
- metadata.gz: bddd7124c363561fff104a68a1d2ae0c2090915146b8f0ca1ca1f95941579441833c840b75bd75d93505d5ee317979552f2190f3eecfb1f9dafe0d364338a94f
7
- data.tar.gz: 9362cbc77726ab8c1acf348213a617b8ee2a21ff35fac464b89c3658d9c7d9fe0a02da57f01339197a93e99bfc4d6b530c9dc3d4acda2691aef768adf4e86d7b
6
+ metadata.gz: e4c2cf32956c744e23215b1360350749a982f7c71796294662abcae8d38a4af3fe28e82b8b0fb2a92f479ef9e03815cb69afcd20f12b4b8cf0519f86407fadcc
7
+ data.tar.gz: 4c557678d524fba9f075f5ab73a76050daccca78ba38c990c0a24896335e49a10d48885f3ea028357fd29b757b183816a39dc9f2804271cc12d139ba6f51fa77
data/bin/pomato_daemon ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH << File.dirname(__FILE__)+'/../lib'
4
+
5
+ require 'daemons'
6
+ require 'pomato/report'
7
+ require 'pomato/run'
8
+
9
+ Pomato::Report.new.execute
10
+ Daemons.run_proc('pomato', dir_mode: :normal, dir: '~/.pomato') do
11
+ Pomato::Run.new.execute
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'pomato/tick'
2
+
3
+ module Pomato
4
+ class Configure
5
+ include Paths
6
+
7
+ def execute(*args)
8
+ puts 'which track would you like to play when the timer ends?'
9
+ self.config = { track: $stdin.gets.chomp }
10
+ end
11
+ end
12
+ end
data/lib/pomato/paths.rb CHANGED
@@ -16,20 +16,24 @@ module Pomato
16
16
  @now ||= Time.now.to_i
17
17
  end
18
18
 
19
+ def config
20
+ load_yaml path_to 'config'
21
+ end
22
+
23
+ def config=(data)
24
+ dump_yaml path_to('config'), data
25
+ end
26
+
19
27
  def play_alert
20
- `afplay #{path_to('alert.mp3')}`
28
+ `afplay #{config[:track]}`
21
29
  end
22
30
 
23
31
  def history(message)
24
- append_to history_path, "#{now} #{message}"
32
+ append_to path_to('history'), "#{now} #{message}"
25
33
  end
26
34
 
27
35
  def history_items
28
- File.exist?(history_path) ? File.readlines(history_path) : []
29
- end
30
-
31
- def history_path
32
- File.join home, 'history'
36
+ File.exist?(path_to('history')) ? File.readlines(path_to('history')) : []
33
37
  end
34
38
 
35
39
  def path_to(name)
data/lib/pomato/run.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'pomato/tick'
2
+
3
+ module Pomato
4
+ class Run
5
+ include Paths
6
+
7
+ def execute(*args)
8
+ loop do
9
+ Pomato::Tick.new.execute
10
+ sleep 10
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Pomato
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/pomato.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
+ spec.add_dependency 'daemons', '~> 1.1'
21
+
20
22
  spec.add_development_dependency 'bundler', '~> 1.7'
21
23
  spec.add_development_dependency 'rake', '~> 10.0'
22
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pomato
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Ryall
@@ -10,6 +10,20 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: daemons
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +57,7 @@ email:
43
57
  - mark@ryall.name
44
58
  executables:
45
59
  - pomato
60
+ - pomato_daemon
46
61
  extensions: []
47
62
  extra_rdoc_files: []
48
63
  files:
@@ -52,10 +67,13 @@ files:
52
67
  - README.md
53
68
  - Rakefile
54
69
  - bin/pomato
70
+ - bin/pomato_daemon
55
71
  - lib/pomato.rb
72
+ - lib/pomato/configure.rb
56
73
  - lib/pomato/history.rb
57
74
  - lib/pomato/paths.rb
58
75
  - lib/pomato/report.rb
76
+ - lib/pomato/run.rb
59
77
  - lib/pomato/start.rb
60
78
  - lib/pomato/stop.rb
61
79
  - lib/pomato/tick.rb