rubdo 0.1.10 → 0.2.1
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 -3
- data/lib/rubdo/cli.rb +2 -19
- data/lib/rubdo/item.rb +3 -7
- data/lib/rubdo/list.rb +4 -14
- data/lib/rubdo/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -24,11 +24,9 @@ Here are the available commands for `rubdo`
|
|
24
24
|
------------------
|
25
25
|
add/a [task description] - Add a new task. If the description is empty, $EDITOR is opened
|
26
26
|
list/ls - Lists all tasks
|
27
|
-
completed - List all completed tasks
|
28
27
|
done/d [task id] - Complete a task
|
29
|
-
info [task id] - Gives info about the specific task
|
30
28
|
edit/e [task id] - Opens up $EDITOR to edit the task description
|
31
|
-
remove/rm [task id] - Deletes the specific task
|
29
|
+
remove/rm [task id] - Deletes the specific task, same as done
|
32
30
|
help - Prints out this information
|
33
31
|
|
34
32
|
`rubdo` createas _~/.tasks_ where it holds the YAML files with the todos inside.
|
data/lib/rubdo/cli.rb
CHANGED
@@ -33,16 +33,6 @@ module Rubdo
|
|
33
33
|
puts "no tasks" if @list.items.empty?
|
34
34
|
end
|
35
35
|
|
36
|
-
def info
|
37
|
-
task = @list.list @id
|
38
|
-
puts @list.info @id
|
39
|
-
end
|
40
|
-
|
41
|
-
def remove
|
42
|
-
@list.items.delete_at @id
|
43
|
-
save
|
44
|
-
end
|
45
|
-
|
46
36
|
def edit
|
47
37
|
abort("not a valid id") if @id == -1 or @id > @list.items.length
|
48
38
|
tmp_file = Tempfile.new('new_desc')
|
@@ -53,27 +43,20 @@ module Rubdo
|
|
53
43
|
save
|
54
44
|
end
|
55
45
|
|
56
|
-
def completed
|
57
|
-
@list.completed.each { |item| puts "#{item.description}, completed at: #{item.completed_at.strftime('%m.%d.%y - %H:%M')}" }
|
58
|
-
end
|
59
|
-
|
60
46
|
def help
|
61
47
|
puts <<-HELP
|
62
|
-
Commands for rubdo:
|
63
48
|
-----------------
|
64
49
|
add/a [task description] - Add a new task. If the description is empty, $EDITOR is opened
|
65
50
|
list/ls - Lists all tasks
|
66
|
-
completed - List all completed tasks
|
67
51
|
done/d [task id] - Complete a task
|
68
|
-
info [task id] - Gives info about the specific task
|
69
52
|
edit/e [task id] - Opens up $EDITOR to edit the task description
|
70
|
-
remove/rm [task id] - Deletes the specific task
|
53
|
+
remove/rm [task id] - Deletes the specific task, same as done
|
71
54
|
help - Prints out this information
|
72
55
|
HELP
|
73
56
|
end
|
74
57
|
|
75
58
|
alias_method :ls, :list
|
76
|
-
alias_method :rm, :
|
59
|
+
alias_method :rm, :done
|
77
60
|
|
78
61
|
private
|
79
62
|
|
data/lib/rubdo/item.rb
CHANGED
@@ -1,18 +1,14 @@
|
|
1
|
-
require 'time'
|
2
|
-
|
3
1
|
module Rubdo
|
4
2
|
class Item
|
5
|
-
attr_accessor :description, :done
|
6
|
-
attr_reader :
|
3
|
+
attr_accessor :description, :done
|
4
|
+
attr_reader :description
|
7
5
|
|
8
6
|
def initialize(description)
|
9
|
-
@done = false
|
10
7
|
@description = description
|
11
|
-
@created_at = Time.now
|
12
8
|
end
|
13
9
|
|
14
10
|
def to_s
|
15
|
-
|
11
|
+
description
|
16
12
|
end
|
17
13
|
end
|
18
14
|
end
|
data/lib/rubdo/list.rb
CHANGED
@@ -8,10 +8,9 @@ module Rubdo
|
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@storage = File.expand_path('~/.tasks/Todo.yml')
|
11
|
-
@
|
12
|
-
@items, @completed = [], []
|
11
|
+
@items = []
|
13
12
|
FileUtils.mkdir_p File.dirname @storage
|
14
|
-
@items
|
13
|
+
@items = read(@storage)
|
15
14
|
end
|
16
15
|
|
17
16
|
def add(description)
|
@@ -19,8 +18,7 @@ module Rubdo
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def write
|
22
|
-
File.open(@storage, 'w') { |todos| todos.write(@items.
|
23
|
-
File.open(@archive, 'w') { |todos| todos.write(@completed.to_yaml) }
|
21
|
+
File.open(@storage, 'w') { |todos| todos.write(@items.to_yaml) }
|
24
22
|
end
|
25
23
|
|
26
24
|
def read(file)
|
@@ -29,15 +27,7 @@ module Rubdo
|
|
29
27
|
end
|
30
28
|
|
31
29
|
def done(id)
|
32
|
-
|
33
|
-
task = @items[id - 1]
|
34
|
-
task.done = true
|
35
|
-
task.completed_at = Time.new
|
36
|
-
@completed << task
|
37
|
-
end
|
38
|
-
|
39
|
-
def info(id)
|
40
|
-
@items[id].to_s
|
30
|
+
@items.delete_at id
|
41
31
|
end
|
42
32
|
|
43
33
|
alias_method :<<, :add
|
data/lib/rubdo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubdo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
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-10-
|
12
|
+
date: 2012-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A quick and dirty todo application
|
15
15
|
email:
|