forked from fcoury/octopi
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commit tests are now complete. Added the ability to pass a class to f…
…ind, get, post and submit so we can get some good error messages for 404s.
- Loading branch information
Showing
10 changed files
with
166 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
test/stubs/commits/fcoury/octopi/f6609209c3ac0badd004512d318bfaa508ea10ae
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
commit: | ||
removed: [] | ||
|
||
added: [] | ||
|
||
message: |- | ||
Fix pulling issues from private repos. | ||
|
||
Signed-off-by: Felipe Coury <felipe.coury@gmail.com> | ||
modified: | ||
- diff: |- | ||
@@ -23,13 +23,14 @@ module Octopi | ||
# find_all(:user => "fcoury", :repo => "octopi") # state defaults to open | ||
# | ||
def self.find_all(*args) | ||
+ api = (args.length == 4 ? args.pop : nil) || ANONYMOUS_API | ||
repo = args.first | ||
user, repo_name, opts = extract_user_repository(*args) | ||
state = opts[:state] || "open" | ||
state.downcase! if state | ||
validate_args(user => :user, repo_name => :repo, state => :state) | ||
|
||
- issues = super user, repo_name, state | ||
+ issues = super user, repo_name, state, api | ||
issues.each { |i| i.repository = repo } if repo.is_a? Repository | ||
issues | ||
end | ||
@@ -39,7 +40,7 @@ module Octopi | ||
if args.length < 2 | ||
raise "Issue.find needs user, repository and issue number" | ||
end | ||
- | ||
+ api = (args.length == 3 ? args.pop : nil) || ANONYMOUS_API | ||
number = args.pop.to_i if args.last.respond_to?(:to_i) | ||
number = args.pop if args.last.is_a?(Integer) | ||
|
||
@@ -55,7 +56,7 @@ module Octopi | ||
|
||
user, repo = extract_names(user, repo) | ||
validate_args(user => :user, repo => :repo) | ||
- super user, repo, number | ||
+ super user, repo, number, api | ||
end | ||
|
||
def self.open(user, repo, params, api = ANONYMOUS_API) | ||
filename: lib/octopi/issue.rb | ||
- diff: |- | ||
@@ -79,7 +79,8 @@ module Octopi | ||
end | ||
|
||
def issues(state = "open") | ||
- Issue.find_all(self, :state => state) | ||
+ api = self.api || ANONYMOUS_API | ||
+ Issue.find_all(self, { :state => state }, api) | ||
end | ||
|
||
def all_issues | ||
@@ -87,7 +88,8 @@ module Octopi | ||
end | ||
|
||
def issue(number) | ||
- Issue.find(self, number) | ||
+ api = self.api || ANONYMOUS_API | ||
+ Issue.find(self, number, api) | ||
end | ||
|
||
def collaborators | ||
filename: lib/octopi/repository.rb | ||
parents: | ||
- id: 737650490a3cf3689f92644126407b21c4493d9a | ||
url: http://github.com/fcoury/octopi/commit/f6609209c3ac0badd004512d318bfaa508ea10ae | ||
author: | ||
name: Andrew Moreland | ||
email: andy@andymo.org | ||
id: f6609209c3ac0badd004512d318bfaa508ea10ae | ||
committed_date: "2009-07-27T18:24:59-07:00" | ||
authored_date: "2009-07-26T17:37:41-07:00" | ||
tree: a59231d4e3b99d6aaf349344ad0306b1bee7622d | ||
committer: | ||
name: Felipe Coury | ||
email: felipe.coury@gmail.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters