relevance-grit 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +56 -0
  3. data/README.txt +213 -0
  4. data/Rakefile +29 -0
  5. data/grit.gemspec +16 -0
  6. data/lib/grit/actor.rb +36 -0
  7. data/lib/grit/blob.rb +117 -0
  8. data/lib/grit/commit.rb +208 -0
  9. data/lib/grit/config.rb +44 -0
  10. data/lib/grit/diff.rb +70 -0
  11. data/lib/grit/errors.rb +7 -0
  12. data/lib/grit/git.rb +124 -0
  13. data/lib/grit/index.rb +77 -0
  14. data/lib/grit/lazy.rb +31 -0
  15. data/lib/grit/ref.rb +110 -0
  16. data/lib/grit/repo.rb +318 -0
  17. data/lib/grit/tree.rb +99 -0
  18. data/lib/grit.rb +42 -0
  19. data/test/fixtures/blame +131 -0
  20. data/test/fixtures/cat_file_blob +1 -0
  21. data/test/fixtures/cat_file_blob_size +1 -0
  22. data/test/fixtures/diff_2 +54 -0
  23. data/test/fixtures/diff_2f +19 -0
  24. data/test/fixtures/diff_f +15 -0
  25. data/test/fixtures/diff_i +201 -0
  26. data/test/fixtures/diff_mode_only +1152 -0
  27. data/test/fixtures/diff_new_mode +17 -0
  28. data/test/fixtures/diff_p +610 -0
  29. data/test/fixtures/for_each_ref +0 -0
  30. data/test/fixtures/for_each_ref_remotes +0 -0
  31. data/test/fixtures/for_each_ref_tags +0 -0
  32. data/test/fixtures/ls_tree_a +7 -0
  33. data/test/fixtures/ls_tree_b +2 -0
  34. data/test/fixtures/ls_tree_commit +3 -0
  35. data/test/fixtures/rev_list +26 -0
  36. data/test/fixtures/rev_list_count +655 -0
  37. data/test/fixtures/rev_list_single +7 -0
  38. data/test/fixtures/rev_parse +1 -0
  39. data/test/fixtures/show_empty_commit +6 -0
  40. data/test/fixtures/simple_config +2 -0
  41. data/test/helper.rb +17 -0
  42. data/test/profile.rb +21 -0
  43. data/test/suite.rb +6 -0
  44. data/test/test_actor.rb +35 -0
  45. data/test/test_blob.rb +74 -0
  46. data/test/test_commit.rb +182 -0
  47. data/test/test_config.rb +58 -0
  48. data/test/test_diff.rb +18 -0
  49. data/test/test_git.rb +52 -0
  50. data/test/test_grit.rb +32 -0
  51. data/test/test_head.rb +22 -0
  52. data/test/test_real.rb +19 -0
  53. data/test/test_reality.rb +17 -0
  54. data/test/test_remote.rb +15 -0
  55. data/test/test_repo.rb +278 -0
  56. data/test/test_tag.rb +29 -0
  57. data/test/test_tree.rb +91 -0
  58. metadata +133 -0
