Skip to content
This repository has been archived by the owner on Mar 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from berkes/feature/aruba
Browse files Browse the repository at this point in the history
  • Loading branch information
jsahlen committed Feb 7, 2013
2 parents ac77d40 + 37ac42b commit ceeaa97
Show file tree
Hide file tree
Showing 41 changed files with 1,128 additions and 58 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@
.bundle
Gemfile.lock
pkg/*
coverage/*
tmp/*
6 changes: 3 additions & 3 deletions bin/todotxt
Expand Up @@ -5,9 +5,9 @@ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

args = ARGV.clone

if args.empty?
args.push "ls"
end
#if args.empty?
#args.push "ls"
#end

require "todotxt"
Todotxt::CLI.start(args)
13 changes: 11 additions & 2 deletions conf/todotxt.cfg
@@ -1,4 +1,13 @@
todo_txt_path = ~/todo.txt
# list files that may contain todo.txt lines.
# Obviously, todo.txt is required.
# Additionally use for files such as done.txt, deferred.txt or archive.txt.
# In contrary to required todo.txt, these will not be
# auto-generated for you on initialisation.
[files]
# Path to your todo.txt file. The only required file.
todo = ~/todo.txt
done = ""
deferred = ""

# set editor for todotxt, defaults to $EDITOR.
# todo_txt_editor = "vim"
# editor = "vim"
3 changes: 3 additions & 0 deletions cucumber.yml
@@ -0,0 +1,3 @@
default: --tags ~@wip --tags ~@todo --require features
wip: --tags @wip:3 --wip --require features
todo: --tags @todo:3 --wip --require features
24 changes: 24 additions & 0 deletions features/add.feature
@@ -0,0 +1,24 @@
Feature: Add items

So that I can add new todos
As a user
I want to insert several new todos

Background:
Given a default config exists
And a todofile exists

Scenario: Adding a todo reports the added todo back to the user
When I run `todotxt add "Make Coffee"`
Then it should pass with:
"""
Make Coffee
"""

Scenario: Adding a todo inserts it into the file
When I run `todotxt add "Make Coffee"`
Then the file "todo.txt" should contain "Make Coffee"

Scenario: Adding a todo with weird character adds it to the file
When I run `todotxt add Äta gul snö`
Then the file "todo.txt" should contain "Äta gul snö"
28 changes: 28 additions & 0 deletions features/append.feature
@@ -0,0 +1,28 @@
Feature: Append

So that I can change items
As a user
I want to append text to an item

Background:
Given a default config exists
And a todofile with the following items exists:
| todo |
| (B) Install todotxt @cli +todotxt |
| Drink coffee |

Scenario: Add text to an item
When I run `todotxt append 2 @sofa`
Then it should pass with:
"""
2. Drink coffee @sofa
"""
And the file "todo.txt" should contain "Drink coffee @sofa"


Scenario: Add text to an illegal item:
When I run `todotxt append 1337 @sofa`
Then it should pass with:
"""
ERROR: No todo found at line 1337
"""
51 changes: 51 additions & 0 deletions features/colors.feature
@@ -0,0 +1,51 @@
Feature: Colors and markup

So that I can glance over my todos
As a user
I want to see output colored and highlighted

Background:
Given a default config exists
Given a todofile with the following items exists:
| todo |
| Drink Coffee |
| Sip Frappucino @buckstar |
| Lurk Americano +break |
| x brew coffee |
| (A) Order coffee |
| (B) Pay coffee |
| (C) Pick up coffee |
| (D) Thank for service |

@ansi
Scenario: See todos with a bright, dark number and uncolored todo-text
When I successfully run `todotxt list Drink`
Then it should output "1. " brightly in "black"
And the output should contain "Drink Coffee"

@ansi
Scenario: See todo-count in bright dark letters
When I successfully run `todotxt list Drink`
Then it should output "TODO: 1 items" brightly in "black"

@ansi
Scenario: See contexts in blue
When I successfully run `todotxt list @buckstar`
Then it should output "@buckstar" in "blue"

@ansi
Scenario: See projects in green
When I successfully run `todotxt list +break`
Then it should output "+break" in "green"

@ansi
Scenario Outline:
When I successfully run `todotxt list (<priority>)`
Then it should output "(<priority>) " in "<color>"
Examples:
| priority | color |
| A | red |
| B | yellow |
| C | green |
| D | white |

52 changes: 52 additions & 0 deletions features/del.feature
@@ -0,0 +1,52 @@
Feature: delete

So that I can change my mind
As a user
I want to remove items from the todolist

Background:
Given a default config exists
And a todofile with the following items exists:
| todo |
| (B) Install todotxt @cli +todotxt |
| Drink coffee |
| x Make coffee |

Scenario: Remove item with confirmation
When I run `todotxt del 2` interactively
And I type "Y"
Then it should pass with:
"""
2. Drink coffee
Remove this item? [y/N] => Removed from list
"""
And the file "todo.txt" should not contain "Drink coffee"

Scenario: Remove several items with confirmation
When I run `todotxt del 1 2` interactively
And I type "Y"
And I type "Y"
Then it should pass with:
"""
1. (B) Install todotxt @cli +todotxt
Remove this item? [y/N] => Removed from list
2. Drink coffee
Remove this item? [y/N] => Removed from list
"""
And the file "todo.txt" should not contain "(B) Install todotxt @cli +todotxt"
And the file "todo.txt" should not contain "Drink coffee"

Scenario: Remove item without confirmation
When I run `todotxt del 2 -f`
Then it should pass with:
"""
2. Drink coffee
=> Removed from list
"""

Scenario: Attempt to delete an illegal item
When I run `todotxt del 1337`
Then it should pass with:
"""
ERROR: No todo found at line 1337
"""
38 changes: 38 additions & 0 deletions features/depri.feature
@@ -0,0 +1,38 @@
Feature: Depri, remove priority

So that I can make tasks less important
As a user
I want to remove the priorities

Background:
Given a default config exists
And a todofile with the following items exists:
| todo |
| (B) Install todotxt @cli +todotxt |
| Drink coffee |

Scenario: Remove priority of an item
When I run `todotxt depri 1`
Then it should pass with:
"""
1. Install todotxt @cli +todotxt
"""
And the file "todo.txt" should contain exactly:
"""
Install todotxt @cli +todotxt
Drink coffee
"""

Scenario: Remove the priority of an unprioritized item
When I run `todotxt depri 2`
Then it should pass with:
"""
2. Drink coffee
"""

Scenario: Remove the priority of an illegal item
When I run `todotxt depri 1337`
Then it should pass with:
"""
ERROR: No todo found at line 1337
"""
47 changes: 47 additions & 0 deletions features/do.feature
@@ -0,0 +1,47 @@
Feature: Do

So that I can keep track of progress
As a user
I want to mark items done

Background:
Given a default config exists
Given a todofile with the following items exists:
| todo |
| 2013-01-01 Install todotxt @cli +todotxt |
| Read documentation +todotxt |
| 2012-12-12 Buy GTD book @amazon +wishlist |

Scenario: Mark item done reports that item and marks checked in the file
When I run `todotxt do 1`
Then it should pass with:
"""
1. x 2013-01-01 Install todotxt @cli +todotxt
"""
And the file "todo.txt" should contain:
"""
x 2013-01-01 Install todotxt @cli +todotxt
"""

Scenario: Mark multiple items done
When I run `todotxt do 1 2 3`
Then it should pass with:
"""
1. x 2013-01-01 Install todotxt @cli +todotxt
2. x Read documentation +todotxt
3. x 2012-12-12 Buy GTD book @amazon +wishlist
"""
And the file "todo.txt" should contain:
"""
x 2013-01-01 Install todotxt @cli +todotxt
x Read documentation +todotxt
x 2012-12-12 Buy GTD book @amazon +wishlist
"""

Scenario: Mark an invalid item done
When I run `todotxt do 1337`
#Then it should fail with: @TODO: should fail, not pass
Then it should pass with:
"""
No todo found at line 1337
"""
31 changes: 31 additions & 0 deletions features/edit.feature
@@ -0,0 +1,31 @@
Feature: Edit

So that I can modify my entire todolist
As a user
I want to open the todofile in my editor


Background:
Given a todofile with the following items exists:
| todo |
| 2013-01-01 Install todotxt @cli +todotxt |
| Read documentation +todotxt |
| 2012-12-12 Buy GTD book @amazon +wishlist |

Scenario: Open the file in the systems editor
Given the enviromnent variable "EDITOR" is set to "echo"
And a default config exists
When I run `todotxt edit`
Then it should pass with:
"""
todo.txt
"""

Scenario: Open the file in the configured editor
Given a default config exists with the editor set to "echo"
When I run `todotxt edit`
Then it should pass with:
"""
todo.txt
"""

19 changes: 19 additions & 0 deletions features/generate_config.feature
@@ -0,0 +1,19 @@
Feature: Generate config file

So that I can start using todotxt
As a new user
I want to create a config file

Scenario: Generate a config file in an uninitialised environment
Given an empty environment
When I successfully run `todotxt generate_config`
Then a file named ".todotxt.cfg" should exist

Scenario: Attempt to override an existing config file
Given a default config exists
When I run `todotxt generate_config` interactively
And I type "Y"
Then it should pass with regexp:
"""
Overwrite \/([^/]+\/)+.todotxt.cfg\?
"""
20 changes: 20 additions & 0 deletions features/generate_txt.feature
@@ -0,0 +1,20 @@
Feature: Generate example todofile

So that I can start using todotxt
As a new user
I want to create an example todofile

Scenario: Generate a config file in an uninitialised environment
Given an empty environment
When I successfully run `todotxt generate_txt`
Then a file named "todo.txt" should exist

Scenario: Attempt to override an existing config file
Given a default config exists
And a todofile exists
When I run `todotxt generate_txt` interactively
And I type "Y"
Then it should pass with regexp:
"""
Overwrite \/([^/]+\/)+todo\.txt\?
"""

0 comments on commit ceeaa97

Please sign in to comment.