posto 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/posto.rb +0 -1
- data/lib/posto/application.rb +5 -1
- data/lib/posto/file.rb +9 -0
- data/lib/posto/help.md +4 -2
- data/lib/posto/help.rb +1 -1
- data/lib/posto/human_comparison.rb +1 -0
- data/lib/posto/list.rb +1 -2
- data/test/help_test.rb +21 -20
- data/test/list_test.rb +1 -3
- data/test/todo_test.rb +30 -0
- metadata +86 -3
data/README.md
CHANGED
@@ -12,7 +12,7 @@ To add a task, `posto add "an example task"`
|
|
12
12
|
|
13
13
|
To see current tasks, `posto`
|
14
14
|
|
15
|
-
To see a full list of commands, click [here](https://github.com/mattraibert/posto/blob/master/lib/posto/help.md).
|
15
|
+
To see a full list of commands, try `posto help` or click [here](https://github.com/mattraibert/posto/blob/master/lib/posto/help.md).
|
16
16
|
|
17
17
|
## Naming
|
18
18
|
|
data/lib/posto.rb
CHANGED
data/lib/posto/application.rb
CHANGED
@@ -43,14 +43,18 @@ module Posto
|
|
43
43
|
|
44
44
|
def start(todo)
|
45
45
|
add(todo)
|
46
|
-
sort
|
47
46
|
@file.commit_alone("[posto] scheduled '#{todo}'")
|
48
47
|
end
|
48
|
+
alias :schedule :start
|
49
49
|
|
50
50
|
def commit(n = 1)
|
51
51
|
@file.commit("[posto] finished '#{done(n)}'")
|
52
52
|
end
|
53
53
|
|
54
|
+
def oops
|
55
|
+
@file.oops
|
56
|
+
end
|
57
|
+
|
54
58
|
def init
|
55
59
|
@file.touch
|
56
60
|
nil
|
data/lib/posto/file.rb
CHANGED
@@ -19,6 +19,15 @@ module Posto
|
|
19
19
|
`git commit -m "#{msg}" #@filename`
|
20
20
|
end
|
21
21
|
|
22
|
+
def oops
|
23
|
+
commit_msg = `git log --pretty=format:'%s' -n 1`
|
24
|
+
if /^\[posto\]/ =~ commit_msg
|
25
|
+
`git reset --soft HEAD^`
|
26
|
+
else
|
27
|
+
"last commit was not made by posto: #{commit_msg}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
22
31
|
def touch
|
23
32
|
`touch #@filename`
|
24
33
|
end
|
data/lib/posto/help.md
CHANGED
@@ -13,14 +13,16 @@
|
|
13
13
|
|
14
14
|
`add '<todo>'`: add <todo> unsorted to the bottom of the todo list.
|
15
15
|
|
16
|
-
`
|
16
|
+
`schedule '<todo>'`: add and commit with a message based on <todo>.
|
17
17
|
|
18
18
|
`done [n = 1]`, `delete [n]`: remove the nth todo from the list.
|
19
19
|
|
20
|
-
`commit [n]`: remove the nth todo; commit with a message
|
20
|
+
`commit [n = 1]`: remove the nth todo; commit with a relevant message.
|
21
21
|
|
22
22
|
`do`, `top`: displays the top todo.
|
23
23
|
|
24
24
|
`do [n]`, `top [n]`: move the nth todo to the top.
|
25
25
|
|
26
26
|
`unsort [n]`: unsort the nth todo and place it at the bottom.
|
27
|
+
|
28
|
+
`oops`: if HEAD is a posto commit, reset --soft HEAD^.
|
data/lib/posto/help.rb
CHANGED
data/lib/posto/list.rb
CHANGED
data/test/help_test.rb
CHANGED
@@ -3,15 +3,15 @@ require 'posto/help'
|
|
3
3
|
|
4
4
|
class HelpTest < MiniTest::Unit::TestCase
|
5
5
|
def test_command_without_aliases
|
6
|
-
assert_equal " init
|
6
|
+
assert_equal " init create a 'posto.md' file in the working directory.",
|
7
7
|
Posto::Help.format_command_definition("init", "create a 'posto.md' file in the working directory.")
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_command_with_aliases
|
11
11
|
expected = <<EOF.chomp
|
12
|
-
list
|
13
|
-
todos
|
14
|
-
[default]
|
12
|
+
list display the todo list.
|
13
|
+
todos alias for 'list'
|
14
|
+
[default] alias for 'list'
|
15
15
|
EOF
|
16
16
|
assert_equal expected, Posto::Help.format_command_definition("list, todos, [default]", "display the todo list.")
|
17
17
|
end
|
@@ -20,24 +20,25 @@ EOF
|
|
20
20
|
help_text = <<EOF.chomp
|
21
21
|
|
22
22
|
List Commands:
|
23
|
-
init
|
24
|
-
list
|
25
|
-
todos
|
26
|
-
[default]
|
27
|
-
sort
|
28
|
-
resort
|
23
|
+
init create a 'posto.md' file in the working directory.
|
24
|
+
list display the todo list.
|
25
|
+
todos alias for 'list'
|
26
|
+
[default] alias for 'list'
|
27
|
+
sort ask the user about priorities to sort todos.
|
28
|
+
resort reset sort order and sort again (can be time consuming).
|
29
29
|
|
30
30
|
Single Todo Commands:
|
31
|
-
add '<todo>'
|
32
|
-
|
33
|
-
done [n = 1]
|
34
|
-
delete [n]
|
35
|
-
commit [n]
|
36
|
-
do
|
37
|
-
top
|
38
|
-
do [n]
|
39
|
-
top [n]
|
40
|
-
unsort [n]
|
31
|
+
add '<todo>' add <todo> unsorted to the bottom of the todo list.
|
32
|
+
schedule '<todo>' add and commit with a message based on <todo>.
|
33
|
+
done [n = 1] remove the nth todo from the list.
|
34
|
+
delete [n] alias for 'done [n = 1]'
|
35
|
+
commit [n = 1] remove the nth todo; commit with a relevant message.
|
36
|
+
do displays the top todo.
|
37
|
+
top alias for 'do'
|
38
|
+
do [n] move the nth todo to the top.
|
39
|
+
top [n] alias for 'do [n]'
|
40
|
+
unsort [n] unsort the nth todo and place it at the bottom.
|
41
|
+
oops if HEAD is a posto commit, reset --soft HEAD^.
|
41
42
|
EOF
|
42
43
|
assert_equal(help_text, Posto::Help.help_text)
|
43
44
|
end
|
data/test/list_test.rb
CHANGED
@@ -8,11 +8,9 @@ class ListTest < MiniTest::Unit::TestCase
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_choose_todo_lines
|
11
|
+
assert_equal([],Posto::List.choose_todo_lines([]))
|
11
12
|
assert_equal(["99. bottles", "* unsorted todo"],
|
12
13
|
Posto::List.choose_todo_lines(["TODO", "----", "99. bottles", "* unsorted todo", ""]))
|
13
|
-
assert_equal(["99. bottles", "* unsorted todo"],
|
14
|
-
Posto::List.choose_todo_lines(["TODO", "----", "99. bottles", "* unsorted todo", "",
|
15
|
-
"backlog", "-------","","* nada", "* none"]))
|
16
14
|
end
|
17
15
|
|
18
16
|
def test_starred_group
|
data/test/todo_test.rb
CHANGED
@@ -26,4 +26,34 @@ class TodoTest < MiniTest::Unit::TestCase
|
|
26
26
|
assert_equal "99. bottles", Posto::Todo.number("* bottles", 99)
|
27
27
|
assert_equal "99. cents", Posto::Todo.number("50. cents", 99)
|
28
28
|
end
|
29
|
+
|
30
|
+
def test_todo?
|
31
|
+
assert Posto::Todo.todo?("* bottles")
|
32
|
+
assert Posto::Todo.todo?("50. cents")
|
33
|
+
assert !Posto::Todo.todo?("todo")
|
34
|
+
assert !Posto::Todo.todo?("----")
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_numbered?()
|
38
|
+
assert !Posto::Todo.numbered?("* bottles")
|
39
|
+
assert Posto::Todo.numbered?("50. cents")
|
40
|
+
assert !Posto::Todo.numbered?("todo")
|
41
|
+
assert !Posto::Todo.numbered?("----")
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_starred?
|
45
|
+
assert Posto::Todo.starred?("* bottles")
|
46
|
+
assert !Posto::Todo.starred?("50. cents")
|
47
|
+
assert !Posto::Todo.starred?("todo")
|
48
|
+
assert !Posto::Todo.starred?("----")
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_mark_quick
|
52
|
+
assert_equal "* bottles (quick)", Posto::Todo.mark_quick("* bottles")
|
53
|
+
assert_equal "50. cents (quick)", Posto::Todo.mark_quick("50. cents")
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_create
|
57
|
+
assert_equal "* bottles", Posto::Todo.create("bottles")
|
58
|
+
end
|
29
59
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: posto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -43,6 +43,86 @@ dependencies:
|
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: five_leaves
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bundler
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: grasshopper
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: pry
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
46
126
|
description: Sort your todo list from the command line.
|
47
127
|
email: mattraibert@gmail.com
|
48
128
|
executables:
|
@@ -86,13 +166,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
166
|
version: '0'
|
87
167
|
segments:
|
88
168
|
- 0
|
89
|
-
hash:
|
169
|
+
hash: -1910736030221862158
|
90
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
171
|
none: false
|
92
172
|
requirements:
|
93
173
|
- - ! '>='
|
94
174
|
- !ruby/object:Gem::Version
|
95
175
|
version: '0'
|
176
|
+
segments:
|
177
|
+
- 0
|
178
|
+
hash: -1910736030221862158
|
96
179
|
requirements: []
|
97
180
|
rubyforge_project:
|
98
181
|
rubygems_version: 1.8.24
|