gliss 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.rdoc +11 -1
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/lib/gliss.rb +29 -7
  5. metadata +4 -4
@@ -1,6 +1,6 @@
1
1
  = gliss
2
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.
3
+ Gliss enables you to put tagged notes in git commit messages and then to extract these later.
4
4
 
5
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
6
 
@@ -8,6 +8,16 @@ You may then inspect the gliss glosses in your repo by running `gliss FROM TO`,
8
8
 
9
9
  Gliss supports options for filtering glosses by tag and running in a different repo; try `gliss -h` for help.
10
10
 
11
+ == Frequently Anticipated Questions
12
+
13
+ Q: What does "gliss" mean?
14
+
15
+ A: Gliss is a portmanteau (one might say "portamento," were one inclined to terrible puns) of "git," "lightweight," and "gloss."
16
+
17
+ Q: Hey dummy, haven't you heard of `git note`?
18
+
19
+ A: Sadly, not everyone is using a sufficiently modern version of git to benefit from git notes. Even if we can use git notes for annotations, we still need some way to distinguish typed annotations from general notes and comments. We expect that a future release of gliss will support glosses contained in git notes.
20
+
11
21
  == How to contribute
12
22
 
13
23
  * Fork the project.
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ end
22
22
  require 'spec/rake/spectask'
23
23
  Spec::Rake::SpecTask.new(:spec) do |spec|
24
24
  spec.libs << 'lib' << 'spec'
25
- spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ spec.spec_files = FileList['spec/*_spec.rb']
26
26
  end
27
27
 
28
28
  Spec::Rake::SpecTask.new(:rcov) do |spec|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -19,6 +19,7 @@
19
19
 
20
20
  require 'grit'
21
21
  require 'optparse'
22
+ require 'set'
22
23
 
23
24
  module Gliss
24
25
  Gloss = Struct.new(:sha, :tag, :text)
@@ -31,6 +32,8 @@ module Gliss
31
32
  INDENT_AMOUNT=1
32
33
  INDENTED_TEXT=2
33
34
 
35
+ attr_reader :filter
36
+
34
37
  def self.glosses_between(repo, older, newer)
35
38
  commits_between(repo, older, newer).inject([]) do |acc, commit|
36
39
  acc + glosses_in(commit.log, commit.sha)
@@ -90,8 +93,10 @@ module Gliss
90
93
  def main
91
94
  begin
92
95
  process_args
93
- r = Grit::Repo.new(@repo)
94
- output_glosses(r)
96
+ @the_repo = Grit::Repo.new(@repo)
97
+ output_glosses(@the_repo)
98
+ rescue SystemExit=>ex
99
+ exit!(ex.status)
95
100
  rescue Exception=>ex
96
101
  puts "fatal: #{ex.inspect}"
97
102
  end
@@ -101,11 +106,7 @@ module Gliss
101
106
  def output_glosses(repo)
102
107
  Gliss::glosses_between(repo, @from, @to).each do |gloss|
103
108
  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
+ @output_proc.call(gloss)
109
110
  end
110
111
  end
111
112
  end
@@ -113,6 +114,13 @@ module Gliss
113
114
  def process_args
114
115
  @repo = "."
115
116
  @filter = /.*/
117
+ @output_proc = Proc.new do |gloss|
118
+ sha = gloss.sha.slice(0,8)
119
+ tag = gloss.tag
120
+ msg = gloss.text
121
+ puts "#{sha} (#{tag})"
122
+ msg.each_line {|line| puts " #{line.chomp}"}
123
+ end
116
124
 
117
125
  oparser.parse!(@args)
118
126
  unless @args.size <= 2 && @args.size >= 1
@@ -141,6 +149,20 @@ module Gliss
141
149
  opts.on("-f REGEX", "--filter REGEX", "Output only messages with tags matching REGEX", "(default is all tags)") do |filter|
142
150
  @filter = Regexp.new(filter)
143
151
  end
152
+
153
+ opts.on("-w", "--whole-commit", "Output entire commit messages that contain glosses") do
154
+ @seen_messages = Set.new
155
+ @output_proc = Proc.new do |gloss|
156
+ unless @seen_messages.include?(gloss.sha)
157
+ @seen_messages << gloss.sha
158
+ commit, = @the_repo.commits(gloss.sha)
159
+ sha = commit.to_s.slice(0,8)
160
+ # puts commit.inspect
161
+ puts sha
162
+ commit.message.each_line {|line| puts " #{line}"}
163
+ end
164
+ end
165
+ end
144
166
  end
145
167
  end
146
168
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gliss
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Will Benton
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-12 00:00:00 -06:00
18
+ date: 2011-06-27 00:00:00 -05:00
19
19
  default_executable: gliss
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency