Module: TaskManager
- Defined in:
- lib/task_manager.rb,
lib/task_manager/cli.rb,
lib/task_manager/task.rb,
lib/task_manager/format.rb,
lib/task_manager/version.rb,
lib/task_manager/task_file.rb,
lib/task_manager/new_task_file.rb,
lib/task_manager/done_task_file.rb,
lib/task_manager/current_task_file.rb
Defined Under Namespace
Classes: Cli, CurrentTaskFile, DoneTaskFile, Format, NewTaskFile, Task, TaskFile
Constant Summary
collapse
- VERSION =
"0.0.16"
Class Method Summary
collapse
Class Method Details
.add(name, score = 0) ⇒ Object
17
18
19
20
21
|
# File 'lib/task_manager.rb', line 17
def self.add(name, score = 0)
task = NewTaskFile.new.add(Task.new(name, score))
print('Added new task:'.colorize(:light_cyan))
print_task(task)
end
|
.current ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/task_manager.rb', line 50
def self.current
task = CurrentTaskFile.new.current
print('Current task:'.colorize(:light_cyan))
print_task(task)
rescue Exception => e
print e.message
end
|
.delete(id) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/task_manager.rb', line 42
def self.delete(id)
task = NewTaskFile.new.delete(id)
print('Deleted task:'.colorize(:light_cyan))
print_task(task)
rescue Exception => e
print e.message
end
|
.finish ⇒ Object
58
59
60
61
62
63
64
65
|
# File 'lib/task_manager.rb', line 58
def self.finish
task = CurrentTaskFile.new.pick
DoneTaskFile.new.add(task)
print('Finished task:'.colorize(:light_green))
print_task(task)
rescue Exception => e
print e.message
end
|
.finish_with_id(id) ⇒ Object
67
68
69
70
71
72
73
74
75
|
# File 'lib/task_manager.rb', line 67
def self.finish_with_id(id)
task = NewTaskFile.new.pick(id) do |task|
DoneTaskFile.new.add(task)
end
print('Finished task:'.colorize(:light_green))
print_task(task)
rescue Exception => e
print e.message
end
|
.pick(id) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/task_manager.rb', line 23
def self.pick(id)
task = NewTaskFile.new.pick(id) do |task|
CurrentTaskFile.new.add(task)
end
print('Picked task:'.colorize(:light_cyan))
print_task(task)
rescue Exception => e
print e.message
end
|
.stats ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/task_manager.rb', line 77
def self.stats
print('Waiting tasks:'.colorize(:light_cyan))
NewTaskFile.new.all.each do |task|
print_task(task)
end
print('')
print('Current task:'.colorize(:light_cyan))
CurrentTaskFile.new.all.each do |task|
print_task(task)
end
print('')
print('Done tasks:'.colorize(:light_cyan))
DoneTaskFile.new.all.each do |task|
print_task(task)
end
end
|
.undo ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/task_manager.rb', line 33
def self.undo
task = CurrentTaskFile.new.pick
NewTaskFile.new.add(task)
print('Undid task:'.colorize(:light_cyan))
print_task(task)
rescue Exception => e
print e.message
end
|