commit 634396b2f541a9f2d58b00be1a07f0c358b999b3 Author: Tom Preston-Werner Date: Tue Oct 9 23:18:20 2007 -0700 initial grit setup diff --git a/History.txt b/History.txt new file mode 100644 index 0000000000000000000000000000000000000000..81d2c27608b352814cbe979a6acd678d30219678 --- /dev/null +++ b/History.txt @@ -0,0 +1,5 @@ +== 1.0.0 / 2007-10-09 + +* 1 major enhancement + * Birthday! + diff --git a/Manifest.txt b/Manifest.txt new file mode 100644 index 0000000000000000000000000000000000000000..641972d82c6d1b51122274ae8f6a0ecdfb56ee22 --- /dev/null +++ b/Manifest.txt @@ -0,0 +1,7 @@ +History.txt +Manifest.txt +README.txt +Rakefile +bin/grit +lib/grit.rb +test/test_grit.rb \ No newline at end of file diff --git a/README.txt b/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..8b1e02c0fb554eed2ce2ef737a68bb369d7527df --- /dev/null +++ b/README.txt @@ -0,0 +1,48 @@ +grit + by FIX (your name) + FIX (url) + +== DESCRIPTION: + +FIX (describe your package) + +== FEATURES/PROBLEMS: + +* FIX (list of features or problems) + +== SYNOPSIS: + + FIX (code sample of usage) + +== REQUIREMENTS: + +* FIX (list of requirements) + +== INSTALL: + +* FIX (sudo gem install, anything else) + +== LICENSE: + +(The MIT License) + +Copyright (c) 2007 FIX + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000000000000000000000000000000000000..ff69c3684a18592c741332b290492aa39d980e02 --- /dev/null +++ b/Rakefile @@ -0,0 +1,17 @@ +# -*- ruby -*- + +require 'rubygems' +require 'hoe' +require './lib/grit.rb' + +Hoe.new('grit', GitPython.VERSION) do |p| + p.rubyforge_name = 'grit' + # p.author = 'FIX' + # p.email = 'FIX' + # p.summary = 'FIX' + # p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n") + # p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1] + p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n") +end + +# vim: syntax=Ruby diff --git a/bin/grit b/bin/grit new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/lib/grit.rb b/lib/grit.rb new file mode 100644 index 0000000000000000000000000000000000000000..32cec87d1e78946a827ddf6a8776be4d81dcf1d1 --- /dev/null +++ b/lib/grit.rb @@ -0,0 +1,12 @@ +$:.unshift File.dirname(__FILE__) # For use/testing when no gem is installed + +# core + +# stdlib + +# internal requires +require 'grit/grit' + +class Grit + VERSION = '1.0.0' +end \ No newline at end of file diff --git a/lib/grit/errors.rb b/lib/grit/errors.rb new file mode 100644 index 0000000000000000000000000000000000000000..b3be31553741937607a89be8b6a2ab1df208852e --- /dev/null +++ b/lib/grit/errors.rb @@ -0,0 +1,4 @@ +class Grit + class InvalidGitRepositoryError < StandardError + end +end \ No newline at end of file diff --git a/lib/grit/grit.rb b/lib/grit/grit.rb new file mode 100644 index 0000000000000000000000000000000000000000..48fd36e16081ec09903f7a0e2253b3d16f9efb01 --- /dev/null +++ b/lib/grit/grit.rb @@ -0,0 +1,24 @@ +class Grit + attr_accessor :path + + # Create a new Grit instance + # +path+ is the path to either the root git directory or the bare git repo + # + # Examples + # g = Grit.new("/Users/tom/dev/grit") + # g = Grit.new("/Users/tom/public/grit.git") + def initialize(path) + if File.exist?(File.join(path, '.git')) + self.path = File.join(path, '.git') + elsif File.exist?(path) && path =~ /\.git$/ + self.path = path + else + raise InvalidGitRepositoryError.new(path) unless File.exist?(path) + end + end + + # Return the project's description. Taken verbatim from REPO/description + def description + File.open(File.join(self.path, 'description')).read.chomp + end +end \ No newline at end of file diff --git a/test/helper.rb b/test/helper.rb new file mode 100644 index 0000000000000000000000000000000000000000..56e21da6b4ce3021d2754775dfa589947a4e37e5 --- /dev/null +++ b/test/helper.rb @@ -0,0 +1,5 @@ +require File.join(File.dirname(__FILE__), *%w[.. lib grit]) + +require 'test/unit' + +GRIT_REPO = File.join(File.dirname(__FILE__), *%w[..]) diff --git a/test/test_grit.rb b/test/test_grit.rb new file mode 100644 index 0000000000000000000000000000000000000000..93aa481b37629797df739380306ae689e13f2855 --- /dev/null +++ b/test/test_grit.rb @@ -0,0 +1,11 @@ +require File.dirname(__FILE__) + '/helper' + +class TestGrit < Test::Unit::TestCase + def setup + @g = Grit.new(GRIT_REPO) + end + + def test_description + assert_equal "Grit is a ruby library for interfacing with git repositories.", @g.description + end +end \ No newline at end of file