pomo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -0
- data/Manifest +16 -0
- data/Rakefile +17 -0
- data/Readme.md +35 -0
- data/bin/pomo +89 -0
- data/lib/pomo/list.rb +51 -0
- data/lib/pomo/task.rb +63 -0
- data/lib/pomo/version.rb +4 -0
- data/lib/pomo.rb +28 -0
- data/pomo.gemspec +38 -0
- data/spec/pomo_spec.rb +8 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +3 -0
- data/tasks/docs.rake +13 -0
- data/tasks/gemspec.rake +3 -0
- data/tasks/spec.rake +25 -0
- metadata +101 -0
data/History.md
ADDED
data/Manifest
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
History.md
|
2
|
+
Manifest
|
3
|
+
Rakefile
|
4
|
+
Readme.md
|
5
|
+
bin/pomo
|
6
|
+
lib/pomo.rb
|
7
|
+
lib/pomo/list.rb
|
8
|
+
lib/pomo/task.rb
|
9
|
+
lib/pomo/version.rb
|
10
|
+
pomo.gemspec
|
11
|
+
spec/pomo_spec.rb
|
12
|
+
spec/spec.opts
|
13
|
+
spec/spec_helper.rb
|
14
|
+
tasks/docs.rake
|
15
|
+
tasks/gemspec.rake
|
16
|
+
tasks/spec.rake
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
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.0'
|
14
|
+
p.runtime_dependencies << 'growl >=1.0.3'
|
15
|
+
end
|
16
|
+
|
17
|
+
Dir['tasks/**/*.rake'].sort.each { |f| load f }
|
data/Readme.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
# Pomo
|
3
|
+
|
4
|
+
Command-line application for the [Pomodoro](http://www.pomodorotechnique.com/) time management technique.
|
5
|
+
|
6
|
+
## Features
|
7
|
+
|
8
|
+
* Communicates via Growl
|
9
|
+
|
10
|
+
## Examples
|
11
|
+
|
12
|
+
## License
|
13
|
+
|
14
|
+
(The MIT License)
|
15
|
+
|
16
|
+
Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
|
17
|
+
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
19
|
+
a copy of this software and associated documentation files (the
|
20
|
+
'Software'), to deal in the Software without restriction, including
|
21
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
22
|
+
distribute, sublicense, an d/or sell copies of the Software, and to
|
23
|
+
permit persons to whom the Software is furnished to do so, subject to
|
24
|
+
the following conditions:
|
25
|
+
|
26
|
+
The above copyright notice and this permission notice shall be
|
27
|
+
included in all copies or substantial portions of the Software.
|
28
|
+
|
29
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
30
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
31
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
32
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
33
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
34
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
35
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/bin/pomo
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
4
|
+
require 'rubygems'
|
5
|
+
require 'commander/import'
|
6
|
+
require 'pomo'
|
7
|
+
|
8
|
+
program :version, Pomo::VERSION
|
9
|
+
program :description, 'Pomodoro time management'
|
10
|
+
program :int_message, "\nTerminated pomodoro; any tasks which were running will not be marked as complete"
|
11
|
+
|
12
|
+
list = Pomo::List.new '~/.pomo'
|
13
|
+
|
14
|
+
command :start do |c|
|
15
|
+
c.syntax = 'pomo start [number] [options]'
|
16
|
+
c.summary = 'Start a task'
|
17
|
+
c.description = 'Start a task, given the task [number] or the first task'
|
18
|
+
c.action do |args, options|
|
19
|
+
task = list.tasks.at(args.first ? args.first.to_i : 0)
|
20
|
+
abort 'task already completed' if task.complete?
|
21
|
+
say "Started #{task}, you have #{task.length} minutes :)"
|
22
|
+
task.start
|
23
|
+
list.save
|
24
|
+
end
|
25
|
+
end
|
26
|
+
alias_command :'start first', :start, '0'
|
27
|
+
alias_command :'start last', :start, list.tasks.length - 1
|
28
|
+
|
29
|
+
command :add do |c|
|
30
|
+
c.syntax = 'pomo add <task> [options]'
|
31
|
+
c.summary = 'Add a task'
|
32
|
+
c.description = 'Add a task to the current list of tasks'
|
33
|
+
c.example 'Adds the task "fix IE styling issues"', 'pomo add "fix IE styling issues"'
|
34
|
+
c.example 'Add a task with 60 minute limit', 'pomo add "create executable" --length 60'
|
35
|
+
c.option '-d', '--description string', 'Add verbose task description'
|
36
|
+
c.option '-l', '--length minutes', Integer, 'Change the default length in minutes'
|
37
|
+
c.action do |args, options|
|
38
|
+
task = Pomo::Task.new(args.shift, options.__hash__)
|
39
|
+
list << task
|
40
|
+
list.save
|
41
|
+
say "Task #{task} added"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
command :remove do |c|
|
46
|
+
c.syntax = 'pomo [remove|rm] <number> [options]'
|
47
|
+
c.summary = 'Remove a task'
|
48
|
+
c.description = 'Remove a task, given the task <number>'
|
49
|
+
c.action do |args, options|
|
50
|
+
list.tasks.each_with_index do |task, i|
|
51
|
+
if i == args.first.to_i
|
52
|
+
list.tasks.delete_at i
|
53
|
+
say "Removed #{task}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
list.save
|
57
|
+
end
|
58
|
+
end
|
59
|
+
alias_command :rm, :remove
|
60
|
+
alias_command :'remove first', :remove, '0'
|
61
|
+
alias_command :'remove last', :remove, list.tasks.length - 1
|
62
|
+
|
63
|
+
command :view do |c|
|
64
|
+
c.syntax = 'pomo view [number] [options]'
|
65
|
+
c.summary = 'View a task'
|
66
|
+
c.description = 'View verbose information for the given task [number] or the first task'
|
67
|
+
c.action do |args, options|
|
68
|
+
if task = list.tasks.at(args.first ? args.first.to_i : 0)
|
69
|
+
format = "%15s : %s\n"
|
70
|
+
say format % ['name', task.name]
|
71
|
+
say format % ['length', "#{task.length} minutes"]
|
72
|
+
say format % ['description', task.description || '...']
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
alias_command :'view first', :view, '0'
|
77
|
+
alias_command :'view last', :view, list.tasks.length - 1
|
78
|
+
|
79
|
+
command :list do |c|
|
80
|
+
c.syntax = 'pomo list [options]'
|
81
|
+
c.description = 'List all tasks'
|
82
|
+
c.action do |args, options|
|
83
|
+
list.tasks.each_with_index do |task, i|
|
84
|
+
say ' %s %2d. %-35s : %d minutes' % [task.complete? ? '√' : ' ', i, task.to_s, task.length]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
|
data/lib/pomo/list.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
module Pomo
|
3
|
+
class List
|
4
|
+
|
5
|
+
##
|
6
|
+
# List path.
|
7
|
+
|
8
|
+
attr_reader :path
|
9
|
+
|
10
|
+
##
|
11
|
+
# Task array.
|
12
|
+
|
13
|
+
attr_reader :tasks
|
14
|
+
|
15
|
+
##
|
16
|
+
# Initialize with _path_.
|
17
|
+
|
18
|
+
def initialize path
|
19
|
+
@path = File.expand_path path
|
20
|
+
@tasks = []
|
21
|
+
load rescue save
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
# Add _task_ to the list in memory (requires saving).
|
26
|
+
|
27
|
+
def add task
|
28
|
+
@tasks << task
|
29
|
+
end
|
30
|
+
alias :<< :add
|
31
|
+
|
32
|
+
##
|
33
|
+
# Save the list.
|
34
|
+
|
35
|
+
def save
|
36
|
+
File.open(path, 'w') do |file|
|
37
|
+
file.write YAML.dump(tasks)
|
38
|
+
end
|
39
|
+
self
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Load the list.
|
44
|
+
|
45
|
+
def load
|
46
|
+
@tasks = YAML.load_file path
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
data/lib/pomo/task.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
|
2
|
+
module Pomo
|
3
|
+
class Task
|
4
|
+
|
5
|
+
#--
|
6
|
+
# Mixins
|
7
|
+
#++
|
8
|
+
|
9
|
+
include Growl
|
10
|
+
|
11
|
+
##
|
12
|
+
# Task name.
|
13
|
+
|
14
|
+
attr_reader :name
|
15
|
+
alias :to_s :name
|
16
|
+
|
17
|
+
##
|
18
|
+
# Length in minutes.
|
19
|
+
|
20
|
+
attr_reader :length
|
21
|
+
|
22
|
+
##
|
23
|
+
# Verbose task description.
|
24
|
+
|
25
|
+
attr_reader :description
|
26
|
+
|
27
|
+
##
|
28
|
+
# Initialize with _name_ and _options_.
|
29
|
+
|
30
|
+
def initialize name = nil, options = {}
|
31
|
+
@name = name or raise '<task> required'
|
32
|
+
@description = options.delete :description
|
33
|
+
@length = options.fetch :length, 25
|
34
|
+
@complete = false
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Check if the task has been completed.
|
39
|
+
|
40
|
+
def complete?
|
41
|
+
@complete
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Start timing the task.
|
46
|
+
|
47
|
+
def start
|
48
|
+
complete_message = "time is up, complete #{self} yet?"
|
49
|
+
progress (0..length).to_a.reverse, :format => "(:progress_bar) :remaining minutes remaining", :complete_message => complete_message do |remaining|
|
50
|
+
if remaining == length / 2
|
51
|
+
notify_info "#{remaining} minutes remaining, half way there!"
|
52
|
+
elsif remaining == 5
|
53
|
+
notify_info "5 minutes remaining"
|
54
|
+
end
|
55
|
+
sleep 60
|
56
|
+
{ :remaining => remaining }
|
57
|
+
end
|
58
|
+
@complete = true
|
59
|
+
notify_warning complete_message
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
data/lib/pomo/version.rb
ADDED
data/lib/pomo.rb
ADDED
@@ -0,0 +1,28 @@
|
|
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
|
+
require 'yaml'
|
25
|
+
require 'growl'
|
26
|
+
require 'pomo/list'
|
27
|
+
require 'pomo/task'
|
28
|
+
require 'pomo/version'
|
data/pomo.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{pomo}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["TJ Holowaychuk"]
|
9
|
+
s.date = %q{2009-10-15}
|
10
|
+
s.default_executable = %q{pomo}
|
11
|
+
s.description = %q{Pomodoro time management for the command-line}
|
12
|
+
s.email = %q{tj@vision-media.ca}
|
13
|
+
s.executables = ["pomo"]
|
14
|
+
s.extra_rdoc_files = ["bin/pomo", "lib/pomo.rb", "lib/pomo/list.rb", "lib/pomo/task.rb", "lib/pomo/version.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
15
|
+
s.files = ["History.md", "Manifest", "Rakefile", "Readme.md", "bin/pomo", "lib/pomo.rb", "lib/pomo/list.rb", "lib/pomo/task.rb", "lib/pomo/version.rb", "pomo.gemspec", "spec/pomo_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
|
16
|
+
s.homepage = %q{http://github.com/visionmedia/pomo}
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pomo", "--main", "Readme.md"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{pomo}
|
20
|
+
s.rubygems_version = %q{1.3.5}
|
21
|
+
s.summary = %q{Pomodoro time management for the command-line}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 3
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<commander>, [">= 4.0.0"])
|
29
|
+
s.add_runtime_dependency(%q<growl>, [">= 1.0.3"])
|
30
|
+
else
|
31
|
+
s.add_dependency(%q<commander>, [">= 4.0.0"])
|
32
|
+
s.add_dependency(%q<growl>, [">= 1.0.3"])
|
33
|
+
end
|
34
|
+
else
|
35
|
+
s.add_dependency(%q<commander>, [">= 4.0.0"])
|
36
|
+
s.add_dependency(%q<growl>, [">= 1.0.3"])
|
37
|
+
end
|
38
|
+
end
|
data/spec/pomo_spec.rb
ADDED
data/spec/spec.opts
ADDED
data/spec/spec_helper.rb
ADDED
data/tasks/docs.rake
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
namespace :docs do
|
3
|
+
|
4
|
+
desc 'Remove rdoc products'
|
5
|
+
task :remove => [:clobber_docs]
|
6
|
+
|
7
|
+
desc 'Build docs, and open in browser for viewing (specify BROWSER)'
|
8
|
+
task :open do
|
9
|
+
browser = ENV["BROWSER"] || "safari"
|
10
|
+
sh "open -a #{browser} doc/index.html"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/tasks/gemspec.rake
ADDED
data/tasks/spec.rake
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
require 'spec/rake/spectask'
|
3
|
+
|
4
|
+
desc "Run all specifications"
|
5
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
6
|
+
t.libs << "lib"
|
7
|
+
t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :spec do
|
11
|
+
|
12
|
+
desc "Run all specifications verbosely"
|
13
|
+
Spec::Rake::SpecTask.new(:verbose) do |t|
|
14
|
+
t.libs << "lib"
|
15
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "Run specific specification verbosely (specify SPEC)"
|
19
|
+
Spec::Rake::SpecTask.new(:select) do |t|
|
20
|
+
t.libs << "lib"
|
21
|
+
t.spec_files = [ENV["SPEC"]]
|
22
|
+
t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pomo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TJ Holowaychuk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-10-15 00:00:00 -07:00
|
13
|
+
default_executable: pomo
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: commander
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 4.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: growl
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.0.3
|
34
|
+
version:
|
35
|
+
description: Pomodoro time management for the command-line
|
36
|
+
email: tj@vision-media.ca
|
37
|
+
executables:
|
38
|
+
- pomo
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- bin/pomo
|
43
|
+
- lib/pomo.rb
|
44
|
+
- lib/pomo/list.rb
|
45
|
+
- lib/pomo/task.rb
|
46
|
+
- lib/pomo/version.rb
|
47
|
+
- tasks/docs.rake
|
48
|
+
- tasks/gemspec.rake
|
49
|
+
- tasks/spec.rake
|
50
|
+
files:
|
51
|
+
- History.md
|
52
|
+
- Manifest
|
53
|
+
- Rakefile
|
54
|
+
- Readme.md
|
55
|
+
- bin/pomo
|
56
|
+
- lib/pomo.rb
|
57
|
+
- lib/pomo/list.rb
|
58
|
+
- lib/pomo/task.rb
|
59
|
+
- lib/pomo/version.rb
|
60
|
+
- pomo.gemspec
|
61
|
+
- spec/pomo_spec.rb
|
62
|
+
- spec/spec.opts
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
- tasks/docs.rake
|
65
|
+
- tasks/gemspec.rake
|
66
|
+
- tasks/spec.rake
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://github.com/visionmedia/pomo
|
69
|
+
licenses: []
|
70
|
+
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options:
|
73
|
+
- --line-numbers
|
74
|
+
- --inline-source
|
75
|
+
- --title
|
76
|
+
- Pomo
|
77
|
+
- --main
|
78
|
+
- Readme.md
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "1.2"
|
92
|
+
version:
|
93
|
+
requirements: []
|
94
|
+
|
95
|
+
rubyforge_project: pomo
|
96
|
+
rubygems_version: 1.3.5
|
97
|
+
signing_key:
|
98
|
+
specification_version: 3
|
99
|
+
summary: Pomodoro time management for the command-line
|
100
|
+
test_files: []
|
101
|
+
|