precis 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/precis +12 -12
- data/lib/precis.rb +2 -0
- metadata +2 -2
data/bin/precis
CHANGED
@@ -8,10 +8,12 @@
|
|
8
8
|
# Author: Rob Miller <rob@bigfish.co.uk>
|
9
9
|
|
10
10
|
require 'date'
|
11
|
+
require 'erb'
|
12
|
+
require 'letters'
|
11
13
|
|
12
14
|
require_relative '../lib/precis'
|
13
15
|
|
14
|
-
|
16
|
+
template = ERB.new File.new(File.dirname(__FILE__) + "/../templates/email.html.erb").read, nil, "%"
|
15
17
|
|
16
18
|
period = ARGV.shift
|
17
19
|
unless ["daily", "weekly", "monthly"].include? period
|
@@ -41,9 +43,6 @@ end
|
|
41
43
|
|
42
44
|
since = since.strftime("%Y-%m-%d")
|
43
45
|
|
44
|
-
output += "Oh joy! It's the #{period} Git update.\n"
|
45
|
-
output += "These are the stats since #{since}.\n\n"
|
46
|
-
|
47
46
|
repos = []
|
48
47
|
|
49
48
|
ARGV.each do |path|
|
@@ -52,27 +51,28 @@ ARGV.each do |path|
|
|
52
51
|
end
|
53
52
|
end
|
54
53
|
|
54
|
+
with_commits = []
|
55
55
|
zero_commits = []
|
56
56
|
|
57
57
|
repos.each do |repo|
|
58
58
|
Dir.chdir(repo)
|
59
59
|
|
60
|
+
# Take the last two parts of the path as the short version of the
|
61
|
+
# repo.
|
62
|
+
nice_name = File.basename(File.dirname(repo)) + "/" + File.basename(repo)
|
63
|
+
|
60
64
|
total_commits = `git log --oneline --since="#{since}" | wc -l`.strip
|
61
65
|
|
62
66
|
if total_commits == "0"
|
63
|
-
zero_commits <<
|
67
|
+
zero_commits << nice_name
|
64
68
|
else
|
65
|
-
|
66
|
-
|
67
|
-
output += "There #{total_commits} in #{File.basename(repo)}:\n\n"
|
68
|
-
output += `git shortlog -ne --since="#{since}"`.strip.indent("\t")
|
69
|
+
log_output = `git shortlog -ne --since="#{since}"`.strip.indent("\t")
|
69
70
|
|
70
|
-
|
71
|
+
with_commits << { :path => repo, :nice_name => nice_name, :num_commits => total_commits, :log => log_output }
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
|
75
|
-
output += "Repositories with zero commits: #{zero_commits.join(', ')}"
|
75
|
+
output = template.result(binding)
|
76
76
|
|
77
77
|
emails.each do |email|
|
78
78
|
send_email email, :subject => "#{period.capitalize} Git update", :body => output
|
data/lib/precis.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: precis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Watches the Git repositories you tell it to, and then emails you a weekly
|
15
15
|
summary of activity.
|