Class: RakeUi::RakeTasksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rake_ui/rake_tasks_controller.rb

Constant Summary collapse

RAKE_TASK_ATTRS =
[:id,
:name,
:name_with_args,
:arg_description,
:full_comment,
:locations,
:is_internal_task,
:sources].freeze

Instance Method Summary collapse

Instance Method Details

#executeObject



44
45
46
47
48
49
50
# File 'app/controllers/rake_ui/rake_tasks_controller.rb', line 44

def execute
  @rake_task = RakeUi::RakeTask.find_by_id(params[:id])

  rake_task_log = @rake_task.call(args: params[:args], environment: params[:environment])

  redirect_to rake_task_log_path rake_task_log.id
end

#indexObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/rake_ui/rake_tasks_controller.rb', line 14

def index
  @rake_tasks = RakeUi::RakeTask.all

  unless params[:show_all]
    @rake_tasks = @rake_tasks.select(&:internal_task?)
  end

  respond_to do |format|
    format.html
    format.json do
      render json: {
        rake_tasks: rake_tasks_as_json(@rake_tasks)
      }
    end
  end
end

#showObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/rake_ui/rake_tasks_controller.rb', line 31

def show
  @rake_task = RakeUi::RakeTask.find_by_id(params[:id])

  respond_to do |format|
    format.html
    format.json do
      render json: {
        rake_task: rake_task_as_json(@rake_task)
      }
    end
  end
end