diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-07 16:24:15 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-07 16:24:15 -0800 |
commit | b5d6b907b080992c2d0220eceb66f4ffa85207cd (patch) | |
tree | 6a9b2829ac3087b237a88ffe90528905f90c6e34 /lib/git/base.rb | |
parent | f5baa11a1c82dc42ade5c291e9f061c13b66bc2f (diff) | |
download | third_party-ruby-git-b5d6b907b080992c2d0220eceb66f4ffa85207cd.tar.gz third_party-ruby-git-b5d6b907b080992c2d0220eceb66f4ffa85207cd.tar.xz third_party-ruby-git-b5d6b907b080992c2d0220eceb66f4ffa85207cd.zip |
got the first round working
Diffstat (limited to 'lib/git/base.rb')
-rw-r--r-- | lib/git/base.rb | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb new file mode 100644 index 0000000..6eb3455 --- /dev/null +++ b/lib/git/base.rb @@ -0,0 +1,59 @@ +module Git + + class Base + + @working_directory = nil + @repository = nil + @index = nil + + # opens a Git Repository - no working directory options + def self.repo(git_dir) + self.new :repository => git_dir + end + + # opens a new Git Project from a working directory + # you can specify non-standard git_dir and index file in the options + def self.open(working_dir, opts={}) + default = {:working_directory => working_dir, + :repository => File.join(working_dir, '.git'), + :index => File.join(working_dir, '.git', 'index')} + git_options = default.merge(opts) + + self.new(git_options) + end + + def initialize(options = {}) + @working_directory = Git::Repository.new(options[:working_directory]) if options[:working_directory] + @repository = Git::Repository.new(options[:repository]) if options[:repository] + @index = Git::Index.new(options[:index]) if options[:index] + end + + def self.clone + raise NotImplementedError + end + + def self.init + raise NotImplementedError + end + + + def dir + @working_directory + end + + def repo + @repository + end + + def index + @index + end + + private + + def is_git_dir(dir) + end + + end + +end
\ No newline at end of file |