@@ -0,0 +1,201 @@
1
+ commit 634396b2f541a9f2d58b00be1a07f0c358b999b3
2
+ Author: Tom Preston-Werner <tom@mojombo.com>
3
+ Date: Tue Oct 9 23:18:20 2007 -0700
4
+
5
+ initial grit setup
6
+
7
+ diff --git a/History.txt b/History.txt
8
+ new file mode 100644
9
+ index 0000000000000000000000000000000000000000..81d2c27608b352814cbe979a6acd678d30219678
10
+ --- /dev/null
11
+ +++ b/History.txt
12
+ @@ -0,0 +1,5 @@
13
+ +== 1.0.0 / 2007-10-09
14
+ +
15
+ +* 1 major enhancement
16
+ + * Birthday!
17
+ +
18
+ diff --git a/Manifest.txt b/Manifest.txt
19
+ new file mode 100644
20
+ index 0000000000000000000000000000000000000000..641972d82c6d1b51122274ae8f6a0ecdfb56ee22
21
+ --- /dev/null
22
+ +++ b/Manifest.txt
23
+ @@ -0,0 +1,7 @@
24
+ +History.txt
25
+ +Manifest.txt
26
+ +README.txt
27
+ +Rakefile
28
+ +bin/grit
29
+ +lib/grit.rb
30
+ +test/test_grit.rb
31
+
32
+ diff --git a/README.txt b/README.txt
33
+ new file mode 100644
34
+ index 0000000000000000000000000000000000000000..8b1e02c0fb554eed2ce2ef737a68bb369d7527df
35
+ --- /dev/null
36
+ +++ b/README.txt
37
+ @@ -0,0 +1,48 @@
38
+ +grit
39
+ + by FIX (your name)
40
+ + FIX (url)
41
+ +
42
+ +== DESCRIPTION:
43
+ +
44
+ +FIX (describe your package)
45
+ +
46
+ +== FEATURES/PROBLEMS:
47
+ +
48
+ +* FIX (list of features or problems)
49
+ +
50
+ +== SYNOPSIS:
51
+ +
52
+ + FIX (code sample of usage)
53
+ +
54
+ +== REQUIREMENTS:
55
+ +
56
+ +* FIX (list of requirements)
57
+ +
58
+ +== INSTALL:
59
+ +
60
+ +* FIX (sudo gem install, anything else)
61
+ +
62
+ +== LICENSE:
63
+ +
64
+ +(The MIT License)
65
+ +
66
+ +Copyright (c) 2007 FIX
67
+ +
68
+ +Permission is hereby granted, free of charge, to any person obtaining
69
+ +a copy of this software and associated documentation files (the
70
+ +'Software'), to deal in the Software without restriction, including
71
+ +without limitation the rights to use, copy, modify, merge, publish,
72
+ +distribute, sublicense, and/or sell copies of the Software, and to
73
+ +permit persons to whom the Software is furnished to do so, subject to
74
+ +the following conditions:
75
+ +
76
+ +The above copyright notice and this permission notice shall be
77
+ +included in all copies or substantial portions of the Software.
78
+ +
79
+ +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
80
+ +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
81
+ +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
82
+ +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
83
+ +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
84
+ +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
85
+ +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
86
+ diff --git a/Rakefile b/Rakefile
87
+ new file mode 100644
88
+ index 0000000000000000000000000000000000000000..ff69c3684a18592c741332b290492aa39d980e02
89
+ --- /dev/null
90
+ +++ b/Rakefile
91
+ @@ -0,0 +1,17 @@
92
+ +# -*- ruby -*-
93
+ +
94
+ +require 'rubygems'
95
+ +require 'hoe'
96
+ +require './lib/grit.rb'
97
+ +
98
+ +Hoe.new('grit', Grit::VERSION) do |p|
99
+ + p.rubyforge_name = 'grit'
100
+ + # p.author = 'FIX'
101
+ + # p.email = 'FIX'
102
+ + # p.summary = 'FIX'
103
+ + # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
104
+ + # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
105
+ + p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
106
+ +end
107
+ +
108
+ +# vim: syntax=Ruby
109
+ diff --git a/bin/grit b/bin/grit
110
+ new file mode 100644
111
+ index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
112
+ diff --git a/lib/grit.rb b/lib/grit.rb
113
+ new file mode 100644
114
+ index 0000000000000000000000000000000000000000..32cec87d1e78946a827ddf6a8776be4d81dcf1d1
115
+ --- /dev/null
116
+ +++ b/lib/grit.rb
117
+ @@ -0,0 +1,12 @@
118
+ +$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed
119
+ +
120
+ +# core
121
+ +
122
+ +# stdlib
123
+ +
124
+ +# internal requires
125
+ +require 'grit/grit'
126
+ +
127
+ +class Grit
128
+ + VERSION = '1.0.0'
129
+ +end
130
+
131
+ diff --git a/lib/grit/errors.rb b/lib/grit/errors.rb
132
+ new file mode 100644
133
+ index 0000000000000000000000000000000000000000..b3be31553741937607a89be8b6a2ab1df208852e
134
+ --- /dev/null
135
+ +++ b/lib/grit/errors.rb
136
+ @@ -0,0 +1,4 @@
137
+ +class Grit
138
+ + class InvalidGitRepositoryError < StandardError
139
+ + end
140
+ +end
141
+
142
+ diff --git a/lib/grit/grit.rb b/lib/grit/grit.rb
143
+ new file mode 100644
144
+ index 0000000000000000000000000000000000000000..48fd36e16081ec09903f7a0e2253b3d16f9efb01
145
+ --- /dev/null
146
+ +++ b/lib/grit/grit.rb
147
+ @@ -0,0 +1,24 @@
148
+ +class Grit
149
+ + attr_accessor :path
150
+ +
151
+ + # Create a new Grit instance
152
+ + # +path+ is the path to either the root git directory or the bare git repo
153
+ + #
154
+ + # Examples
155
+ + # g = Grit.new("/Users/tom/dev/grit")
156
+ + # g = Grit.new("/Users/tom/public/grit.git")
157
+ + def initialize(path)
158
+ + if File.exist?(File.join(path, '.git'))
159
+ + self.path = File.join(path, '.git')
160
+ + elsif File.exist?(path) && path =~ /\.git$/
161
+ + self.path = path
162
+ + else
163
+ + raise InvalidGitRepositoryError.new(path) unless File.exist?(path)
164
+ + end
165
+ + end
166
+ +
167
+ + # Return the project's description. Taken verbatim from REPO/description
168
+ + def description
169
+ + File.open(File.join(self.path, 'description')).read.chomp
170
+ + end
171
+ +end
172
+
173
+ diff --git a/test/helper.rb b/test/helper.rb
174
+ new file mode 100644
175
+ index 0000000000000000000000000000000000000000..56e21da6b4ce3021d2754775dfa589947a4e37e5
176
+ --- /dev/null
177
+ +++ b/test/helper.rb
178
+ @@ -0,0 +1,5 @@
179
+ +require File.join(File.dirname(__FILE__), *%w[.. lib grit])
180
+ +
181
+ +require 'test/unit'
182
+ +
183
+ +GRIT_REPO = File.join(File.dirname(__FILE__), *%w[..])
184
+ diff --git a/test/test_grit.rb b/test/test_grit.rb
185
+ new file mode 100644
186
+ index 0000000000000000000000000000000000000000..93aa481b37629797df739380306ae689e13f2855
187
+ --- /dev/null
188
+ +++ b/test/test_grit.rb
189
+ @@ -0,0 +1,11 @@
190
+ +require File.dirname(__FILE__) + '/helper'
191
+ +
192
+ +class TestGrit < Test::Unit::TestCase
193
+ + def setup
194
+ + @g = Grit.new(GRIT_REPO)
195
+ + end
196
+ +
197
+ + def test_description
198
+ + assert_equal "Grit is a ruby library for interfacing with git repositories.", @g.description
199
+ + end
200
+ +end
201
+