-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcp.rb
More file actions
executable file
·66 lines (57 loc) · 1.33 KB
/
Copy pathcp.rb
File metadata and controls
executable file
·66 lines (57 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env ruby
#
# Control Panel for my Task tracker
#
def wipe_n_rebuild
#wipe and rebuild the tracking file
cleanup = File.join(Dir.getwd,'lib/cleanup.rb')
load cleanup
build = File.join(Dir.getwd,'lib/task-tracker.rb')
load build
end
def new_task
path = File.join(Dir.getwd,'lib/add_task.rb')
load path
end
#main method control panel
def control_panel
#initialize choice as 0
choice = 0
#start the loop
while choice != 5
#Let's tell the user what their options are...
puts "OPTIONS:"
puts "1. Open Tracking File"
puts "2. Check-in to a Task."
puts "3. Manually Refresh Tracking File"
puts "4. Add New Task"
puts "5. Exit"
#now prompt for input
choice = gets.chomp.to_i
#and let's do what the user wants
case
when choice == 1
#open the tracking file in a new firefox tab
`firefox tmp/tracktivity.html`
when choice == 2
#load and run checkin.rb
path = File.join(Dir.getwd,'lib/checkin.rb')
success = true
begin
load path
rescue TaskFileError => ex
puts ex.message
success = false
end
#now wipe and rebuild file
if success then wipe_n_rebuild end
when choice == 3
wipe_n_rebuild
when choice == 4
new_task
when choice == 5
puts "Adios muchacho(a)."
end #end case
end #end while
end #end control_panel
control_panel