Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add tomatos support? #38

Open
wants to merge 8 commits into from

6 participants

@zlx

your pomo list can be like this:

$ pomo ls
    0. modify for order task                              : 1 tomatos
    1. learn rails activepack                             : 2 tomatos
    2. learn haskell                                      : 1 tomatos
    3. learn programming                                  : 1 tomatos
                                              0 minutes and 5 tomatos
@jhwist

Yes please! +1 on that one.

@stephenmckinney
Collaborator

0 minutes and 5 tomatos? What does a tomato represent?

@zlx

A tomato represent 25 minutes or any piece of time for you. you can focus on work during this time

@zlx

May be you can work with pomodoro timer on linux

@stephenmckinney
Collaborator

OK so if a tomato is a unit of work, say 25 mins or even 60 mins. Shouldn't this unit of work be defined in the config not per task?

@jhwist

Yes, ideally I would like to see it like so:

  • global configuration for tomato length, default 25minutes
  • number of tomatoes estimated for a task
  • automatic execution of a 'tomato set', e.g. 4 tomatoes with a 5 minute break after each and a long break (25-30minutes) after the fourth.

I can highly recommend to read http://pragprog.com/book/snfocus/pomodoro-technique-illustrated

@zlx

Good, I highly dependent pomodoro, And now I work with pomo and pomodoro timer in linux. But if pomo can work independent with tomato working style, I'll abandon pomodoro timer.

now for me, pomo notification is weak and auto take break and quick stop is also needed

@chrismdp

:+1: for merging please - this is the one feature that's stopping me using pomo.

@Schwad

Sweet lord that would be amazing.... then I wouldn't have to have a pomo list with some items put 2-6 times in there!

@Sitebase

Awesome suggestion @zlx !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 20, 2013
  1. @zlx

    Create TODO.md

    zlx authored
  2. @zlx

    add TODO section

    zlx authored
  3. @zlx

    Update TODO.md

    zlx authored
  4. @zlx

    add tomatos support

    zlx authored
  5. @zlx

    add tomatos time

    zlx authored
  6. @zlx
  7. @zlx
  8. @zlx

    delete todo

    zlx authored
