pom 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a34dc1f5d3067d3ff95f9d6ef4bacbf47d7078e
4
+ data.tar.gz: 747fedcefaaf97c364a48e8d24593bb8a9ce7e18
5
+ SHA512:
6
+ metadata.gz: 0a181ad2705b5828d8baf340280547aa5557ea53b6d2609c9ee0340b3fd91aacff7aff196a3ad85b4fd28ad6059a38d001335e3c5c381f9509d035922a5287ae
7
+ data.tar.gz: 8a405de6f96b31218cb75a0b48c78b7f37454f91f44f5645e05f593842d6cdc2a82ee9fb9290409a45aeb67e3c7e509ab8989889b7c97bb4439825a0822ceafb
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pom.gemspec
4
+
5
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Sean Marcia
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,53 @@
1
+ # Pomodoro Timer #
2
+ ***
3
+
4
+ ### *Important Note* ###
5
+ This pomodoro gem only works on OSX 10.8.1 and later.
6
+
7
+ ### Description ###
8
+ A simple command line tool (optimized for tmux) for mountain lion for counting and maintaining your pomodoros.
9
+
10
+ ### How use it ###
11
+ First of all, install it:
12
+
13
+ gem install pom
14
+
15
+ After installing the gem running it is simple:
16
+
17
+ $ pom
18
+
19
+ The command accepts the following, optional, flags: -t, -l
20
+
21
+ Use -t to change the default length of the pomodoro from 25 minutes to the inputted value. For example, the following will change the length of the pomodoros to 20 minutes:
22
+
23
+ $ pom -t 20
24
+
25
+ Use -l to change the default number of pomodoros that much occur before the user is given a long break. By default every 4 breaks will be a long break of 15 minutes rather than the short break time of 5 minutes. The following will cause long breaks to occur after everything 3rd pomodoro:
26
+
27
+ $ pom -l 3
28
+
29
+ The following will cause pomodoros to be 3 minutes and a 15 minute break to occur after every second pomodoro:
30
+
31
+ $ pom -t 3 -l 2
32
+
33
+ ### Dependencies ###
34
+ This gem relies on the `terminal-nofifier` gem for the growl-like system notifications.
35
+
36
+
37
+ ### Contributing ###
38
+
39
+ 1. Fork it
40
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
41
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
42
+ 4. Push to the branch (`git push origin my-new-feature`)
43
+ 5. Create new Pull Request
44
+
45
+ ### FAQs ###
46
+ 1. How do you change the notification icon? This is an issue for `terminal-notifier` which uses the application's icon for the notifications. You would need to change the Terminal.icns file to your new icon. More information can be found [here](https://github.com/alloy/terminal-notifier/issues/1).
47
+ 2. Why is it a command line tool? I use tmux and found it fits well in one of the terminals.
48
+
49
+
50
+ License
51
+ -
52
+
53
+ MIT
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/pom ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pom'
3
+ include Pom
@@ -0,0 +1,98 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ require "pom/version"
4
+ require "ostruct"
5
+ require 'terminal-notifier'
6
+
7
+ module Pom
8
+
9
+ extend self
10
+
11
+ #! /usr/bin/ruby
12
+ options = ARGV
13
+ if options.include?('--help') || options.include?('-h')
14
+ puts "A simple pomodoro timer in ruby."
15
+ puts "Usage:"
16
+ puts "$ pom [-l INT -t TIME]"
17
+ puts "INT: number of pomodoros before long break occurs"
18
+ puts "TIME: time (in minutes) of a single pomodoro"
19
+ exit
20
+ end
21
+
22
+ pomodoro_time = 25 # minutes
23
+ if i = options.index('-t')
24
+ pomodoro_time = options[i+1].to_i
25
+ if pomodoro_time == 0
26
+ puts "Invalid time specified."
27
+ exit(1)
28
+ end
29
+ end
30
+
31
+ @long_interval = 4 # minutes
32
+ if i = options.index('-l')
33
+ @long_interval = options[i+1].to_i
34
+ if @long_interval == 0
35
+ puts "Invalid interval specified."
36
+ exit(1)
37
+ end
38
+ end
39
+
40
+ def beep
41
+ system "afplay #{File.join(File.dirname(__FILE__),"../resources/beep.m4a")}"
42
+ end
43
+
44
+ notifier = 'terminal-notifier -title Pomodoro -message '
45
+ pomodoro = OpenStruct.new(:name => 'Pomodoro', :time => pomodoro_time * 60, :message => 'Pomodoro Time is up!', :notifier => notifier)
46
+ short_break = OpenStruct.new(:name => 'Short break', :time => 5 * 60, :message => 'Pomodoro Break is up!', :notifier => notifier)
47
+ long_break = OpenStruct.new(:name => 'Long break', :time => 15 * 60, :message => 'Pomodoro Break is up!', :notifier => notifier)
48
+
49
+ def start(chunk)
50
+ puts "\n#{chunk.name}!"
51
+ puts "started: #{Time.now.strftime('%H:%M')} (duration: #{chunk.time/60}m)"
52
+ end
53
+
54
+ def progress(time, number_of_updates)
55
+ duration = 1.0 * time / number_of_updates
56
+ progress_bar = ''
57
+
58
+ 0.upto(number_of_updates) do |i|
59
+ percentage = (i * 1.0 / number_of_updates * 100).to_i
60
+ progress_bar << '|' << '==' * i << ' ' * (number_of_updates - i) << "| #{percentage}%\r"
61
+
62
+ print progress_bar
63
+ $stdout.flush
64
+
65
+ sleep duration
66
+ end
67
+ end
68
+
69
+ def display_stats
70
+ puts "\nYou've completed #{@pomodoro_count} full pomodoros."
71
+ exit 0
72
+ end
73
+
74
+ def long_break_time?
75
+ @pomodoro_count % @long_interval == 0
76
+ end
77
+
78
+ def finish(chunk)
79
+ `#{chunk.notifier} "#{chunk.message}" -sender com.apple.Terminal`
80
+ beep
81
+ end
82
+
83
+ def runit(chunk)
84
+ start(chunk)
85
+ progress(chunk.time, 20)
86
+ finish(chunk)
87
+ end
88
+
89
+ trap('INT') { display_stats }
90
+
91
+ @pomodoro_count = 0
92
+ loop do
93
+ runit(pomodoro)
94
+ @pomodoro_count += 1
95
+ long_break_time? ? runit(long_break) : runit(short_break)
96
+ end
97
+
98
+ end
@@ -0,0 +1,3 @@
1
+ module Pom
2
+ VERSION = "0.0.7"
3
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pom/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "pom"
8
+ gem.version = Pom::VERSION
9
+ gem.authors = ["Sean Marcia"]
10
+ gem.email = ["sean@cs.uoregon.edu"]
11
+ gem.license = 'MIT'
12
+ gem.description = %q{Pomodoro time tracker command line app for Mountain Lion and Mavericks. Just install and type pom to start it up.}
13
+ gem.summary = %q{Pomodoro App}
14
+ gem.homepage = "http://github.com/SeanMarcia/pom"
15
+ gem.add_dependency("terminal-notifier")
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = ["pom"]
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
Binary file
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pom
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
5
+ platform: ruby
6
+ authors:
7
+ - Sean Marcia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: terminal-notifier
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Pomodoro time tracker command line app for Mountain Lion and Mavericks.
28
+ Just install and type pom to start it up.
29
+ email:
30
+ - sean@cs.uoregon.edu
31
+ executables:
32
+ - pom
33
+ extensions: []
34
+ extra_rdoc_files: []
35
+ files:
36
+ - ".gitignore"
37
+ - Gemfile
38
+ - LICENSE.txt
39
+ - README.md
40
+ - Rakefile
41
+ - bin/pom
42
+ - lib/pom.rb
43
+ - lib/pom/version.rb
44
+ - pom.gemspec
45
+ - resources/beep.m4a
46
+ homepage: http://github.com/SeanMarcia/pom
47
+ licenses:
48
+ - MIT
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.2.2
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Pomodoro App
70
+ test_files: []