public
Rubygem
Fork of mojombo/grit
Description: Grit is a Ruby library for extracting information from a git repository in an object oriented manner.
Homepage: http://grit.rubyforge.org/
Clone URL: git://github.com/github/grit.git
proof of concept for commits to a bare repo
mojombo (author)
Wed Apr 30 22:03:18 -0700 2008
commit  5987655432d4c31546007754c1134269f6ead5c7
tree    ba13199e1f4e23b3d4b05888cc575104c2da265d
parent  3bf0dc0bb64f5abd00300c7a07cbedcb75f65f1a
...
24
25
26
 
27
28
29
...
24
25
26
27
28
29
30
0
@@ -24,6 +24,7 @@ require 'grit/actor'
0
 require 'grit/diff'
0
 require 'grit/config'
0
 require 'grit/repo'
0
+require 'grit/index'
0
 
0
 module Grit
0
   class << self
...
44
45
46
 
 
 
 
47
48
49
50
51
52
53
 
54
55
56
...
44
45
46
47
48
49
50
51
52
53
54
55
56
 
57
58
59
60
0
@@ -44,13 +44,17 @@ module Grit
0
     #
0
     # Returns String
0
     def method_missing(cmd, options = {}, *args)
0
+ run('', cmd, '', options, args)
0
+ end
0
+
0
+ def run(prefix, cmd, postfix, options, args)
0
       timeout = options.delete(:timeout)
0
       timeout = true if timeout.nil?
0
 
0
       opt_args = transform_options(options)
0
       ext_args = args.map { |a| a == '--' ? a : "'#{a}'" }
0
       
0
- call = "#{Git.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}"
0
+ call = "#{prefix}#{Git.git_binary} --git-dir='#{self.git_dir}' #{cmd.to_s.gsub(/_/, '-')} #{(opt_args + ext_args).join(' ')}#{postfix}"
0
       puts call if Grit.debug
0
       response = timeout ? sh(call) : wild_sh(call)
0
       puts response if Grit.debug
...
305
306
307
 
 
 
 
308
309
310
...
305
306
307
308
309
310
311
312
313
314
0
@@ -305,6 +305,10 @@ module Grit
0
       @config ||= Config.new(self)
0
     end
0
     
0
+ def index
0
+ Index.new(self)
0
+ end
0
+
0
     # Pretty object inspection
0
     def inspect
0
       %Q{#<Grit::Repo "#{@path}">}
...
2
3
4
5
 
 
 
6
7
8
9
 
10
11
 
 
 
12
13
14
15
 
16
17
18
...
2
3
4
 
5
6
7
8
9
10
 
11
12
 
13
14
15
16
 
 
 
17
18
19
20
0
@@ -2,16 +2,18 @@
0
 #
0
 # class TestReal < Test::Unit::TestCase
0
 # def setup
0
-# @repo = Repo.new('/Users/tom/dev/sandbox/ruby-on-rails-tmbundle')
0
+# `rm -fr /Users/tom/dev/sandbox/grittest.git`
0
+# `git --git-dir=/Users/tom/dev/sandbox/grittest.git init`
0
+# @repo = Repo.new('/Users/tom/dev/sandbox/grittest.git')
0
 # end
0
 #
0
 # def test_real
0
-# # Grit.debug = true
0
+# Grit.debug = true
0
 #
0
-# p @repo.commits
0
+# index = @repo.index
0
+# index.add('foo/bar/baz.txt', 'hello!')
0
+# index.add('foo/qux/bam.txt', 'world!')
0
 #
0
-# # p (@repo.tree/'Syntaxes/Ruby on Rails.plist').data
0
-# # p @repo.tree('master', ['Snippets/rea.plist']).contents.first
0
-# p @repo.tree('master', ['Syntaxes/Ruby on Rails.plist']).contents.first
0
+# puts index.commit('first commit')
0
 # end
0
 # end
0
\ No newline at end of file

Comments

    No one has commented yet.