rubdo 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rubdo CHANGED
File without changes
data/lib/rubdo/cli.rb CHANGED
@@ -6,7 +6,12 @@ module Rubdo
6
6
  end
7
7
 
8
8
  def add
9
- @list.add ARGV[1]
9
+ @list.add ARGV[1] if ARGV[1]
10
+ unless ARGV[1]
11
+ system("$EDITOR /tmp/new_task.txt")
12
+ @list.add File.read('/tmp/new_task.txt').chomp
13
+ File.delete("/tmp/new_task.txt")
14
+ end
10
15
  end
11
16
 
12
17
  def done
@@ -23,6 +28,7 @@ module Rubdo
23
28
 
24
29
  def list
25
30
  @list.items.each_with_index { |item, index| puts "#{index + 1}: #{item.description}" }
31
+ puts "no tasks" if @list.items.empty?
26
32
  end
27
33
 
28
34
  def info
@@ -47,9 +53,9 @@ module Rubdo
47
53
 
48
54
  def help(onoe = nil)
49
55
  puts <<-HELP
50
- Commands for todo:
56
+ Commands for todo:
51
57
  ------------------
52
- add/a [task description] - Add a new tas
58
+ add/a [task description] - Add a new task
53
59
  list/ls - Lists all tasks
54
60
  completed - List all completed tasks
55
61
  done/d [task id] - Complete a task
data/lib/rubdo/list.rb CHANGED
@@ -1,16 +1,19 @@
1
1
  require 'time'
2
2
  require 'yaml'
3
+ require 'fileutils'
3
4
 
4
5
  module Rubdo
5
6
  class List
6
7
  attr_reader :items, :completed, :storage, :archive
7
8
 
8
9
  def initialize
9
- @storage = File.expand_path('~/Dropbox/tasks/Todo.yml')
10
- @archive = File.expand_path('~/Dropbox/tasks/Archive.yml')
10
+ @storage = File.expand_path('~/tasks/Todo.yml')
11
+ @archive = File.expand_path('~/tasks/Archive.yml')
11
12
  @items, @completed = [], []
12
13
  @items = load @storage
13
14
  @completed = load @archive
15
+ create_directory_for @storage
16
+ create_directory_for @archive
14
17
  end
15
18
 
16
19
  def add(description)
@@ -38,6 +41,10 @@ module Rubdo
38
41
  @items[id].to_s
39
42
  end
40
43
 
44
+ def create_directory_for(file)
45
+ FileUtils.mkdir File.dirname(file) unless File.exists? file
46
+ end
47
+
41
48
  alias_method :<<, :add
42
49
  end
43
50
  end
data/lib/rubdo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rubdo
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.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.0.1
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: