rubdo 0.1.9 → 0.1.10
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/bin/rubdo +0 -1
- data/lib/rubdo/cli.rb +11 -6
- data/lib/rubdo/list.rb +4 -4
- data/lib/rubdo/version.rb +1 -1
- metadata +2 -2
data/bin/rubdo
CHANGED
data/lib/rubdo/cli.rb
CHANGED
@@ -20,15 +20,12 @@ module Rubdo
|
|
20
20
|
puts "aborted due to empty file"
|
21
21
|
end
|
22
22
|
end
|
23
|
+
save
|
23
24
|
end
|
24
25
|
|
25
26
|
def done
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def save
|
31
|
-
@list.write
|
27
|
+
@list.done @id
|
28
|
+
save
|
32
29
|
end
|
33
30
|
|
34
31
|
def list
|
@@ -43,6 +40,7 @@ module Rubdo
|
|
43
40
|
|
44
41
|
def remove
|
45
42
|
@list.items.delete_at @id
|
43
|
+
save
|
46
44
|
end
|
47
45
|
|
48
46
|
def edit
|
@@ -52,6 +50,7 @@ module Rubdo
|
|
52
50
|
system("$EDITOR #{tmp_file.path}")
|
53
51
|
@list.items[@id].description = File.read(tmp_file).chomp
|
54
52
|
tmp_file.delete
|
53
|
+
save
|
55
54
|
end
|
56
55
|
|
57
56
|
def completed
|
@@ -75,5 +74,11 @@ help - Prints out this information
|
|
75
74
|
|
76
75
|
alias_method :ls, :list
|
77
76
|
alias_method :rm, :remove
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def save
|
81
|
+
@list.write
|
82
|
+
end
|
78
83
|
end
|
79
84
|
end
|
data/lib/rubdo/list.rb
CHANGED
@@ -11,8 +11,7 @@ module Rubdo
|
|
11
11
|
@archive = File.expand_path('~/.tasks/Archive.yml')
|
12
12
|
@items, @completed = [], []
|
13
13
|
FileUtils.mkdir_p File.dirname @storage
|
14
|
-
@items =
|
15
|
-
@completed = load @archive
|
14
|
+
@items, @completed = read(@storage), read(@archive)
|
16
15
|
end
|
17
16
|
|
18
17
|
def add(description)
|
@@ -24,13 +23,14 @@ module Rubdo
|
|
24
23
|
File.open(@archive, 'w') { |todos| todos.write(@completed.to_yaml) }
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
26
|
+
def read(file)
|
28
27
|
return YAML.load_file(file) if File.exists? file
|
29
28
|
[]
|
30
29
|
end
|
31
30
|
|
32
31
|
def done(id)
|
33
|
-
abort("that id doesn't exists") if
|
32
|
+
abort("that id doesn't exists") if id.nil?
|
33
|
+
task = @items[id - 1]
|
34
34
|
task.done = true
|
35
35
|
task.completed_at = Time.new
|
36
36
|
@completed << task
|
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.1.10
|
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-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A quick and dirty todo application
|
15
15
|
email:
|