git-changes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +11 -0
- data/bin/git-changes +4 -0
- data/git-changelog.gemspec +23 -0
- data/lib/git-changelog.rb +3 -0
- data/lib/git-changelog/cli.rb +12 -0
- data/lib/git-changelog/parser.rb +41 -0
- data/lib/git-changelog/version.rb +5 -0
- data/test/git-changelog.txt +26 -0
- data/test/git-log.txt +117 -0
- data/test/test_git-changelog.rb +37 -0
- metadata +86 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/bin/git-changes
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "git-changelog/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "git-changes"
|
7
|
+
s.version = Git::Changelog::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Guillermo Álvarez Fernández <guillermo@cientifico.net>"]
|
10
|
+
s.email = ["guillermo@cientifico.net"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Generate a changelog based on git log.}
|
13
|
+
s.description = %q{It taks the output from git-log, parses it, and output with the standard format of changelog.}
|
14
|
+
|
15
|
+
s.rubyforge_project = "git-changelog"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.add_development_dependency("ruby-debug")
|
22
|
+
s.add_development_dependency("rake")
|
23
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class Git::Changelog::Parser
|
2
|
+
def initialize(io)
|
3
|
+
@io = io
|
4
|
+
end
|
5
|
+
|
6
|
+
def generate_changelog
|
7
|
+
commit = nil
|
8
|
+
@io.each_line do |line|
|
9
|
+
|
10
|
+
case line
|
11
|
+
when /^commit ([0123456789abcdef]{6,40})$/
|
12
|
+
process_commit(commit) if commit
|
13
|
+
commit = {:id => $1}
|
14
|
+
when /^Author: (.*)/
|
15
|
+
commit[:author] = $1
|
16
|
+
when /^Date:\s+(.*)$/
|
17
|
+
commit[:date] = $1
|
18
|
+
when / (delete mode|create mode) \d{3,6} ([\S]+)\s*$/, /^( )([^\s]*)\s+\|\s+\d+ [-+]*\s*$/,/^ mode change \d+ => (\d+) ([\S]*)\s*$/
|
19
|
+
commit[:files] ||= []
|
20
|
+
file = File.basename($3 || $3 || $3 || $2)
|
21
|
+
commit[:files] << file unless commit[:files].include?(file)
|
22
|
+
when /.*files changed.*insertions.*deletions/
|
23
|
+
when /^ (.*)$/
|
24
|
+
commit[:message] ||= ""
|
25
|
+
commit[:message] << $1 << "\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
process_commit(commit) if commit
|
29
|
+
end
|
30
|
+
|
31
|
+
protected
|
32
|
+
|
33
|
+
def process_commit(commit)
|
34
|
+
current_commit_info = [commit[:author], commit[:date]]
|
35
|
+
if @last_commit_info != current_commit_info
|
36
|
+
puts "#{commit[:date]} #{commit[:author]}\n\n"
|
37
|
+
@last_commit_info = current_commit_info
|
38
|
+
end
|
39
|
+
puts " * #{commit[:files].join(", ")}: #{commit[:message].split("\n").first}\n\n"
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
2011-06-24 Guillermo Álvarez <guillermo@cientifico.net>
|
2
|
+
|
3
|
+
* README.md: tomate esa2
|
4
|
+
|
5
|
+
* README.md: tomate esa
|
6
|
+
|
7
|
+
2010-06-22 Guillermo Álvarez <guillermo@cientifico.net>
|
8
|
+
|
9
|
+
* deploy.rb: Explicit 'git remote add origin #{deploy.repository}' to the bare repo
|
10
|
+
|
11
|
+
* deploy.rb: Remove the explicity host when calling deploy.run(deploy.host)
|
12
|
+
|
13
|
+
* deploy.rb, test_deploy.rb: Improve run method:
|
14
|
+
|
15
|
+
* Rakefile: Add a rake file to test
|
16
|
+
|
17
|
+
* deploy.rb: Create deploy.current_path in :generate_timestamp
|
18
|
+
|
19
|
+
* deploy.rb: Load dependencies only where dependencies are needed.
|
20
|
+
|
21
|
+
* deploy.rb: Remove restart hook from deploy.rb (ups!)
|
22
|
+
|
23
|
+
* README.md: Update README.md to show new links to the github wiki.
|
24
|
+
|
25
|
+
* .gitignore, LICENSE, README.md, deploy.rb, object.rb: Initial version
|
26
|
+
|
data/test/git-log.txt
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
commit 06437883f3f058e5f63822ba8be9a07b3889dc8a
|
2
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
3
|
+
Date: 2011-06-24
|
4
|
+
|
5
|
+
tomate esa2
|
6
|
+
|
7
|
+
README.md | 71 -------------------------------------------------------------
|
8
|
+
1 files changed, 0 insertions(+), 71 deletions(-)
|
9
|
+
delete mode 100755 README.md
|
10
|
+
|
11
|
+
commit 0fbc6bf8a277ee421b7cfb25e5b866539320b7d9
|
12
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
13
|
+
Date: 2011-06-24
|
14
|
+
|
15
|
+
tomate esa
|
16
|
+
|
17
|
+
0 files changed, 0 insertions(+), 0 deletions(-)
|
18
|
+
mode change 100644 => 100755 README.md
|
19
|
+
|
20
|
+
commit 0b2f9f116f6cd67c70f11d2e5667c68cb89e400a
|
21
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
22
|
+
Date: 2010-06-22
|
23
|
+
|
24
|
+
Explicit 'git remote add origin #{deploy.repository}' to the bare repo
|
25
|
+
(Forgot something: Bare git repos don't save the origin.)
|
26
|
+
|
27
|
+
lib/rake/deploy.rb | 3 ++-
|
28
|
+
1 files changed, 2 insertions(+), 1 deletions(-)
|
29
|
+
|
30
|
+
commit c8e409b0b8b65799caa112712c0936d53f9cc717
|
31
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
32
|
+
Date: 2010-06-22
|
33
|
+
|
34
|
+
Remove the explicity host when calling deploy.run(deploy.host)
|
35
|
+
|
36
|
+
lib/rake/deploy.rb | 22 +++++++++++-----------
|
37
|
+
1 files changed, 11 insertions(+), 11 deletions(-)
|
38
|
+
|
39
|
+
commit ec9a2742752864653eb651bcdfc684415a56e738
|
40
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
41
|
+
Date: 2010-06-22
|
42
|
+
|
43
|
+
Improve run method:
|
44
|
+
* 1,2 or 3 parameters: (command), (host,command), (host,user,command)
|
45
|
+
* Let host be an array of hosts: deploy.run(["machine1","machine2"],"ls")
|
46
|
+
|
47
|
+
lib/rake/deploy/deploy.rb | 29 ++++++++++++++++++++++++-----
|
48
|
+
test/test_deploy.rb | 33 +++++++++++++++++++++++++++++++++
|
49
|
+
2 files changed, 57 insertions(+), 5 deletions(-)
|
50
|
+
create mode 100644 test/test_deploy.rb
|
51
|
+
|
52
|
+
commit 4b7db26d9e3e354ee70fb3f8540218b142082d88
|
53
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
54
|
+
Date: 2010-06-22
|
55
|
+
|
56
|
+
Add a rake file to test
|
57
|
+
|
58
|
+
Rakefile | 10 ++++++++++
|
59
|
+
1 files changed, 10 insertions(+), 0 deletions(-)
|
60
|
+
create mode 100644 Rakefile
|
61
|
+
|
62
|
+
commit f37805bf5bf1744244cfb23d5f0da80efa486f02
|
63
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
64
|
+
Date: 2010-06-22
|
65
|
+
|
66
|
+
Create deploy.current_path in :generate_timestamp
|
67
|
+
|
68
|
+
lib/rake/deploy.rb | 2 +-
|
69
|
+
1 files changed, 1 insertions(+), 1 deletions(-)
|
70
|
+
|
71
|
+
commit 3d9096ef668bbb607150651c198b35bfdaa042ca
|
72
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
73
|
+
Date: 2010-06-22
|
74
|
+
|
75
|
+
Load dependencies only where dependencies are needed.
|
76
|
+
|
77
|
+
lib/rake/deploy.rb | 2 --
|
78
|
+
lib/rake/deploy/deploy.rb | 3 +++
|
79
|
+
2 files changed, 3 insertions(+), 2 deletions(-)
|
80
|
+
|
81
|
+
commit e2c2335da79d07724bf4608dcc38b319061026ef
|
82
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
83
|
+
Date: 2010-06-22
|
84
|
+
|
85
|
+
Remove restart hook from deploy.rb (ups!)
|
86
|
+
|
87
|
+
lib/rake/deploy.rb | 5 -----
|
88
|
+
1 files changed, 0 insertions(+), 5 deletions(-)
|
89
|
+
|
90
|
+
commit 6af3fed781b93eb48242613e1ba1538ba6ddfee5
|
91
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
92
|
+
Date: 2010-06-22
|
93
|
+
|
94
|
+
Update README.md to show new links to the github wiki.
|
95
|
+
|
96
|
+
README.md | 8 ++++----
|
97
|
+
1 files changed, 4 insertions(+), 4 deletions(-)
|
98
|
+
|
99
|
+
commit 5c4c582ca6a11fee844df4b03b52f21a0665ca77
|
100
|
+
Author: Guillermo Álvarez <guillermo@cientifico.net>
|
101
|
+
Date: 2010-06-22
|
102
|
+
|
103
|
+
Initial version
|
104
|
+
|
105
|
+
.gitignore | 2 +
|
106
|
+
LICENSE | 22 ++++++++++++++
|
107
|
+
README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++
|
108
|
+
lib/rake/deploy.rb | 61 ++++++++++++++++++++++++++++++++++++++
|
109
|
+
lib/rake/deploy/deploy.rb | 19 ++++++++++++
|
110
|
+
lib/rake/deploy/object.rb | 5 +++
|
111
|
+
6 files changed, 180 insertions(+), 0 deletions(-)
|
112
|
+
create mode 100644 .gitignore
|
113
|
+
create mode 100644 LICENSE
|
114
|
+
create mode 100644 README.md
|
115
|
+
create mode 100644 lib/rake/deploy.rb
|
116
|
+
create mode 100644 lib/rake/deploy/deploy.rb
|
117
|
+
create mode 100644 lib/rake/deploy/object.rb
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'git-changelog'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
class GitChangeLogTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def fixture_path(name)
|
8
|
+
dir = File.dirname(__FILE__)
|
9
|
+
File.join(dir,name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_parser
|
13
|
+
input = File.open(fixture_path('git-log.txt'),'r')
|
14
|
+
parser = Git::Changelog::Parser.new(input)
|
15
|
+
out = capture_stdout{ parser.generate_changelog }
|
16
|
+
assert_equal File.read(fixture_path('git-changelog.txt')), out
|
17
|
+
ensure
|
18
|
+
input.close if input
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
def capture_stdout
|
24
|
+
out = StringIO.new
|
25
|
+
old_stdout = $stdout
|
26
|
+
$stdout = out
|
27
|
+
$stdout.sync = true
|
28
|
+
yield
|
29
|
+
ensure
|
30
|
+
$stdout = old_stdout
|
31
|
+
out.rewind
|
32
|
+
return out.read
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: git-changes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Guillermo Álvarez Fernández <guillermo@cientifico.net>
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-24 00:00:00.000000000 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ruby-debug
|
17
|
+
requirement: &2156725120 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2156725120
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: &2156724700 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2156724700
|
37
|
+
description: It taks the output from git-log, parses it, and output with the standard
|
38
|
+
format of changelog.
|
39
|
+
email:
|
40
|
+
- guillermo@cientifico.net
|
41
|
+
executables:
|
42
|
+
- git-changes
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- Gemfile
|
48
|
+
- Rakefile
|
49
|
+
- bin/git-changes
|
50
|
+
- git-changelog.gemspec
|
51
|
+
- lib/git-changelog.rb
|
52
|
+
- lib/git-changelog/cli.rb
|
53
|
+
- lib/git-changelog/parser.rb
|
54
|
+
- lib/git-changelog/version.rb
|
55
|
+
- test/git-changelog.txt
|
56
|
+
- test/git-log.txt
|
57
|
+
- test/test_git-changelog.rb
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: ''
|
60
|
+
licenses: []
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project: git-changelog
|
79
|
+
rubygems_version: 1.6.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: Generate a changelog based on git log.
|
83
|
+
test_files:
|
84
|
+
- test/git-changelog.txt
|
85
|
+
- test/git-log.txt
|
86
|
+
- test/test_git-changelog.rb
|