Class: Api::BuildsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/api/builds_controller.rb

Instance Method Summary collapse

Instance Method Details

#hintObject


9
10
11
# File 'app/controllers/api/builds_controller.rb', line 9

def hint
  render_text "> Greetings, Professor Falken.\n\n> _\n"
end

#runObject


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/api/builds_controller.rb', line 13

def run  # let's ensure backwards compatibility

  params[:language] = 'javascript' if params[:language] == 'nodejs'

  if valid_params?
    file = dump_request_to_file
    if build = enqueue_build(file.path)
      copy_file(file, build)
      update_project_if_necessary(build.project)

      render_text "Successfully created build ##{build.number}\n" \
                "URL: #{project_url(build.project)}\n"
    else
      render_text "[ERROR] Build could not be created.\n"
    end
  else
    render_text "[ERROR] #{@param_errors}\n"
  end
end