Class: Scriptor::ScriptsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Scriptor::ScriptsController
- Defined in:
- app/controllers/scriptor/scripts_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 |
# File 'app/controllers/scriptor/scripts_controller.rb', line 3 def index @scripts = Scriptor::Script.all end |
#run ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/scriptor/scripts_controller.rb', line 12 def run script = Scriptor::Script.find(params[:filename]) args = params[:args].to_s.strip.split script.run(*args) redirect_to script_path(script.filename), notice: "Script executed successfully." rescue StandardError => e redirect_to script_path(script.filename), alert: "Error executing script: #{e.message}" end |
#show ⇒ Object
7 8 9 10 |
# File 'app/controllers/scriptor/scripts_controller.rb', line 7 def show @script = Scriptor::Script.find(params[:filename]) @executions = Execution.where(script_filename: @script.filename).order(id: :desc) end |