Class: MigrationButton::RunnerController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/migration_button/runner_controller.rb

Defined Under Namespace

Classes: Page

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.page(&blk) ⇒ Object



34
35
36
37
38
39
40
# File 'app/controllers/migration_button/runner_controller.rb', line 34

def self.page(&blk)
  output = blk&.call

  Page.new(runner.migrations_status,
           output,
           MigrationButton::Middleware.last_request)
end

.runnerObject



30
31
32
# File 'app/controllers/migration_button/runner_controller.rb', line 30

def self.runner
  MigrationButton::Runner.new
end

Instance Method Details

#downObject



24
25
26
27
28
# File 'app/controllers/migration_button/runner_controller.rb', line 24

def down
  @page = page { runner.run(:down, params[:version]) }

  render :index
end

#indexObject



8
9
10
# File 'app/controllers/migration_button/runner_controller.rb', line 8

def index
  @page = page
end

#migrateObject



12
13
14
15
16
# File 'app/controllers/migration_button/runner_controller.rb', line 12

def migrate
  @page = page { runner.migrate }

  render :index
end

#upObject



18
19
20
21
22
# File 'app/controllers/migration_button/runner_controller.rb', line 18

def up
  @page = page { runner.run(:up, params[:version]) }

  render :index
end