Module: Dooby

Defined in:
lib/dooby.rb,
lib/dooby/base.rb,
lib/dooby/list.rb,
lib/dooby/task.rb,
lib/dooby/formatter.rb,
lib/dooby/exceptions.rb,
lib/dooby/readline_helper.rb

Defined Under Namespace

Modules: Exceptions, Formateable Classes: Base, List, ReadlineHelper, Task

Constant Summary collapse

DOOBY_DIR =
'.dooby'
CURRENT_TODO_LIST_FILE =
"#{DOOBY_DIR}/list.yml"
DEFAULT_PRIORITY =
5
DEFAULT_STATUS =
:hold
AVAILABLE_STATUSES =
[:hold, :doing, :done]

Class Method Summary collapse

Class Method Details

.current_listObject



37
38
39
# File 'lib/dooby.rb', line 37

def self.current_list
  @list ||= List.new CURRENT_TODO_LIST_FILE
end

.initObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/dooby.rb', line 22

def self.init
  unless File.exist? CURRENT_TODO_LIST_FILE
    FileUtils.mkdir DOOBY_DIR
    Base.create_file
    true
  else
     puts "Todo list already exists inside this directory"
     false
  end
end

.readline_helperObject



46
47
48
# File 'lib/dooby.rb', line 46

def self.readline_helper
  @readline_helper ||= ReadlineHelper.new
end

.reload!Object



41
42
43
44
# File 'lib/dooby.rb', line 41

def self.reload!
  @list = nil
  current_list
end

.trash!Object



33
34
35
# File 'lib/dooby.rb', line 33

def self.trash!
  FileUtils.remove_dir(DOOBY_DIR, force = true)
end