primadoro 0.0.0

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.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Jeremy McAnally
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ = primadoro
2
+
3
+ A neato gem for helping with Pomodoros
4
+
5
+ == Using
6
+
7
+ To use Primadoro, simply run:
8
+
9
+ primadoro
10
+
11
+ There are no configuration options yet. They are coming (and will be awesome!).
12
+
13
+ == Note on Patches/Pull Requests
14
+
15
+ * Fork the project.
16
+ * Make your feature addition or bug fix.
17
+ * Add tests for it. This is important so I don't break it in a
18
+ future version unintentionally.
19
+ * Commit, do not mess with rakefile, version, or history.
20
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
21
+ * Send me a pull request. Bonus points for topic branches.
22
+
23
+ == Copyright
24
+
25
+ Copyright (c) 2010 Jeremy McAnally. See LICENSE for details.
@@ -0,0 +1,54 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "primadoro"
8
+ gem.summary = %Q{A neato gem for helping with Pomodoros}
9
+ gem.description = %Q{A gem for executing custom actions during Pomodoros}
10
+ gem.email = "jeremymcanally@gmail.com"
11
+ gem.homepage = "http://github.com/jm/primadoro"
12
+ gem.authors = ["Jeremy McAnally"]
13
+ gem.bindir = "bin"
14
+ gem.files += Dir['resources/*']
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ end
17
+ Jeweler::GemcutterTasks.new
18
+ rescue LoadError
19
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
20
+ end
21
+
22
+ require 'rake/testtask'
23
+ Rake::TestTask.new(:test) do |test|
24
+ test.libs << 'lib' << 'test'
25
+ test.pattern = 'test/**/test_*.rb'
26
+ test.verbose = true
27
+ end
28
+
29
+ begin
30
+ require 'rcov/rcovtask'
31
+ Rcov::RcovTask.new do |test|
32
+ test.libs << 'test'
33
+ test.pattern = 'test/**/test_*.rb'
34
+ test.verbose = true
35
+ end
36
+ rescue LoadError
37
+ task :rcov do
38
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
39
+ end
40
+ end
41
+
42
+ task :test => :check_dependencies
43
+
44
+ task :default => :test
45
+
46
+ require 'rake/rdoctask'
47
+ Rake::RDocTask.new do |rdoc|
48
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
+
50
+ rdoc.rdoc_dir = 'rdoc'
51
+ rdoc.title = "primadoro #{version}"
52
+ rdoc.rdoc_files.include('README*')
53
+ rdoc.rdoc_files.include('lib/**/*.rb')
54
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.join(File.dirname(__FILE__), "..", "lib", "primadoro")
4
+ Primadoro.run
@@ -0,0 +1,105 @@
1
+ module Primadoro
2
+ class <<self
3
+ def run
4
+ # TODO: Make each of these configurable
5
+ @views = [
6
+ Views::Tunes.new,
7
+ Views::Growl.new,
8
+ Views::Sound.new
9
+ ]
10
+
11
+ @actions = {:break_time => 5, :pomodoro => 25}
12
+
13
+ while(true)
14
+ # TODO: Add action hooks later
15
+ action(:pomodoro)
16
+ action(:break_time)
17
+ end
18
+ end
19
+
20
+ def action(action_taken)
21
+ puts "#{action_taken} at #{Time.now.strftime('%D %T')}"
22
+
23
+ @views.each {|v| v.send(action_taken)}
24
+ sleep(@actions[action_taken] * 60)
25
+ end
26
+ end
27
+
28
+ module Views
29
+ class Base
30
+ # TODO: Add intermittent update displays for timers etc.
31
+ def display?(runner); false; end
32
+
33
+ def display!
34
+ raise "Implement the display! method on #{self.class.name} if you're going to make me display, fool!"
35
+ end
36
+
37
+ def pomodoro; end
38
+
39
+ def break_time; end
40
+ end
41
+
42
+ class Growl < Base
43
+ begin
44
+ require 'ruby-growl'
45
+
46
+ def initialize
47
+ @growler = ::Growl.new "localhost", "Primadoro", ["pomodoro", "break time"]
48
+ end
49
+
50
+ def pomodoro
51
+ @growler.notify "pomodoro", "Pomodoro time!", "Get your work on..." rescue puts "! Growl not configured properly (make sure you allow network connections)"
52
+ end
53
+
54
+ def break_time
55
+ @growler.notify "break time", "Break time!", "Get your break on..." rescue puts "! Growl not configured properly (make sure you allow network connections)"
56
+ end
57
+ rescue Exception
58
+ require 'rubygems'
59
+ retry
60
+
61
+ puts "! Install ruby-growl for growl support (no Windows etc. support yet)"
62
+ end
63
+ end
64
+
65
+ class Sound < Base
66
+ def play(file)
67
+ if RUBY_PLATFORM =~ /darwin/
68
+ `afplay #{file}`
69
+ elsif RUBY_PLATFORM =~ /mswin32/
70
+ `sndrec32 /play /close "#{file}"`
71
+ else
72
+ `play #{file}`
73
+ end
74
+ end
75
+
76
+ def pomodoro
77
+ play(File.join(File.dirname(__FILE__), "..", "resources", "windup.wav"))
78
+ end
79
+
80
+ def break_time
81
+ play(File.join(File.dirname(__FILE__), "..", "resources", "bell.mp3"))
82
+ end
83
+ end
84
+
85
+ class Tunes < Base
86
+ begin
87
+ require 'rbosa'
88
+
89
+ def initialize
90
+ @app = OSA.app('iTunes')
91
+ end
92
+
93
+ def pomodoro
94
+ @app.play rescue puts '! iTunes not running'
95
+ end
96
+
97
+ def break_time
98
+ @app.pause rescue puts '! iTunes not running'
99
+ end
100
+ rescue Exception
101
+ puts "! To use the iTunes integration, you need rubyosa installed! (no Windows etc. support yet)"
102
+ end
103
+ end
104
+ end
105
+ end
Binary file
Binary file
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'primadoro'
7
+
8
+ class Test::Unit::TestCase
9
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestPrimadoro < Test::Unit::TestCase
4
+ def test_something_for_real
5
+ flunk "PFFT GET REAL (tests coming real soon now since it's about to get real up in here)"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: primadoro
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 0
9
+ version: 0.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Jeremy McAnally
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-07-30 00:00:00 -04:00
18
+ default_executable: primadoro
19
+ dependencies: []
20
+
21
+ description: A gem for executing custom actions during Pomodoros
22
+ email: jeremymcanally@gmail.com
23
+ executables:
24
+ - primadoro
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - LICENSE
29
+ - README.rdoc
30
+ files:
31
+ - .document
32
+ - .gitignore
33
+ - LICENSE
34
+ - README.rdoc
35
+ - Rakefile
36
+ - VERSION
37
+ - lib/primadoro.rb
38
+ - resources/bell.mp3
39
+ - resources/windup.wav
40
+ - test/helper.rb
41
+ - test/test_primadoro.rb
42
+ has_rdoc: true
43
+ homepage: http://github.com/jm/primadoro
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options:
48
+ - --charset=UTF-8
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 0
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 1.3.6
69
+ signing_key:
70
+ specification_version: 3
71
+ summary: A neato gem for helping with Pomodoros
72
+ test_files:
73
+ - test/helper.rb
74
+ - test/test_primadoro.rb