Permalink
Browse files

Added a Rakefile and a .gemtest, updated the README a little and rena…

…med LICENSE.
  • Loading branch information...
1 parent a24bde1 commit c30affc7ca2b0c81317011fc40ac5bdb7cac666f @samwho committed Aug 20, 2011
Showing with 9 additions and 9 deletions.
  1. 0 .gemtest
  2. 0 LICENCE → LICENSE
  3. +2 −8 README.md
  4. +6 −0 Rakefile
  5. BIN todo-txt-0.1.gem
  6. +1 −1 todo-txt.gemspec
View
0 .gemtest
No changes.
View
0 LICENCE → LICENSE
File renamed without changes.
View
10 README.md
@@ -2,6 +2,8 @@
This is a Ruby client library for Gina Trapani's [todo.txt](https://github.com/ginatrapani/todo.txt-cli/). It allows for easy parsing of task lists and tasks in the todo.txt format.
+Find the project on GitHub: [http://github.com/samwho/todo-txt-gem](http://github.com/samwho/todo-txt-gem).
+
# Installation
Installation is very simple. The project is packaged as a Ruby gem and can be installed by running:
@@ -14,19 +16,16 @@ Installation is very simple. The project is packaged as a Ruby gem and can be in
A `Todo::List` object encapsulates your todo.txt file. You initialise it by passing the path to your todo.txt to the constructor:
-``` ruby
require 'todo-txt'
list = Todo::List.new "path/to/todo.txt"
-```
`Todo::List` subclasses `Array` so it has all of the standard methods that are available on an array. It is, basically, an array of `Todo::Task` items.
### Filtering
You can filter your todo list by priority, project, context or a combination of all three with ease.
-``` ruby
require 'todo-txt'
list = Todo::List.new "path/to/todo.txt"
@@ -43,13 +42,11 @@ You can filter your todo list by priority, project, context or a combination of
# And you can combine these, like so
list.by_project("+manhatten").by_priority("B")
-```
## Todo::Task
A `Todo::Task` object can be created from a standard task string if you don't want to use the `Todo::List` approach (though using `Todo::List` is recommended).
-``` ruby
require 'todo-txt'
task = Todo::Task.new "(A) This task is top priority! +project @context"
@@ -68,13 +65,11 @@ A `Todo::Task` object can be created from a standard task string if you don't wa
task.orig
# => "(A) This task is top priority! +project @context"
-```
### Comparable
The `Todo::Task` object includes the `Comparable` mixin. It compares with other tasks and sorts by priority in descending order.
-``` ruby
task1 = Todo::Task.new "(A) Priority A."
task2 = Todo::Task.new "(B) Priority B."
@@ -86,7 +81,6 @@ The `Todo::Task` object includes the `Comparable` mixin. It compares with other
task2 > task1
# => false
-```
Tasks without a priority will always be less than a task with a priority.
View
6 Rakefile
@@ -0,0 +1,6 @@
+require 'rspec/core/rake_task'
+
+desc "Run all tests"
+RSpec::Core::RakeTask.new(:test) do |t|
+ t.rspec_opts = '-cfs'
+end
View
BIN todo-txt-0.1.gem
Binary file not shown.
View
2 todo-txt.gemspec
@@ -5,7 +5,7 @@ Gem::Specification.new do |s|
s.authors = ["Sam Rose"]
s.email = %q{samwho@lbak.co.uk}
s.summary = %q{A client library for parsing todo.txt files.}
- s.homepage = %q{http://lbak.co.uk}
+ s.homepage = %q{http://github.com/samwho/todo-txt-gem}
s.description = %q{Allows for simple parsing of todo.txt files, as per Gina Trapani's todo.txt project.}
s.required_ruby_version = '>= 1.9.2'
s.license = 'GPL-2'

0 comments on commit c30affc

Please sign in to comment.