pomo 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -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/DEVELOPMENT ADDED
@@ -0,0 +1,15 @@
1
+ To run the development rake tasks, you need bundler installed.
2
+
3
+ Before you push any changes, run the RSpec suite:
4
+
5
+ $ rake spec
6
+
7
+ To build a new version of the gem:
8
+
9
+ $ rake build
10
+
11
+ To push the new version to Rubygems:
12
+
13
+ $ rake release
14
+
15
+ (http://rubygems.org/gems/pomo)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pomo.gemspec
4
+ gemspec
@@ -1,3 +1,13 @@
1
+ 2.0.0 / 2012-12-16
2
+ ==================
3
+
4
+ * Added detach mode, on by default. To get the 1.x progress bar run `pomo start -p`. Closes #1
5
+ * Added notification support for Mac OS X User Notifications, Quicksilver and libnotify.
6
+ Growl continues to be supported. Closes #23
7
+ * Added optional tmux status bar support to display Pomo timer.
8
+ * Fixed import of Github issues list. Closes #11
9
+ * Added support for importing a single Github issue. Closes #2
10
+ * Added `pomo ls` as an alias to `pomo list`
1
11
 
2
12
  1.0.1 / 2010-03-10
3
13
  ==================
@@ -72,4 +82,4 @@
72
82
  0.0.1 / 2009-10-15
73
83
  ==================
74
84
 
75
- * Initial release
85
+ * Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
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.
data/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # Pomo
2
+
3
+ Command-line application for the [Pomodoro](http://www.pomodorotechnique.com/)
4
+ time management technique, with notification and tmux status bar support.
5
+
6
+ ## Description
7
+
8
+ With Pomo you can add, remove, list, view, and start timing tasks all via the
9
+ command-line with a simple, slick interface. You are reminded of the remaining
10
+ time on a task via Notification Center, Growl, libnotify, or Quicksilver.
11
+ These notifications appear half-way, at the 5 minute point, and when the task
12
+ duration has expired. Also, the Pomo timer can be displayed in your tmux
13
+ status bar.
14
+
15
+ ## Installation
16
+
17
+ $ gem install pomo
18
+
19
+ ## Task Selection API
20
+
21
+ Taken from `pomo help`:
22
+
23
+ Most of the subcommands work directly with tasks,
24
+ and because of this pomo provides a unified task selection api
25
+ shown below which can be used with most of the commands
26
+ (those with [task ...] in their synopsis).
27
+
28
+ n : selects a single task by index : Ex: pomo remove 1
29
+ [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
30
+ n..n : selects a range of tasks : Ex: pomo remove 5..9
31
+ n..-n : selects a range of tasks : Ex: pomo remove 2..-1
32
+ first : selects the first task : Ex: pomo remove first
33
+ last : selects the last task : Ex: pomo remove last
34
+ complete : selects complete tasks : Ex: pomo remove complete
35
+ incomplete : selects incomplete tasks : Ex: pomo remove incomplete
36
+ all : selects all tasks : Ex: pomo remove all
37
+
38
+ ## Examples
39
+
40
+ * View global or command specific help:
41
+
42
+ $ pomo help
43
+ $ pomo help add
44
+ $ pomo help remove
45
+
46
+ * Get started by adding a task:
47
+
48
+ $ pomo add "Fix IE stying issues"
49
+
50
+ And another:
51
+
52
+ $ pomo add "Destroy IE" --description "because IE is terrible"
53
+
54
+ * List your tasks (or use `pomo` which defaults to `pomo list`):
55
+
56
+ $ pomo list
57
+ 0. Fix IE stying issues : 25 minutes
58
+ 1. Destroy IE : 25 minutes
59
+
60
+ * Start the first incomplete task:
61
+
62
+ $ pomo start
63
+ Started Fix IE stying issues, you have 25 minutes :)
64
+
65
+ * Alternatively, you can start the first incomplete task with a progress bar:
66
+
67
+ $ pomo start -p
68
+ Started Fix IE stying issues, you have 25 minutes :)
69
+ (=........................) 24 minutes remaining
70
+
71
+ * Once you have completed the task, list again (alternatively `pomo ls`):
72
+
73
+ $ pomo ls
74
+ ✓ 0. Fix IE stying issues : 25 minutes
75
+ 1. Destroy IE : 25 minutes
76
+
77
+ * Or take a break:
78
+
79
+ $ pomo break
80
+ $ pomo break 10
81
+ $ pomo break --length 10
82
+
83
+ * List only remaining tasks:
84
+
85
+ $ pomo ls --incomplete
86
+ 1. Destroy IE : 25 minutes
87
+
88
+ * List only completed tasks:
89
+
90
+ $ pomo ls --complete
91
+ ✓ 0. Fix IE stying issues : 25 minutes
92
+
93
+ * At any time mid-task you may terminate pomo via CTRL + C, at which
94
+ time you may manually complete the task:
95
+
96
+ $ pomo complete first
97
+ $ pomo complete last
98
+ $ pomo complete 1
99
+ $ pomo complete all
100
+ $ pomo complete incomplete
101
+ $ pomo complete 5..7
102
+
103
+ * The next time you run `pomo start` the first incomplete task
104
+ will start:
105
+
106
+ $ pomo start
107
+
108
+ Or choose a specific task:
109
+
110
+ $ pomo start first
111
+ $ pomo start last
112
+ $ pomo start 5
113
+
114
+ * You may also remove tasks:
115
+
116
+ $ pomo remove first
117
+ $ pomo remove last
118
+ $ pomo remove 2
119
+ $ pomo remove 1
120
+ $ pomo remove 6
121
+ $ pomo rm first
122
+ $ pomo rm 2..5
123
+ $ pomo rm 1..-1
124
+
125
+ * View task details:
126
+
127
+ $ pomo view first
128
+ $ pomo view last
129
+ $ pomo view 5
130
+ $ pomo view 1 2 3
131
+
132
+ * Remove all tasks:
133
+
134
+ $ pomo remove all
135
+ $ pomo rm all
136
+
137
+ * Or if you prefer, create a directory specific task list. Pomo will
138
+ auto-detect `./.pomo` in this directory, and utilize its contents.
139
+
140
+ $ pomo init
141
+
142
+ ## Configuration
143
+
144
+ Pomo uses `~/.pomorc` for configuration options.
145
+
146
+ Configuration options:
147
+
148
+ * `:notifier`: Notification library
149
+ * Format: String
150
+ * Default: depends on OS
151
+ * Valid values: `notification_center`, `libnotify`, `growl`, `quicksilver`
152
+ * `:tmux`: Refresh tmux status bar on timer change
153
+ * Format: Boolean
154
+ * Default: `false`
155
+ * Valid values: `true`, `false`
156
+
157
+ For example on Mac OS X Mountain Lion, `~/.pomorc` defaults to:
158
+
159
+ ---
160
+ :notifier: notification_center
161
+ :tmux: false
162
+
163
+ ## tmux Status Bar Integration
164
+
165
+ The Pomo timer can be displayed in tmux's status bar with the following
166
+ configurations set:
167
+
168
+ :tmux: true
169
+
170
+ Then add the below to your `~/.tmux.conf`:
171
+
172
+ set-option -g status-right '#(cat ~/.pomo_stat)'
173
+
174
+ The timer will display with the default color when not active,
175
+ green during a Pomodoro, red during the last 5 minutes of a Pomodoro,
176
+ and blue during a break e.g.
177
+
178
+ ![tmux status bar](http://i.imgur.com/uIzM3.png)
179
+
180
+ ## Contributing
181
+
182
+ 1. Fork it
183
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
184
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
185
+ 4. Push to the branch (`git push origin my-new-feature`)
186
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,17 +1,8 @@
1
+ require 'rspec/core/rake_task'
2
+ require 'bundler/gem_tasks'
1
3
 
2
- $:.unshift 'lib'
3
- require 'pomo'
4
- require 'rubygems'
5
- require 'rake'
6
- require 'echoe'
7
-
8
- Echoe.new "pomo", Pomo::VERSION do |p|
9
- p.author = "TJ Holowaychuk"
10
- p.email = "tj@vision-media.ca"
11
- p.summary = "Pomodoro time management for the command-line"
12
- p.url = "http://github.com/visionmedia/pomo"
13
- p.runtime_dependencies << 'commander >=4.0.2'
14
- p.runtime_dependencies << 'growl >=1.0.3'
4
+ desc 'Run specs'
5
+ RSpec::Core::RakeTask.new do |t|
6
+ t.verbose = false
7
+ t.rspec_opts = '--color'
15
8
  end
16
-
17
- Dir['tasks/**/*.rake'].sort.each { |f| load f }
data/bin/pomo CHANGED
@@ -1,18 +1,19 @@
1
1
  #!/usr/bin/env ruby
2
2
  # coding: utf-8
3
3
 
4
- $:.unshift File.dirname(__FILE__) + '/../lib'
4
+ $:.unshift File.dirname(__FILE__) + '/../lib'
5
5
  require 'rubygems'
6
6
  require 'commander/import'
7
7
  require 'pomo'
8
8
 
9
9
  program :version, Pomo::VERSION
10
+
10
11
  program :description, "Pomodoro time management.
11
- Most of the subcommands work directly with tasks, and
12
+ Most of the subcommands work directly with tasks, and
12
13
  because of this pomo provides a unified task selection api
13
- shown below which can be used with most of the commands
14
- (those with [task ...] in their synopsis).
15
-
14
+ shown below which can be used with most of the commands
15
+ (those with [task ...] in their synopsis).
16
+
16
17
  n : selects a single task by index : Ex: pomo remove 1
17
18
  [n ]+ : selects several tasks by index : Ex: pomo remove 2 8 1
18
19
  n..n : selects a range of tasks : Ex: pomo remove 5..9
@@ -28,7 +29,8 @@ program :int_message, "\nTerminated pomo" \
28
29
  "\n * previously running tasks not marked as complete" \
29
30
  "\n * manually complete a task with `$ pomo complete <task>`"
30
31
 
31
- list = Pomo::List.new File.exists?('.pomo') ? '.pomo' : '~/.pomo'
32
+ config = Pomo::Configuration.new
33
+ list = Pomo::List.new
32
34
 
33
35
  default_command :list
34
36
 
@@ -36,11 +38,11 @@ command :init do |c|
36
38
  c.syntax = 'pomo init [options]'
37
39
  c.description = 'Initialize pomo in the current directory'
38
40
  c.action do |args, options|
39
- Pomo::List.new '.pomo'
40
- say "Initialized at `./.pomo`"
41
- say " - Any commands run while in this directory will reference this file for tasks"
42
- say " - To remove simply execute `rm .pomo`"
43
- end
41
+ Pomo::List.new :init => true
42
+ say 'Initialized at `./.pomo`'
43
+ say ' - Any commands run while in this directory will reference this file for tasks'
44
+ say ' - To remove simply execute `rm .pomo`'
45
+ end
44
46
  end
45
47
 
46
48
  command :start do |c|
@@ -51,44 +53,56 @@ command :start do |c|
51
53
  c.example 'Start the first task', 'pomo start 0'
52
54
  c.example 'Start the first task', 'pomo start first'
53
55
  c.example 'Start the fifth task', 'pomo start 5'
56
+ c.option '-p', '--progress', 'Run with progress bar in foreground'
54
57
  c.action do |args, options|
58
+ abort 'a task is already running' if list.running
59
+
60
+ options.default :progress => false
55
61
  args = ['incomplete'] if args.empty?
56
62
  list.find(*args) do |task, i|
57
63
  abort 'task already completed' if task.complete?
58
- say "Started #{task}, you have #{task.length} minutes :)"
59
- task.start
60
- list.save
64
+ task.start(config, :progress => options.progress, :list => list)
61
65
  break
62
66
  end
63
67
  end
64
68
  end
65
69
 
66
70
  command :import do |c|
67
- c.syntax = 'pomo import <user> <project> [options]'
71
+ c.syntax = 'pomo import <user> <project> [issue_number]'
68
72
  c.summary = 'Import Github project issues'
69
73
  c.description = 'Import Github project issues which have not yet been closed'
74
+ c.example 'Import all open Github issues from "visionmedia/pomo"', 'pomo import visionmedia pomo'
75
+ c.example 'Import Github issue #3 from "visionmedia/pomo"', 'pomo import visionmedia pomo 3'
70
76
  c.action do |args, options|
71
- gem 'octopi', '>=0.2.1'
72
- require 'octopi'
73
77
  user = args.shift or raise('Github <user> is required')
74
78
  project = args.shift or raise('Github <project> is required')
75
- if repo = Octopi::Repository.find(:user => user, :name => project)
76
- say "Importing items from http://github.com/#{user}/#{project}"
77
- repo.issues.select { |i| not i.closed_at }.each do |issue|
78
- task = Pomo::GithubTask.new issue.title,
79
+ number = args.shift
80
+ begin
81
+ if number
82
+ issues = [Octokit.issue({:username => user, :repo => project}, number)]
83
+ else
84
+ issues = Octokit.list_issues({:username => user, :repo => project}, :state => 'open', :sort => 'created')
85
+ end
86
+ issues.each_with_index do |issue, index|
87
+ say "Importing issues from https://github.com/#{user}/#{project}" if index == 0
88
+ task = Pomo::GithubTask.new(issue.title,
79
89
  :username => user,
80
90
  :project => project,
81
91
  :description => issue.body,
82
- :labels => issue.labels,
92
+ :labels => issue.labels.map(&:name),
83
93
  :number => issue.number
94
+ )
84
95
  list << task
85
96
  say " - Added #{task}"
86
97
  end
87
98
  list.save
99
+ rescue Octokit::NotFound => e
100
+ say '404: This is not the repo you are looking for.'
101
+ say e.message
88
102
  end
89
103
  end
90
104
  end
91
-
105
+
92
106
  command :add do |c|
93
107
  c.syntax = 'pomo add <task> [options]'
94
108
  c.summary = 'Add a task'
@@ -134,10 +148,12 @@ command :break do |c|
134
148
  c.example 'Take a 30 minute break', 'pomo break 30'
135
149
  c.example 'Take a 30 minute break', 'pomo break --length 30'
136
150
  c.option '-l', '--length minutes', Integer, 'Change the default length in minutes'
151
+ c.option '-p', '--progress', 'Run with progress bar in foreground'
137
152
  c.action do |args, options|
153
+ options.default :progress => false
138
154
  options.default :length => args.first ? args.first.to_i : 5
139
- task = Pomo::Task.new('Break time', options.__hash__)
140
- task.start
155
+ task = Pomo::Break.new('Break time', options.__hash__)
156
+ task.start(config, :progress => options.progress)
141
157
  end
142
158
  end
143
159
 
@@ -220,7 +236,7 @@ command :incomplete do |c|
220
236
  end
221
237
 
222
238
  command :list do |c|
223
- c.syntax = 'pomo list [options]'
239
+ c.syntax = 'pomo [list|ls] [options]'
224
240
  c.description = 'List all tasks'
225
241
  c.example 'List all tasks', 'pomo list'
226
242
  c.option '-c', '--complete', 'List only completed tasks'
@@ -236,4 +252,5 @@ command :list do |c|
236
252
  say ' ' * 55 + '%d minutes' % total
237
253
  end
238
254
  end
255
+ alias_command :ls, :list
239
256
 
data/lib/pomo.rb CHANGED
@@ -1,29 +1,15 @@
1
- #--
2
- # Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining
5
- # a copy of this software and associated documentation files (the
6
- # "Software"), to deal in the Software without restriction, including
7
- # without limitation the rights to use, copy, modify, merge, publish,
8
- # distribute, sublicense, and/or sell copies of the Software, and to
9
- # permit persons to whom the Software is furnished to do so, subject to
10
- # the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- #++
23
-
24
1
  require 'yaml'
25
- require 'growl'
2
+ require 'octokit'
3
+ require 'terminal-notifier' if /darwin/ =~ RUBY_PLATFORM
4
+ require 'growl' if /darwin/ =~ RUBY_PLATFORM
5
+ require 'libnotify' if /linux/ =~ RUBY_PLATFORM
6
+ require 'pomo/configuration'
7
+ require 'pomo/notifier'
8
+ require 'pomo/notifier/notification_center'
9
+ require 'pomo/notifier/growl'
10
+ require 'pomo/notifier/libnotify'
26
11
  require 'pomo/list'
27
12
  require 'pomo/task'
28
13
  require 'pomo/github_task'
29
- require 'pomo/version'
14
+ require 'pomo/break'
15
+ require 'pomo/version'