Class: Octopi::Commit

Included Modules

Octopi::Resource

Attributes

Instance Attributes

added [RW] public

Sets the attribute added.

authored_date [RW] public

Sets the attribute authored_date.

author [RW] public

Sets the attribute author.

committed_date [RW] public

Sets the attribute committed_date.

committer [RW] public

Sets the attribute committer.

id [RW] public

Sets the attribute id.

message [RW] public

Sets the attribute message.

modified [RW] public

Sets the attribute modified.

parents [RW] public

Sets the attribute parents.

removed [RW] public

Sets the attribute removed.

repository [RW] public

Sets the attribute repository.

tree [RW] public

Sets the attribute tree.

url [RW] public

Sets the attribute url.

Constants Inherited from Octopi::Base

VALID

Constructor Summary

This class inherits a constructor from Octopi::Base.

Public Visibility

Public Class Method Summary

find(opts = {})

Finds all commits for the given options:.

find_all(opts = {})

Finds all commits for the given options:.

Public Instance Method Summary

#repo_identifier

Public Instance Methods Inherited from Octopi::Base

error=, property, save

Public Class Method Details

find

public find(opts = {})

Finds all commits for the given options:

:repo or :repository or :name - A repository object or the name of a repository :user - A user object or the login of a user :branch - A branch object or the name of a branch. Defaults to master. :sha - The commit ID

Sample usage:

  >> find(:user => "fcoury", :repo => "octopi", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae")
  => <Commit f6609209c3ac0badd004512d318bfaa508ea10ae for branch master>

  >> find(:user => "fcoury", :repo => "octopi", :branch => "lazy", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae") # branch is set to lazy.
  => <Commit f6609209c3ac0badd004512d318bfaa508ea10ae for branch lazy>
[View source]


47
48
49
50
# File 'lib/octopi/commit.rb', line 47

def self.find(opts={})
  user, repo, branch, sha = gather_details(opts)
  super [user, repo, sha]
end

find_all

public find_all(opts = {})

Finds all commits for the given options:

:repo or :repository or :name - A repository object or the name of a repository :user - A user object or the login of a user :branch - A branch object or the name of a branch. Defaults to master.

Sample usage:

  >> find_all(:user => "fcoury", :repo => "octopi")
  => <Latest 30 commits for master branch>

  => find_all(:user => "fcoury", :repo => "octopi", :branch => "lazy") # branch is set to lazy.
  => <Latest 30 commits for lazy branch>
[View source]


24
25
26
27
28
29
30
# File 'lib/octopi/commit.rb', line 24

def self.find_all(opts={})
  user, repo, branch = gather_details(opts)
  commits = super user, repo.name, branch
  # Repository is not passed in from the data, set it manually.
  commits.each { |c| c.repository = repo }
  commits
end

Public Instance Method Details

repo_identifier

public repo_identifier
[View source]


52
53
54
55
56
57
58
59
60
61
# File 'lib/octopi/commit.rb', line 52

def repo_identifier
  url_parts = url.split('/')
  if @repository
    parts = [@repository.owner, @repository.name, url_parts[6]] 
  else
    parts = [url_parts[3], url_parts[4], url_parts[6]]
  end
  
  parts.join('/')
end
Generated on Friday, July 31 2009 at 05:01:54 PM by YARD 0.2.3.2 (ruby-1.8.6).