Class: Devbin::Commands::Rails::Restart

Inherits:
Devbin::Command show all
Defined in:
lib/devbin/commands/rails/restart.rb

Instance Method Summary collapse

Methods inherited from Devbin::Command

#command, #cursor, #docker_pwd, #docker_sync_pwd, #editor, #exec_exist?, #find_pwd, #generator, #pager, #pastel, #platform, #prompt, #screen, #which

Constructor Details

#initialize(app_name, options) ⇒ Restart

Returns a new instance of Restart.



9
10
11
12
# File 'lib/devbin/commands/rails/restart.rb', line 9

def initialize(app_name, options)
  @app_name = app_name
  @options = options
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/devbin/commands/rails/restart.rb', line 14

def execute(input: $stdin, output: $stdout)
  require_relative "stop"
  Devbin::Commands::Rails::Stop.new(@app_name, {all: false}).execute
  run "docker-sync start", chdir: docker_sync_pwd
  require_relative "server"
  Devbin::Commands::Rails::Server.new(@app_name, {detach: @optons && @options[:detach]}).execute
  output.puts "OK"
end