changelogger 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/changelogger ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'changelogger'
4
+
5
+ path = ARGV[0] || Dir.pwd
6
+ puts ChangeLogger.new(path).changelog
@@ -0,0 +1,11 @@
1
+ require 'grit'
2
+
3
+ class CommitFilter
4
+ def initialize(commit)
5
+ @commit = commit
6
+ end
7
+
8
+ def filter
9
+ @commit.message.start_with? "Merge"
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ require 'grit'
2
+
3
+ class CommitFormatter
4
+ def initialize(commit)
5
+ @commit = commit
6
+ end
7
+
8
+ def format
9
+ " - " +
10
+ @commit.committed_date.strftime("%Y/%m/%d: ") +
11
+ @commit.message.split(/\n/).first +
12
+ " (" + @commit.author.name + ")"
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ require 'grit'
2
+ require 'changelogger/commit_formatter'
3
+ require 'changelogger/commit_filter'
4
+
5
+ class ChangeLogger
6
+ def initialize(repo_dir)
7
+ @repo = Grit::Repo.new(repo_dir)
8
+ end
9
+
10
+ def changelog
11
+ tags = @repo.tags
12
+
13
+ changelog = ""
14
+ @repo.commits('master', false).each do |commit|
15
+ tag = tags.find { |t| t.commit.id == commit.id }
16
+ changelog += ("\n" + tag.name + "\n") unless tag.nil?
17
+ changelog += CommitFormatter.new(commit).format + "\n" unless CommitFilter.new(commit).filter
18
+ end
19
+
20
+ changelog
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: changelogger
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Joao Azevedo
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: grit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 2.5.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 2.5.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: A simple ChangeLog generator from a git repository.
47
+ email: joao.c.azevedo@gmail.com
48
+ executables:
49
+ - changelogger
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - lib/changelogger/commit_filter.rb
54
+ - lib/changelogger/commit_formatter.rb
55
+ - lib/changelogger.rb
56
+ - bin/changelogger
57
+ homepage: http://github.com/jcazevedo/changelogger
58
+ licenses: []
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 1.8.24
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: ChangeLogger
81
+ test_files: []