You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 line
5.6KB

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