Class: Hubstats::DeploysController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Hubstats::DeploysController
- Defined in:
- app/controllers/hubstats/deploys_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/hubstats/deploys_controller.rb', line 32 def create if params[:deployed_by].nil? || params[:git_revision].nil? || params[:repo_name].nil? render text: "Missing a necessary parameter: deployer, git revision, or repository name.", :status => 400 and return else @deploy = Deploy.new @deploy.deployed_at = params[:deployed_at] @deploy.deployed_by = params[:deployed_by] @deploy.git_revision = params[:git_revision] @repo = Hubstats::Repo.where(full_name: params[:repo_name]) if @repo.empty? render text: "Repository name is invalid.", :status => 400 and return else @deploy.repo_id = @repo.first.id.to_i end if @deploy.save render :nothing =>true, :status => 200 and return else render :nothing => true, :status => 400 and return end end end |
#index ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/hubstats/deploys_controller.rb', line 6 def index #deploy_id = Hubstats::Deploy # .order_with_timespan(@timespan, "ASC") # .belonging_to_users(params[:users]) # .belonging_to_repos(params[:repo]) # .has_many_pull_requests(params[:pull_requests]) # .map(&:id) # sets to include user and repo, and sorts data @deploys = Hubstats::Deploy.includes(:repo) .order_with_timespan(@timespan, params[:order]) # .belonging_to_users(params[:users]).belonging_to_repos(params[:repos]) # .paginate(:page => params[:page], :per_page => 15).order("deployed_at DESC") if params[:group] == 'user' @groups = @deploys.to_a.group_by(&:user_name) elsif params[:group] == 'repo' @groups = @deploys.to_a.group_by(&:repo_name) else @groups = nil end end |
#show ⇒ Object
29 30 |
# File 'app/controllers/hubstats/deploys_controller.rb', line 29 def show end |