gliss 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/LICENSE +202 -0
- data/README.rdoc +22 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/bin/gliss +20 -0
- data/lib/gliss.rb +147 -0
- data/spec/gliss_spec.rb +55 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +109 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
178
|
+
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
180
|
+
|
181
|
+
To apply the Apache License to your work, attach the following
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
183
|
+
replaced with your own identifying information. (Don't include
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
185
|
+
comment syntax for the file format. We also recommend that a
|
186
|
+
file or class name and description of purpose be included on the
|
187
|
+
same "printed page" as the copyright notice for easier
|
188
|
+
identification within third-party archives.
|
189
|
+
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
191
|
+
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
193
|
+
you may not use this file except in compliance with the License.
|
194
|
+
You may obtain a copy of the License at
|
195
|
+
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
197
|
+
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201
|
+
See the License for the specific language governing permissions and
|
202
|
+
limitations under the License.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= gliss
|
2
|
+
|
3
|
+
Gliss is a portmanteau (one might say "portamento," were one inclined to terrible puns) of "git," "lightweight," and "gloss." It enables you to put tagged notes in git commit messages and then to extract these later.
|
4
|
+
|
5
|
+
A gliss gloss begins on a line by itself with three identical characters, followed by a tag name, followed by the three characters that started the line. For example, `===EXAMPLE===' would begin a gliss gloss tagged `EXAMPLE`. After the tag name, you may place text to be associated with the tag for this commit. If the first line after the line containing the tag begins with an indent, its text will be considered to be part of the gloss text, and so on for any line immediately succeeding gloss text that is indented at least as much as the first line after the tagged line.
|
6
|
+
|
7
|
+
You may then inspect the gliss glosses in your repo by running `gliss FROM TO`, where `FROM` and `TO` are branches, tags, or SHAs; gliss will show all the glosses in commits reachable from `TO` that are not reachable from `FROM`.
|
8
|
+
|
9
|
+
Gliss supports options for filtering glosses by tag and running in a different repo; try `gliss -h` for help.
|
10
|
+
|
11
|
+
== How to contribute
|
12
|
+
|
13
|
+
* Fork the project.
|
14
|
+
* Make your feature addition or bug fix, ideally on a sensibly-named topic branch.
|
15
|
+
* Add tests for it, ideally in separate spec files.
|
16
|
+
* Don't change VERSION.
|
17
|
+
|
18
|
+
== Copyright
|
19
|
+
|
20
|
+
Copyright (c) 2011 Red Hat, Inc., and William C. Benton. See LICENSE for details.
|
21
|
+
|
22
|
+
Gliss uses Grit, which is copyright (c) 2010 Tom Preston-Werner.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "gliss"
|
8
|
+
gem.summary = %Q{gliss is a tool for inspecting lightweight annotations in a git repository}
|
9
|
+
gem.description = %Q{gliss is a tool for inspecting lightweight annotations, called "glosses," in a git repository. The annotation format used by gliss is simple and human-readable. You can use gliss glosses to streamline, e.g., producing upgrade notes as part of a release process.}
|
10
|
+
gem.email = "willb@redhat.com"
|
11
|
+
gem.homepage = "http://github.com/willb/gliss"
|
12
|
+
gem.authors = ["Will Benton"]
|
13
|
+
gem.add_dependency "grit", "~> 2.4.0"
|
14
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
end
|
27
|
+
|
28
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :spec => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "gliss #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/bin/gliss
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Copyright (c) 2011 Red Hat, Inc. and William C. Benton
|
4
|
+
# Author: William Benton (willb@redhat.com)
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
|
18
|
+
require 'gliss'
|
19
|
+
|
20
|
+
Gliss::App.new.main
|
data/lib/gliss.rb
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
# gliss.rb
|
2
|
+
#
|
3
|
+
# lightweight glossing for git commit messages
|
4
|
+
#
|
5
|
+
# Copyright (c) 2011 Red Hat, Inc. and William C. Benton
|
6
|
+
# Author: William Benton (willb@redhat.com)
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
|
20
|
+
require 'grit'
|
21
|
+
require 'optparse'
|
22
|
+
|
23
|
+
module Gliss
|
24
|
+
Gloss = Struct.new(:sha, :tag, :text)
|
25
|
+
CommitMsg = Struct.new(:sha, :log)
|
26
|
+
GLOSS_RE=/^((?:[^\s]){3})(-?)(.*?)\1(.*)/
|
27
|
+
GLOSS_TAG=3
|
28
|
+
GLOSS_TEXT=4
|
29
|
+
GLOSS_STRIP=2
|
30
|
+
INDENT_RE=/^(\s+)(.*)$/
|
31
|
+
INDENT_AMOUNT=1
|
32
|
+
INDENTED_TEXT=2
|
33
|
+
|
34
|
+
def self.glosses_between(repo, older, newer)
|
35
|
+
commits_between(repo, older, newer).inject([]) do |acc, commit|
|
36
|
+
acc + glosses_in(commit.log, commit.sha)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.commits_between(repo, older, newer)
|
41
|
+
if repo.is_a?(String)
|
42
|
+
repo = Grit::Repo.new(repo)
|
43
|
+
end
|
44
|
+
|
45
|
+
commits = repo.commit_deltas_from(repo, older, newer).sort_by {|c| c.committed_date}
|
46
|
+
commits.map do |commit_obj|
|
47
|
+
CommitMsg.new(commit_obj.sha, commit_obj.message)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.glosses_in(message, sha=nil)
|
52
|
+
result = []
|
53
|
+
continuing = false
|
54
|
+
indent_matcher = nil
|
55
|
+
|
56
|
+
message.each_line do |line|
|
57
|
+
line.chomp!
|
58
|
+
match = nil
|
59
|
+
if continuing
|
60
|
+
match = line.match((indent_matcher || INDENT_RE))
|
61
|
+
|
62
|
+
if match
|
63
|
+
indent_matcher ||= /^(#{match[INDENT_AMOUNT]})(.*)$/
|
64
|
+
text = match[INDENTED_TEXT].strip
|
65
|
+
result[-1].text << text
|
66
|
+
else
|
67
|
+
indent_matcher = nil
|
68
|
+
continuing = false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
match = line.match(GLOSS_RE)
|
73
|
+
if match
|
74
|
+
continuing = true
|
75
|
+
indent_matcher = nil
|
76
|
+
tag = match[GLOSS_TAG].strip
|
77
|
+
text = match[GLOSS_TEXT].strip
|
78
|
+
result << Gloss.new(sha, tag, [text])
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
result.each {|g| g.text.reject! {|t| t == ''}; g.text = g.text.join(" ")}
|
83
|
+
end
|
84
|
+
|
85
|
+
class App
|
86
|
+
def initialize(args=nil)
|
87
|
+
@args = (args || ARGV.dup)
|
88
|
+
end
|
89
|
+
|
90
|
+
def main
|
91
|
+
begin
|
92
|
+
process_args
|
93
|
+
r = Grit::Repo.new(@repo)
|
94
|
+
output_glosses(r)
|
95
|
+
rescue Exception=>ex
|
96
|
+
puts "fatal: #{ex.inspect}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
def output_glosses(repo)
|
102
|
+
Gliss::glosses_between(repo, @from, @to).each do |gloss|
|
103
|
+
if gloss.tag =~ @filter
|
104
|
+
sha = gloss.sha.slice(0,8)
|
105
|
+
tag = gloss.tag
|
106
|
+
msg = gloss.text
|
107
|
+
puts "#{sha} (#{tag})"
|
108
|
+
msg.each_line {|line| puts " #{line.chomp}"}
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def process_args
|
114
|
+
@repo = "."
|
115
|
+
@filter = /.*/
|
116
|
+
|
117
|
+
oparser.parse!(@args)
|
118
|
+
unless @args.size <= 2 && @args.size >= 1
|
119
|
+
puts "fatal: you must specify at least one branch or tag name"
|
120
|
+
puts oparser
|
121
|
+
exit(1)
|
122
|
+
end
|
123
|
+
|
124
|
+
@from, @to = @args
|
125
|
+
@to ||= "master"
|
126
|
+
end
|
127
|
+
|
128
|
+
def oparser
|
129
|
+
@oparser ||= OptionParser.new do |opts|
|
130
|
+
opts.banner = "gliss [options] FROM [TO]\nDisplays all gliss-formatted glosses reachable from TO but not from FROM.\nIf TO is not specified, use \"master\"."
|
131
|
+
|
132
|
+
opts.on("-h", "--help", "Displays this message") do
|
133
|
+
puts opts
|
134
|
+
exit
|
135
|
+
end
|
136
|
+
|
137
|
+
opts.on("-r REPO", "--repo REPO", "Runs in the given repo (default is \".\")") do |repo|
|
138
|
+
@repo = repo
|
139
|
+
end
|
140
|
+
|
141
|
+
opts.on("-f REGEX", "--filter REGEX", "Output only messages with tags matching REGEX", "(default is all tags)") do |filter|
|
142
|
+
@filter = Regexp.new(filter)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
data/spec/gliss_spec.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Gliss" do
|
4
|
+
TEST_MESSAGE = <<-END
|
5
|
+
===FOO=== is an example gloss of type FOO
|
6
|
+
===BAR=== is a gloss that
|
7
|
+
spans several lines
|
8
|
+
because each line has the same
|
9
|
+
indent
|
10
|
+
or at least that much
|
11
|
+
This line does not contain a gloss.
|
12
|
+
Neither does this one.
|
13
|
+
===BLAH===
|
14
|
+
This is a gloss with nothing on the first line.
|
15
|
+
:::ARGH::: argh is a gloss with a different delimiter character.
|
16
|
+
---cruft---
|
17
|
+
|
18
|
+
This is a gloss in paragraph format.
|
19
|
+
This is a good format for longer comments.
|
20
|
+
END
|
21
|
+
|
22
|
+
before(:each) do
|
23
|
+
@glosses = Gliss.glosses_in(TEST_MESSAGE)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "correctly identifies single-line glosses" do
|
27
|
+
@glosses.select {|g| g.tag == "FOO" && g.text == "is an example gloss of type FOO"}.size.should == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it "correctly identifies multiple-line glosses" do
|
31
|
+
@glosses.select {|g| g.tag == "BAR" && g.text == "is a gloss that spans several lines because each line has the same indent or at least that much"}.size.should == 1
|
32
|
+
end
|
33
|
+
|
34
|
+
it "correctly identifies glosses with nothing on the first line" do
|
35
|
+
found = @glosses.select {|g| g.tag == "BLAH" && g.text == "This is a gloss with nothing on the first line."}
|
36
|
+
found.size.should == 1
|
37
|
+
end
|
38
|
+
|
39
|
+
it "correctly identifies glosses with nothing on the first or second lines" do
|
40
|
+
found = @glosses.select {|g| g.tag == "cruft" && g.text == "This is a gloss in paragraph format. This is a good format for longer comments."}
|
41
|
+
found.size.should == 1
|
42
|
+
end
|
43
|
+
|
44
|
+
it "correctly identifies glosses with alternate delimiter characters" do
|
45
|
+
@glosses.select {|g| g.tag == "ARGH" && g.text == "argh is a gloss with a different delimiter character."}.size.should == 1
|
46
|
+
end
|
47
|
+
|
48
|
+
it "finds multiple glosses in a message" do
|
49
|
+
@glosses.size.should == 5
|
50
|
+
end
|
51
|
+
|
52
|
+
it "does not create spurious glosses" do
|
53
|
+
@glosses.select {|g| g.text =~ /does not contain a gloss|does this one/}.size.should == 0
|
54
|
+
end
|
55
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gliss
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Will Benton
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-01-12 00:00:00 -06:00
|
19
|
+
default_executable: gliss
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: grit
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 31
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 4
|
33
|
+
- 0
|
34
|
+
version: 2.4.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 13
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 2
|
49
|
+
- 9
|
50
|
+
version: 1.2.9
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
description: gliss is a tool for inspecting lightweight annotations, called "glosses," in a git repository. The annotation format used by gliss is simple and human-readable. You can use gliss glosses to streamline, e.g., producing upgrade notes as part of a release process.
|
54
|
+
email: willb@redhat.com
|
55
|
+
executables:
|
56
|
+
- gliss
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- LICENSE
|
61
|
+
- README.rdoc
|
62
|
+
files:
|
63
|
+
- .document
|
64
|
+
- LICENSE
|
65
|
+
- README.rdoc
|
66
|
+
- Rakefile
|
67
|
+
- VERSION
|
68
|
+
- bin/gliss
|
69
|
+
- lib/gliss.rb
|
70
|
+
- spec/gliss_spec.rb
|
71
|
+
- spec/spec.opts
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: http://github.com/willb/gliss
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 3
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
requirements: []
|
101
|
+
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.3.7
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: gliss is a tool for inspecting lightweight annotations in a git repository
|
107
|
+
test_files:
|
108
|
+
- spec/gliss_spec.rb
|
109
|
+
- spec/spec_helper.rb
|