Sha256: da1b296eeb5d16e56ce57638f3ffe5ca9bf26edf18bc4d8e19def6b28a63c829

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module Octopi
  class Repository < Base
    include Resource
    set_resource_name "repository", "repositories"

    find_path "/repos/search/:query"
    resource_path "/repos/show/:id"

    def tags
      Tag.find(self.owner, self.name)
    end  
    
    def clone_url
      #FIXME: Return "git@github.com:#{self.owner}/#{self.name}.git" if
      #user's logged in and owns this repo.
      "git://github.com/#{self.owner}/#{self.name}.git"  
    end

    def self.find_by_user(user)
      user = user.login if user.is_a? User
      find_plural(user, :resource)
    end

    def self.find(user, name)
      user = user.login if user.is_a? User
      name = repo.name if name.is_a? Repository
      super [user,name]
    end

    def self.find_all(*args)
      # FIXME: This should be URI escaped, but have to check how the API
      # handles escaped characters first.
      super args.join(" ").gsub(/ /,'+')
    end
    
    def commits(branch = "master")
      Commit.find_all(self, :branch => branch)
    end
    
    def issues(state = "open")
      Issue.find_all(self, :state => state)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fcoury-octopi-0.0.5 lib/octopi/repository.rb