
- Re-factor - Remove code for notifications - Remove addons - Remove travis-core gem. - Ignore logs directory only - Move core tests to spec/lib
37 lines
654 B
Ruby
37 lines
654 B
Ruby
require 'core_ext/active_record/none_scope'
|
|
require 'travis/services/base'
|
|
|
|
module Travis
|
|
module Services
|
|
class FindBranch < Base
|
|
register :find_branch
|
|
|
|
def run
|
|
result
|
|
end
|
|
|
|
def updated_at
|
|
result.updated_at if result
|
|
end
|
|
|
|
private
|
|
|
|
def result
|
|
@result ||= params[:id] ? by_id : by_params
|
|
end
|
|
|
|
def by_id
|
|
scope(:build).find(params[:id])
|
|
end
|
|
|
|
def by_params
|
|
repo.last_build_on params[:branch] if repo and params[:branch]
|
|
end
|
|
|
|
def repo
|
|
@repo ||= run_service(:find_repo, params)
|
|
end
|
|
end
|
|
end
|
|
end
|