historian 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +35 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +149 -0
- data/Rakefile +2 -0
- data/VERSION +1 -0
- data/autotest/discover.rb +1 -0
- data/bin/historian +12 -0
- data/historian.gemspec +28 -0
- data/lib/historian.rb +12 -0
- data/lib/historian/cli.rb +84 -0
- data/lib/historian/commit_message.rb +40 -0
- data/lib/historian/configuration.rb +10 -0
- data/lib/historian/git.rb +189 -0
- data/lib/historian/history_file.rb +209 -0
- data/lib/historian/version.rb +3 -0
- data/spec/example_history.txt +24 -0
- data/spec/fixtures/after_0_0_2 +16 -0
- data/spec/fixtures/after_0_0_2_changelog +6 -0
- data/spec/fixtures/after_0_0_2_history +17 -0
- data/spec/fixtures/all_types_history +17 -0
- data/spec/fixtures/anonymous_release_log +7 -0
- data/spec/fixtures/arbitrary_text +21 -0
- data/spec/fixtures/courageous_camel_history +13 -0
- data/spec/fixtures/courageous_camel_release_log +7 -0
- data/spec/fixtures/empty +0 -0
- data/spec/fixtures/invalid_significance +17 -0
- data/spec/fixtures/missing_significance +16 -0
- data/spec/fixtures/normal +10 -0
- data/spec/fixtures/normal_changelog_after_major +11 -0
- data/spec/fixtures/normal_changelog_after_minor +8 -0
- data/spec/fixtures/normal_history_after_major +17 -0
- data/spec/fixtures/normal_history_after_minor +14 -0
- data/spec/fixtures/patch_on_nothing +5 -0
- data/spec/fixtures/release_on_nothing +1 -0
- data/spec/fixtures/second_patch_on_nothing +6 -0
- data/spec/historian/cli_spec.rb +210 -0
- data/spec/historian/commit_message_spec.rb +95 -0
- data/spec/historian/git_spec.rb +199 -0
- data/spec/historian/history_file_spec.rb +225 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/support/fixture_helper.rb +8 -0
- data/spec/support/git_helpers.rb +53 -0
- data/spec/support/history_file_matchers.rb +52 -0
- metadata +189 -0
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module GitHelpers
|
5
|
+
def run_git(*args)
|
6
|
+
Dir.chdir repo_directory
|
7
|
+
%x(git #{args.collect { |a| Shellwords.escape a }.join " "})
|
8
|
+
end
|
9
|
+
|
10
|
+
def tags
|
11
|
+
run_git "tag"
|
12
|
+
end
|
13
|
+
|
14
|
+
def commits_count
|
15
|
+
run_git("log","--pretty=one").split(/\n/).size
|
16
|
+
end
|
17
|
+
|
18
|
+
def commit_message_for_tag(tag)
|
19
|
+
run_git "show", tag
|
20
|
+
end
|
21
|
+
|
22
|
+
def repo_directory
|
23
|
+
File.expand_path("../../../tmp/repo", __FILE__)
|
24
|
+
end
|
25
|
+
|
26
|
+
def modified?(file)
|
27
|
+
base = File.basename file
|
28
|
+
!run_git("status", "--porcelain").grep(/#{base}/).empty?
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_test_repo
|
32
|
+
FileUtils.rm_rf repo_directory
|
33
|
+
FileUtils.mkdir_p repo_directory
|
34
|
+
run_git "init", repo_directory
|
35
|
+
test_file = File.join repo_directory, "test"
|
36
|
+
File.open( test_file, "w") { |f| f.puts "foo" }
|
37
|
+
run_git "add", test_file
|
38
|
+
|
39
|
+
history_file = File.join repo_directory, "History.txt"
|
40
|
+
File.open history_file, "w"
|
41
|
+
run_git "add", history_file
|
42
|
+
|
43
|
+
run_git "commit", "-m", "test commit"
|
44
|
+
end
|
45
|
+
|
46
|
+
def history_for_repo(fixture_name)
|
47
|
+
@history_file = File.join repo_directory, "History.txt"
|
48
|
+
FileUtils.cp fixture_filename(fixture_name), @history_file
|
49
|
+
@history = File.open(@history_file, "a+")
|
50
|
+
@history.extend Historian::HistoryFile
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
RSpec::Matchers.define :have_current_version do |version|
|
2
|
+
match do |actual|
|
3
|
+
actual.current_version == version
|
4
|
+
end
|
5
|
+
failure_message_for_should do |actual|
|
6
|
+
"expected #{actual} to have current version #{version}, but got #{actual.current_version}"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
RSpec::Matchers.define :have_next_version do |version|
|
11
|
+
match do |actual|
|
12
|
+
actual.next_version == version
|
13
|
+
end
|
14
|
+
failure_message_for_should do |actual|
|
15
|
+
"expected #{actual} to have next version #{version}, but got #{actual.current_version}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
RSpec::Matchers.define :have_history_like do |history_key|
|
20
|
+
match do |actual|
|
21
|
+
actual.rewind
|
22
|
+
actual.read.strip == fixture(history_key)
|
23
|
+
end
|
24
|
+
failure_message_for_should do |actual|
|
25
|
+
actual.rewind
|
26
|
+
RSpec::Expectations::Differ.new.diff_as_string(actual.read.strip, fixture(history_key))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec::Matchers.define :have_changelog_like do |history_key|
|
31
|
+
match do |actual|
|
32
|
+
actual.changelog.strip == fixture(history_key)
|
33
|
+
end
|
34
|
+
failure_message_for_should do |actual|
|
35
|
+
RSpec::Expectations::Differ.new.diff_as_string(actual.changelog, fixture(history_key))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
RSpec::Matchers.define :have_release_log_like do |history_key|
|
40
|
+
match do |actual|
|
41
|
+
actual.release_log.strip == fixture(history_key)
|
42
|
+
end
|
43
|
+
failure_message_for_should do |actual|
|
44
|
+
if actual.release_log.nil?
|
45
|
+
"release log was nil"
|
46
|
+
else
|
47
|
+
RSpec::Expectations::Differ.new.diff_as_string(actual.release_log, fixture(history_key))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
|
metadata
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: historian
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Richard Lee-Morlang
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-19 00:00:00 -08:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thor
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: project_scout
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 27
|
44
|
+
segments:
|
45
|
+
- 0
|
46
|
+
- 0
|
47
|
+
- 2
|
48
|
+
version: 0.0.2
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: rspec
|
53
|
+
prerelease: false
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 2
|
62
|
+
- 3
|
63
|
+
- 0
|
64
|
+
version: 2.3.0
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: bundler
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: autotest
|
83
|
+
prerelease: false
|
84
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
type: :development
|
94
|
+
version_requirements: *id005
|
95
|
+
description: Historian uses git commit hooks to inject itself into Git's commit workflow. Historian checks your commit messages for certain markup tokens. If found, it updates your project's history file, and amends your commit with it, while also stripping out the markup.
|
96
|
+
email:
|
97
|
+
- rick@lee-morlang.com
|
98
|
+
executables:
|
99
|
+
- historian
|
100
|
+
extensions: []
|
101
|
+
|
102
|
+
extra_rdoc_files: []
|
103
|
+
|
104
|
+
files:
|
105
|
+
- .document
|
106
|
+
- .gitignore
|
107
|
+
- .rspec
|
108
|
+
- Gemfile
|
109
|
+
- Gemfile.lock
|
110
|
+
- LICENSE
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.rdoc
|
113
|
+
- Rakefile
|
114
|
+
- VERSION
|
115
|
+
- autotest/discover.rb
|
116
|
+
- bin/historian
|
117
|
+
- historian.gemspec
|
118
|
+
- lib/historian.rb
|
119
|
+
- lib/historian/cli.rb
|
120
|
+
- lib/historian/commit_message.rb
|
121
|
+
- lib/historian/configuration.rb
|
122
|
+
- lib/historian/git.rb
|
123
|
+
- lib/historian/history_file.rb
|
124
|
+
- lib/historian/version.rb
|
125
|
+
- spec/example_history.txt
|
126
|
+
- spec/fixtures/after_0_0_2
|
127
|
+
- spec/fixtures/after_0_0_2_changelog
|
128
|
+
- spec/fixtures/after_0_0_2_history
|
129
|
+
- spec/fixtures/all_types_history
|
130
|
+
- spec/fixtures/anonymous_release_log
|
131
|
+
- spec/fixtures/arbitrary_text
|
132
|
+
- spec/fixtures/courageous_camel_history
|
133
|
+
- spec/fixtures/courageous_camel_release_log
|
134
|
+
- spec/fixtures/empty
|
135
|
+
- spec/fixtures/invalid_significance
|
136
|
+
- spec/fixtures/missing_significance
|
137
|
+
- spec/fixtures/normal
|
138
|
+
- spec/fixtures/normal_changelog_after_major
|
139
|
+
- spec/fixtures/normal_changelog_after_minor
|
140
|
+
- spec/fixtures/normal_history_after_major
|
141
|
+
- spec/fixtures/normal_history_after_minor
|
142
|
+
- spec/fixtures/patch_on_nothing
|
143
|
+
- spec/fixtures/release_on_nothing
|
144
|
+
- spec/fixtures/second_patch_on_nothing
|
145
|
+
- spec/historian/cli_spec.rb
|
146
|
+
- spec/historian/commit_message_spec.rb
|
147
|
+
- spec/historian/git_spec.rb
|
148
|
+
- spec/historian/history_file_spec.rb
|
149
|
+
- spec/spec.opts
|
150
|
+
- spec/spec_helper.rb
|
151
|
+
- spec/support/fixture_helper.rb
|
152
|
+
- spec/support/git_helpers.rb
|
153
|
+
- spec/support/history_file_matchers.rb
|
154
|
+
has_rdoc: true
|
155
|
+
homepage: https://github.com/rleemorlang/historian
|
156
|
+
licenses: []
|
157
|
+
|
158
|
+
post_install_message:
|
159
|
+
rdoc_options: []
|
160
|
+
|
161
|
+
require_paths:
|
162
|
+
- lib
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
hash: 3
|
169
|
+
segments:
|
170
|
+
- 0
|
171
|
+
version: "0"
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ">="
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
hash: 3
|
178
|
+
segments:
|
179
|
+
- 0
|
180
|
+
version: "0"
|
181
|
+
requirements: []
|
182
|
+
|
183
|
+
rubyforge_project:
|
184
|
+
rubygems_version: 1.3.7
|
185
|
+
signing_key:
|
186
|
+
specification_version: 3
|
187
|
+
summary: Automatically extract information from git commit messages and update your project's history file.
|
188
|
+
test_files: []
|
189
|
+
|