lib/travis/cli/repo_command.rb in travis-1.0.3 vs lib/travis/cli/repo_command.rb in travis-1.1.0
- old
+ new
@@ -11,18 +11,33 @@
def setup
error "Can't figure out GitHub repo name. Are you in the right directory?" unless self.slug ||= find_slug
self.api_endpoint = detect_api_endpoint
super
+ repository.load # makes sure we actually have access to the repo
end
def repository
repo(slug)
rescue Travis::Client::NotFound
- error "repository not known to travis: #{color(slug, :important)}"
+ error "repository not known to #{api_endpoint}: #{color(slug, :important)}"
end
private
+
+ def build(number_or_id)
+ return super if number_or_id.is_a? Integer
+ repository.build(number_or_id)
+ end
+
+ def job(number_or_id)
+ return super if number_or_id.is_a? Integer
+ repository.job(number_or_id)
+ end
+
+ def last_build
+ repository.last_build or error("no build yet for #{slug}")
+ end
def detected_endpoint?
!explicit_api_endpoint?
end