captainslog 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/bin/captainslog +1 -1
- data/lib/captainslog.rb +30 -52
- data/lib/captainslog/version.rb +1 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
captainslog
|
2
2
|
======
|
3
3
|
|
4
|
-
captainslog is a command line utility that prints git logs by day and by author. This is
|
4
|
+
captainslog is a command line utility that prints git logs by day and by author. This is useful when filling out time logs and emailing summaries of commits to clients.
|
5
5
|
|
6
6
|
Install
|
7
7
|
-------
|
data/bin/captainslog
CHANGED
data/lib/captainslog.rb
CHANGED
@@ -1,66 +1,44 @@
|
|
1
1
|
require 'date'
|
2
2
|
|
3
3
|
module Captainslog
|
4
|
-
|
5
|
-
attr_accessor :args, :start_day
|
4
|
+
extend self
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
run(args)
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.execute(*args)
|
14
|
-
new(*args).execute
|
15
|
-
end
|
16
|
-
|
17
|
-
def execute
|
18
|
-
days.each_with_index do |day, i|
|
19
|
-
return if i == days.size - 1
|
20
|
-
puts day_header_for day
|
21
|
-
authors_for(day).each do |author|
|
22
|
-
puts author
|
23
|
-
print commits_for_author_on(author, day)
|
24
|
-
end
|
25
|
-
puts "\n"
|
26
|
-
end
|
27
|
-
exit($?.exitstatus || 0)
|
28
|
-
end
|
29
|
-
|
30
|
-
def run(args)
|
31
|
-
@start_day = day_back args.shift.to_i if args.any?
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
6
|
+
def history
|
7
|
+
@history ||= 6
|
8
|
+
end
|
35
9
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
10
|
+
def today
|
11
|
+
@today ||= Date.today
|
12
|
+
end
|
40
13
|
|
41
|
-
|
42
|
-
|
43
|
-
|
14
|
+
def tomorrow
|
15
|
+
@tomorrow ||= today + 1
|
16
|
+
end
|
44
17
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
18
|
+
def run(*args)
|
19
|
+
@history = (args.shift.to_i - 1) if args.any?
|
20
|
+
execute
|
21
|
+
end
|
49
22
|
|
50
|
-
|
51
|
-
|
23
|
+
def execute
|
24
|
+
print "Captain's Log, Stardate #{today - history} to today...\n\n"
|
25
|
+
tomorrow.step(tomorrow - history, -1) do |day|
|
26
|
+
log = log_for day
|
27
|
+
puts header_for(day - 1)
|
28
|
+
puts log.empty? ? '*no commits' : log
|
29
|
+
puts "\n"
|
52
30
|
end
|
31
|
+
exit($?.exitstatus)
|
32
|
+
end
|
53
33
|
|
54
|
-
|
55
|
-
(Date.parse(day) - 1).strftime('%Y-%m-%d')
|
56
|
-
end
|
34
|
+
private
|
57
35
|
|
58
|
-
|
59
|
-
|
60
|
-
|
36
|
+
def header_for(day)
|
37
|
+
"#{day} (#{day.strftime('%A')})"
|
38
|
+
end
|
61
39
|
|
62
|
-
|
63
|
-
|
64
|
-
|
40
|
+
def log_for(day)
|
41
|
+
%x[ git shortlog --since=\"#{(day - 1).to_time}\" --until=\"#{day}\" --no-merges --format=\"- %s\" -w\"80,0\" ]
|
42
|
+
.split("\n").reject{|s| s.empty?}.join("\n")
|
65
43
|
end
|
66
44
|
end
|
data/lib/captainslog/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: captainslog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Thomas Marino
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-29 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description: "\n captainslog is a command line utility that prints git logs by day and by author. This is
|
22
|
+
description: "\n captainslog is a command line utility that prints git logs by day and by author. This is useful when filling out time logs and emailing summaries of commits to clients.\n "
|
23
23
|
email: writejm@gmail.com
|
24
24
|
executables:
|
25
25
|
- captainslog
|