Sha256: 8feec07e190ef656e607493094336e5810ebc2937a775494ef2080d31a94c2da

Contents?: true

Size: 1.88 KB

Versions: 24

Compression:

Stored size: 1.88 KB

Contents

module Git

  class Base

    module Factory
      
      # returns a Git::Branch object for branch_name
      def branch(branch_name = 'master')
        Git::Branch.new(self, branch_name)
      end

      # returns a Git::Branches object of all the Git::Branch 
      # objects for this repo
      def branches
        Git::Branches.new(self)
      end
      
      def commit_tree(tree = nil, opts = {})
        Git::Object::Commit.new(self, self.lib.commit_tree(tree, opts))
      end

      # returns a Git::Diff object
      def diff(objectish = 'HEAD', obj2 = nil)
        Git::Diff.new(self, objectish, obj2)
      end
      
      def gblob(objectish)
        Git::Object.new(self, objectish, 'blob')
      end
      
      def gcommit(objectish)
        Git::Object.new(self, objectish, 'commit')
      end

      def gtree(objectish)
        Git::Object.new(self, objectish, 'tree')
      end
      
      # returns a Git::Log object with count commits
      def log(count = 30)
        Git::Log.new(self, count)
      end
      
      # returns a Git::Object of the appropriate type
      # you can also call @git.gtree('tree'), but that's 
      # just for readability.  If you call @git.gtree('HEAD') it will
      # still return a Git::Object::Commit object.  
      #
      # @git.object calls a factory method that will run a rev-parse 
      # on the objectish and determine the type of the object and return 
      # an appropriate object for that type 
      def object(objectish)
        Git::Object.new(self, objectish)
      end
  
      # returns a Git::Remote object
      def remote(remote_name = 'origin')
        Git::Remote.new(self, remote_name)
      end

      # returns a Git::Status object
      def status
        Git::Status.new(self)
      end
    
      # returns a Git::Tag object
      def tag(tag_name)
        Git::Object.new(self, tag_name, 'tag', true)
      end

    end

  end

end

Version data entries

24 entries across 24 versions & 8 rubygems

Version Path
sigterm_extensions-0.0.4 lib/git/base/factory.rb
git-ce-1.5.0.2 lib/git/base/factory.rb
git-ce-1.5.0.1 lib/git/base/factory.rb
git-ce-1.5.0 lib/git/base/factory.rb
git-1.5.0 lib/git/base/factory.rb
git-1.4.0 lib/git/base/factory.rb
ruby-git-fw-new-1.3.3 lib/git/base/factory.rb
ruby-git-yz-1.3.3 lib/git/base/factory.rb
git-ng-1.4.0 lib/git/base/factory.rb
cvss-suite-1.0.8 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
ruby-git-fw-1.3.2 lib/git/base/factory.rb
ruby-git-fw-1.3.1 lib/git/base/factory.rb
ruby-git-fw-1.3.0 lib/git/base/factory.rb
cvss-suite-1.0.7 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.6 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.5 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.4 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.3 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.2 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb
cvss-suite-1.0.1 vendor/cache/ruby/2.2.0/gems/git-1.3.0/lib/git/base/factory.rb