git-history 0.0.2
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/.gitignore +3 -0
- data/README +33 -0
- data/Rakefile +31 -0
- data/bin/git-history +8 -0
- data/git_history.gemspec +19 -0
- data/lib/git_history.rb +4 -0
- data/lib/git_history/cli.rb +23 -0
- data/lib/git_history/version.rb +3 -0
- data/lib/text.rb +14 -0
- metadata +78 -0
data/.gitignore
ADDED
data/README
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
= git-history
|
2
|
+
|
3
|
+
The git-history gem provide a git-history command. Its purpose is to
|
4
|
+
reformat the git-log output to the changelog format
|
5
|
+
http://en.wikipedia.org/wiki/Changelog.
|
6
|
+
|
7
|
+
* Install
|
8
|
+
|
9
|
+
gem install git-history
|
10
|
+
|
11
|
+
= Usage
|
12
|
+
|
13
|
+
$ cd into_git_wirking_dir
|
14
|
+
$ git-history >changelog
|
15
|
+
2010-10-27 Peter Ehrenberg <peter.ehrenberg@sinnerschrader.com>
|
16
|
+
|
17
|
+
Don't sort by date
|
18
|
+
|
19
|
+
2010-10-27 Peter Ehrenberg <peter.ehrenberg@sinnerschrader.com>
|
20
|
+
|
21
|
+
Added README file
|
22
|
+
|
23
|
+
2010-10-27 Peter Ehrenberg <peter.ehrenberg@sinnerschrader.com>
|
24
|
+
|
25
|
+
Rakefile fixed
|
26
|
+
|
27
|
+
2010-10-27 Peter Ehrenberg <peter.ehrenberg@sinnerschrader.com>
|
28
|
+
|
29
|
+
Fix
|
30
|
+
|
31
|
+
2010-10-27 Peter Ehrenberg <peter.ehrenberg@sinnerschrader.com>
|
32
|
+
|
33
|
+
Initial
|
data/Rakefile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubygems/specification'
|
3
|
+
|
4
|
+
def gemspec
|
5
|
+
@gemspec ||= begin
|
6
|
+
file = File.expand_path('../git_history.gemspec', __FILE__)
|
7
|
+
eval(File.read(file), binding, file)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "validate the gemspec"
|
12
|
+
task :gemspec do
|
13
|
+
gemspec.validate
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Build the gem"
|
17
|
+
task :build => [:gemspec] do
|
18
|
+
mkdir_p "pkg"
|
19
|
+
sh "gem build git_history.gemspec"
|
20
|
+
mv "#{gemspec.full_name}.gem", "pkg"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "Push the gem to rubygems.org"
|
24
|
+
task :push => :build do
|
25
|
+
sh "gem push pkg/#{gemspec.full_name}.gem"
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Install git-history"
|
29
|
+
task :install => :build do
|
30
|
+
sh "gem install pkg/#{gemspec.full_name}.gem"
|
31
|
+
end
|
data/bin/git-history
ADDED
data/git_history.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path("../lib/git_history/version", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "git-history"
|
5
|
+
s.version = GitHistory::VERSION
|
6
|
+
s.platform = Gem::Platform::RUBY
|
7
|
+
s.authors = ["Peter Ehrenberg"]
|
8
|
+
s.email = ["pe@dipe.de"]
|
9
|
+
s.homepage = "http://github.com/dipe/git-history"
|
10
|
+
s.summary = "Create changelog file from git history"
|
11
|
+
s.description = "Simply reformats the history of your project based on the commit messages to changelog file format"
|
12
|
+
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
14
|
+
s.rubyforge_project = "git-history"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.executables = 'git-history'
|
18
|
+
s.require_path = 'lib'
|
19
|
+
end
|
data/lib/git_history.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module GitHistory::CLI
|
2
|
+
require 'text'
|
3
|
+
|
4
|
+
def self.run(args)
|
5
|
+
range = args[0]
|
6
|
+
history_from_gitlog(range)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.history_from_gitlog(range)
|
10
|
+
history = []
|
11
|
+
`git log --date=short #{range}`.split(/^commit .*/).each do |commit|
|
12
|
+
next unless commit.match(/\S/)
|
13
|
+
next if commit.match(/^Merge:/)
|
14
|
+
|
15
|
+
author = commit[/^Author:\s+(.*)/,1]
|
16
|
+
date = commit[/^Date:\s+(.*)/,1]
|
17
|
+
text = commit.grep(/^ .*/).map{ |l| Text::wrap(l.strip, 72, "\t") }.join("\n")
|
18
|
+
history.push("#{date} #{author}\n\n#{text}")
|
19
|
+
end
|
20
|
+
|
21
|
+
puts history.join("\n\n")
|
22
|
+
end
|
23
|
+
end
|
data/lib/text.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Text
|
2
|
+
def self.wrap(str, max_size, indent = '')
|
3
|
+
all = []
|
4
|
+
line = ''
|
5
|
+
for l in str.split
|
6
|
+
if (line+l).length >= max_size
|
7
|
+
all.push(line)
|
8
|
+
line = ''
|
9
|
+
end
|
10
|
+
line += line == '' ? l : ' ' + l
|
11
|
+
end
|
12
|
+
all.push(line).map{ |l| "#{indent}#{l}" }.join("\n")
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-history
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Peter Ehrenberg
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-10-27 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: Simply reformats the history of your project based on the commit messages to changelog file format
|
23
|
+
email:
|
24
|
+
- pe@dipe.de
|
25
|
+
executables:
|
26
|
+
- git-history
|
27
|
+
extensions: []
|
28
|
+
|
29
|
+
extra_rdoc_files: []
|
30
|
+
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- README
|
34
|
+
- Rakefile
|
35
|
+
- bin/git-history
|
36
|
+
- git_history.gemspec
|
37
|
+
- lib/git_history.rb
|
38
|
+
- lib/git_history/cli.rb
|
39
|
+
- lib/git_history/version.rb
|
40
|
+
- lib/text.rb
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/dipe/git-history
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 23
|
65
|
+
segments:
|
66
|
+
- 1
|
67
|
+
- 3
|
68
|
+
- 6
|
69
|
+
version: 1.3.6
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project: git-history
|
73
|
+
rubygems_version: 1.3.7
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Create changelog file from git history
|
77
|
+
test_files: []
|
78
|
+
|