travis-api/lib/travis/services/find_branches.rb
Aakriti Gupta 65f1a29d86 Move travis-core files from /vendor to /lib.
- Re-factor
- Remove code for notifications
- Remove addons
- Remove travis-core gem.
- Ignore logs directory only
- Move core tests to spec/lib
2016-07-20 11:22:25 +02:00

33 lines
605 B
Ruby

require 'core_ext/active_record/none_scope'
require 'travis/services/base'
module Travis
module Services
class FindBranches < Base
register :find_branches
def run
result
end
private
def result
@result ||= params[:ids] ? by_ids : by_params
end
def by_ids
scope(:build).where(:id => params[:ids])
end
def by_params
repo ? repo.last_finished_builds_by_branches : scope(:build).none
end
def repo
@repo ||= run_service(:find_repo, params)
end
end
end
end