-
Notifications
You must be signed in to change notification settings - Fork 2
/
standup
executable file
·93 lines (72 loc) · 2.06 KB
/
standup
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env ruby
require 'date'
IMPEDIMENT_TAG = "@impediment"
if ARGV[0] == "usage"
puts " Standup Report:"
puts " standup"
puts " Generates a report of tasks completed \"Yesterday\", and tasks left to do"
puts " "
else
today = Date.today
todays_completed = []
impediments = []
#read DONE file
done = File.read(ENV['DONE_FILE'])
done = done.split($/)
done.reverse!
# ==============================
# generate YESTERDAY's List
# ==============================
#define 'yesterday' as the last date on the done file that is not 'today'
i = 0
begin
data = /x\s(?<date>\d{4}-\d{2}-\d{2})\s(?<task>.*)/.match(done[i]);
yesterday = Date.strptime(data[:date], '%Y-%m-%d')
i += 1
end until today != yesterday
puts "\n========================================"
puts " Yesterday: #{yesterday}"
puts "========================================"
#dump out the list
done.each { |item|
data = /x\s(?<date>\d{4}-\d{2}-\d{2})\s(?<task>.*)/.match(item)
task_date = Date.strptime(data[:date], '%Y-%m-%d')
#puts task_date
if task_date == yesterday
puts "+ #{data[:task]}"
elsif task_date == today
todays_completed.push(data[:task])
end
}
#read TODO file
todo = File.read(ENV['TODO_FILE'])
todo = todo.split($/)
# ==============================
# generate TODAY's List
# ==============================
puts "\n========================================"
puts " Today: #{Date.today}"
puts "========================================"
#dumpe TODAY's COMPELTED
todays_completed.each { |task|
puts "+ #{task}"
}
#dump TODAY's List
todo.each { |task|
if task.include?(IMPEDIMENT_TAG)
impediments.push(task)
else
puts "- #{task}"
end
}
#generate IMPEDIMENT's List
if impediments.length > 0
puts "\n========================================"
puts " Impediments: #{Date.today}"
puts "========================================"
impediments.each { |task|
puts"i #{task}"
}
end
puts "\n"
end