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
|
# File 'lib/buildhawk.rb', line 6
def self.run
options = {}
optparse = OptionParser.new do|opts|
opts.banner = "Usage: buildhawk [options]"
options[:title] = nil
opts.on( '-t', '--title TITLE', 'Set the title of the app' ) do |title|
options[:title] = title
end
opts.on( '-h', '--help', 'Display this screen' ) do
puts opts
exit
end
end
optparse.parse!
data = `git log --pretty=format:"%h\t%s\t%N" --show-notes=buildtime | egrep "[0-9]$"`
data = data.lines.map {|x|
x.split("\t")
}.map {|x|
[to_seconds(x[2].chomp), {:ref => x[0], :subject => x[1..-2] * "\t"}]
}.reverse
input = File.read(File.dirname(__FILE__) + '/template.erb')
eruby = Erubis::Eruby.new(input)
puts eruby.result(:data => data, :title => options[:title] || "Untitled")
end
|