got the first round working
[rubygit.git] / lib / git / base.rb
blob6eb3455131eed20c8d5e4b3741b176b61c01ff74
1 module Git
2   
3   class Base
5     @working_directory = nil
6     @repository = nil
7     @index = nil
9     # opens a Git Repository - no working directory options
10     def self.repo(git_dir)
11       self.new :repository => git_dir
12     end
13     
14     # opens a new Git Project from a working directory
15     # you can specify non-standard git_dir and index file in the options
16     def self.open(working_dir, opts={})    
17       default = {:working_directory => working_dir,
18                  :repository => File.join(working_dir, '.git'), 
19                  :index => File.join(working_dir, '.git', 'index')}
20       git_options = default.merge(opts)
21       
22       self.new(git_options)
23     end
24     
25     def initialize(options = {})
26       @working_directory = Git::Repository.new(options[:working_directory]) if options[:working_directory]
27       @repository = Git::Repository.new(options[:repository]) if options[:repository]
28       @index = Git::Index.new(options[:index]) if options[:index]
29     end
30   
31     def self.clone
32       raise NotImplementedError
33     end
34   
35     def self.init
36       raise NotImplementedError
37     end
39     
40     def dir
41       @working_directory
42     end
44     def repo
45       @repository
46     end
47     
48     def index
49       @index
50     end
51     
52     private
53     
54       def is_git_dir(dir)
55       end
57   end
58   
59 end