rubdo 0.1.2 → 0.1.3

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 CHANGED
@@ -20,25 +20,34 @@ Or install it yourself as:
20
20
 
21
21
  Here are the available commands for `rubdo`
22
22
 
23
- Commands for todo:
23
+
24
+ Commands for rubdo:
24
25
  ------------------
25
- add/a [task description] - Add a new task
26
+ add/a [task description] - Add a new task. If the description is empty, $EDITOR is opened
26
27
  list/ls - Lists all tasks
27
28
  completed - List all completed tasks
28
29
  done/d [task id] - Complete a task
29
30
  info [task id] - Gives info about the specific task
30
31
  edit/e [task id] - Opens up $EDITOR to edit the task description
31
- remove/rm [task id] - Deleted task id from the list
32
+ remove/rm [task id] - Deletes the specific task
32
33
  help - Prints out this information
33
34
 
34
35
  `rubdo` createas _~/tasks_ where it holds the YAML files with the todos inside.
35
36
  If you want to keep your todos synced accross your machines, make a symlink to say
36
- a directory inside of _Dropbox_
37
+ a directory inside of _~/Dropbox_
37
38
 
38
39
  $ ln -s ~/Dropbox/tasks/ ~/tasks
39
40
 
40
41
  Make sure to save your todos first!
41
42
 
43
+ A tip is to alias `rubdo` to `t` for easier typing
44
+ for `bash` and `zsh`
45
+
46
+ alias t="rubdo"
47
+
48
+ and add that to your _{bash, zsh}rc_
49
+
50
+
42
51
  ## Contributing
43
52
 
44
53
  1. Fork it
data/lib/rubdo/cli.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  module Rubdo
2
4
  class CLI
3
5
  def initialize
@@ -7,15 +9,13 @@ module Rubdo
7
9
 
8
10
  def add
9
11
  @list.add ARGV[1] if ARGV[1]
10
- unless ARGV[1]
11
- tmp_file = '/tmp/new_task.txt'
12
- system("$EDITOR #{tmp_file}")
13
- if File.exists? tmp_file
14
- @list.add File.read(tmp_file).chomp
15
- File.delete(tmp_file)
16
- else
17
- puts "aborted because due to empty file"
18
- end
12
+ tmp_file = Tempfile.new('new_task')
13
+ system("$EDITOR #{tmp_file.path}")
14
+ unless File.read(tmp_file.path).empty?
15
+ @list.add File.read(tmp_file).chomp
16
+ tmp_file.unlink
17
+ else
18
+ puts "aborted due to empty file"
19
19
  end
20
20
  end
21
21
 
@@ -45,15 +45,15 @@ module Rubdo
45
45
  end
46
46
 
47
47
  def edit
48
- tmp_file = '/tmp/todo_desc.txt'
49
- system("echo '#{@list.items[@id].description}' > #{tmp_file}")
50
- system("$EDITOR #{tmp_file}")
48
+ tmp_file = Tempfile.new('todo_desc.txt')
49
+ File.open(tmp_file.path, 'w') { |f| f.write(@list.items[@id].description) }
50
+ system("$EDITOR #{tmp_file.path}")
51
51
  @list.items[@id].description = File.read(tmp_file).chomp
52
- File.delete(tmp_file)
52
+ Tempfile.delete(tmp_file)
53
53
  end
54
54
 
55
55
  def remove
56
- @list.items.delete_at(@id)
56
+ @list.items.delete_at @id
57
57
  end
58
58
 
59
59
  def help
data/lib/rubdo/list.rb CHANGED
@@ -7,10 +7,10 @@ module Rubdo
7
7
  attr_reader :items, :completed, :storage, :archive
8
8
 
9
9
  def initialize
10
- @storage = File.expand_path('~/tasks/Todo.yml')
11
- @archive = File.expand_path('~/tasks/Archive.yml')
10
+ @storage = File.expand_path('~/.tasks/Todo.yml')
11
+ @archive = File.expand_path('~/.tasks/Archive.yml')
12
12
  @items, @completed = [], []
13
- create_directory File.dirname @storage
13
+ FileUtils.mkdir_p File.dirname @storage
14
14
  @items = load @storage
15
15
  @completed = load @archive
16
16
  end
@@ -40,10 +40,6 @@ module Rubdo
40
40
  @items[id].to_s
41
41
  end
42
42
 
43
- def create_directory(folder)
44
- FileUtils.mkdir folder unless Dir.exists? folder
45
- end
46
-
47
43
  alias_method :<<, :add
48
44
  end
49
45
  end
data/lib/rubdo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rubdo
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
4
+ version: 0.1.3
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-08-09 00:00:00.000000000 Z
12
+ date: 2012-08-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A quick and dirty todo application
15
15
  email: