Class: Devbin::Commands::Rails::Stop

Inherits:
Devbin::Command show all
Defined in:
lib/devbin/commands/rails/stop.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) ⇒ Stop

Returns a new instance of Stop.



9
10
11
12
# File 'lib/devbin/commands/rails/stop.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
22
# File 'lib/devbin/commands/rails/stop.rb', line 14

def execute(input: $stdin, output: $stdout)
  run "docker-sync stop", chdir: docker_sync_pwd
  if @options[:all]
    run "docker-compose stop", chdir: docker_pwd
  else
    run "docker-compose stop #{@app_name}", chdir: docker_pwd
  end
  output.puts "OK"
end