This page is out of date. Refresh to see the latest.
View
14 bin/pomo
@@ -120,10 +120,11 @@ command :add do |c|
c.example 'Add a task with 60 minute limit' , 'pomo add "create executable" --length 60'
c.option '-d', '--description string', 'Add verbose task description'
+ c.option '-m', '--tomatos tomatos', Integer, 'Change the default tomatos'
c.option '-l', '--length minutes', Integer, 'Change the default length in minutes'
c.action do |args, options|
config = Pomo::Configuration.load
- task = Pomo::Task.new(args.shift, options.__hash__)
+ task = Pomo::Task.new(args.shift, options.__hash__, config)
list << task
list.save
say " - Added #{task}"
@@ -140,6 +141,7 @@ command :edit do |c|
c.option '-n', '--name string', 'Change the task name'
c.option '-d', '--description string', 'Change the task description'
+ c.option '-m', '--tomatos tomatos', Integer, 'Change the default tomatos'
c.option '-l', '--length minutes', Integer, 'Change the task length'
c.action do |args, options|
config = Pomo::Configuration.load
@@ -312,13 +314,19 @@ command :list do |c|
config = Pomo::Configuration.load
total = 0
+ tomatos = 0
list.tasks.each_with_index do |task, i|
next if options.complete && !task.complete?
next if options.incomplete && task.complete?
- say ' %s %2d. %-50s : %d minutes' % [task.complete? ? '' : ' ', i, task.to_s, task.length]
+ if task.tomatos
+ say ' %s %2d. %-50s : %d tomatos' % [task.complete? ? '' : ' ', i, task.to_s, task.tomatos]
+ else
+ say ' %s %2d. %-50s : %d minutes' % [task.complete? ? '' : ' ', i, task.to_s, task.length]
+ end
total += task.length
+ tomatos += task.tomatos.to_i
end
- say ' ' * 60 + '%d minutes' % total
+ say '%70s' % "#{total} minutes and #{tomatos} tomatos"
end
end
alias_command :ls, :list
View
23 features/manage_list.feature
@@ -8,6 +8,11 @@ Feature: Manage Pomodoro list
And I run `pomo list`
Then the output from "pomo list" should contain "Remember the milk"
+ Scenario: Add tasks with tomatos
+ When I run `pomo add 'Remember the milk' -m 2`
+ And I run `pomo list`
+ Then the output from "pomo list" should contain "Remember the milk : 2 tomatos"
+
Scenario: Remove tasks
Given the following tasks:
| Remember the milk |
@@ -29,6 +34,22 @@ Feature: Manage Pomodoro list
0. Walk the dog : 25 minutes
1. Shave the yak : 25 minutes
2. Remember the milk : 25 minutes
- 75 minutes
+ 75 minutes and 0 tomatos
+
+ """
+
+ Scenario: List tasks
+ Given the following tasks:
+ | Remember the milk |
+ | Walk the dog |
+ | Shave the yak |
+ When I run `pomo edit 0 -m 3`
+ And I run `pomo list`
+ Then the output from "pomo list" should contain exactly:
+ """
+ 0. Remember the milk : 3 tomatos
+ 1. Walk the dog : 25 minutes
+ 2. Shave the yak : 25 minutes
+ 50 minutes and 3 tomatos
"""
View
15 features/manage_tasks.feature
@@ -18,6 +18,21 @@ Feature: Manage Pomodoro task
"""
+ Scenario: Edit tasks
+ When I run `pomo add 'Remember the milk' -d '1 qt Almond milk' -l 60`
+ And I run `pomo edit first -n 'Remember the Almond milk' -d '1 qt' -m 2`
+ And I run `pomo show first`
+ Then the output from "pomo show first" should contain exactly:
+ """
+
+ name : Remember the Almond milk
+ length : 2 tomatos
+ description : 1 qt
+ complete : [ ]
+
+
+ """
+
Scenario: Copy tasks
When I run `pomo add 'Remember the milk'`
And I run `pomo complete first`
View
15 lib/pomo/configuration.rb
@@ -26,19 +26,27 @@ class Configuration
attr_accessor :tmux
##
+ # set tomato default time
+ #
+ # default values: 25 minutes
+
+ attr_accessor :tomatos
+
+ ##
# Initialize configuration.
def initialize(options = {})
@notifier = options[:notifier]
@progress = options[:progress]
@tmux = options[:tmux]
+ @tomatos = options[:tomatos]
end
##
# Load configuration file or default_options. Passed options take precedence.
def self.load(options = {})
- options.reject!{|k,v| ![:notifier, :progress, :tmux].include? k}
+ options.reject!{|k,v| ![:notifier, :progress, :tmux, :tomatos].include? k}
if !(File.exists? config_file)
File.open(config_file, 'w') { |file| YAML::dump(default_options, file) }
@@ -54,7 +62,7 @@ def self.load(options = {})
def self.save(options = {})
force_save = options.delete :force
- options.reject!{|k,v| ![:notifier, :progress, :tmux].include? k}
+ options.reject!{|k,v| ![:notifier, :progress, :tmux, :tomatos].include? k}
options = default_options.merge(options)
@@ -76,7 +84,8 @@ def self.default_options
{
:notifier => default_notifier,
:progress => false,
- :tmux => false
+ :tmux => false,
+ :tomatos => 25
}
end
View
23 lib/pomo/task.rb
@@ -14,6 +14,11 @@ class Task
attr_accessor :length
##
+ # Tomatos.
+
+ attr_accessor :tomatos
+
+ ##
# Verbose task description.
attr_accessor :description
@@ -31,14 +36,26 @@ class Task
##
# Initialize with _name_ and _options_.
- def initialize(name = nil, options = {})
+ def initialize(name = nil, options = {}, config = Pomo::Configuration.load
+)
@name = name or raise '<task> required'
@description = options.delete :description
- @length = options.fetch :length, 25
+ @tomatos = options.delete :tomatos
+ @length = options.fetch(:length, @tomatos ? 0 : 25)
@running = false
@complete = false
end
+ def tomatos=(tomatos)
+ @tomatos = tomatos
+ @length = 0
+ end
+
+ def length=(length)
+ @length = length
+ @tomatos = nil
+ end
+
##
# Quoted task name.
@@ -65,7 +82,7 @@ def complete?
def verbose_output(format)
say format % ['name', self]
- say format % ['length', "#{length} minutes"]
+ say format % ['length', tomatos ? "#{tomatos} tomatos" : "#{length} minutes"]
say format % ['description', description] if description and not description.empty?
say format % ['complete', complete ? '[✓]' : '[ ]']
end
View
18 spec/pomo/configuration_spec.rb
@@ -7,12 +7,14 @@
options = {
:notifier => 'foo',
:progress => 'bar',
- :tmux => 'baz'
+ :tmux => 'baz',
+ :tomatos => 25
}
config = Pomo::Configuration.new(options)
expect(config.notifier).to eq 'foo'
expect(config.progress).to eq 'bar'
expect(config.tmux).to eq 'baz'
+ expect(config.tomatos).to eq 25
end
end
@@ -23,6 +25,7 @@
expect(config.notifier).to eq Pomo::Configuration.default_notifier
expect(config.progress).to be false
expect(config.tmux).to be false
+ expect(config.tomatos).to be 25
end
it 'writes a configuration file with default options' do
@@ -37,7 +40,8 @@
opts = {
:notifier => 'foo',
:progress => 'bar',
- :tmux => 'baz'
+ :tmux => 'baz',
+ :tomatos => 45
}
File.open(Pomo::Configuration.config_file, 'w') do |file|
YAML::dump(opts, file)
@@ -49,6 +53,7 @@
expect(config.notifier).to eq 'foo'
expect(config.progress).to eq 'bar'
expect(config.tmux).to eq 'baz'
+ expect(config.tomatos).to eq 45
end
context 'given options' do
@@ -56,12 +61,14 @@
options = {
:notifier => 'goo',
:progress => 'car',
- :tmux => 'caz'
+ :tmux => 'caz',
+ :tomatos => 45
}
config = Pomo::Configuration.load(options)
expect(config.notifier).to eq 'goo'
expect(config.progress).to eq 'car'
expect(config.tmux).to eq 'caz'
+ expect(config.tomatos).to eq 45
end
end
@@ -69,7 +76,7 @@
end
describe '.save' do
- let(:options) { {:notifier => 'foo', :progress => 'bar', :tmux => 'baz'} }
+ let(:options) { {:notifier => 'foo', :progress => 'bar', :tmux => 'baz', :tomatos => 45} }
context 'not given a configuration file' do
it 'writes a configuration file with options' do
@@ -84,7 +91,8 @@
opts = {
:notifier => 'goo',
:progress => 'car',
- :tmux => 'caz'
+ :tmux => 'caz',
+ :tomatos => 45
}
File.open(Pomo::Configuration.config_file, 'w') do |file|
YAML::dump(opts, file)
Something went wrong with that request. Please try again.