Class: Devbin::Commands::Rails::Server
- Inherits:
-
Devbin::Command
- Object
- Devbin::Command
- Devbin::Commands::Rails::Server
- Defined in:
- lib/devbin/commands/rails/server.rb
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(app_name, options) ⇒ Server
constructor
A new instance of Server.
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) ⇒ Server
Returns a new instance of Server.
9 10 11 12 |
# File 'lib/devbin/commands/rails/server.rb', line 9 def initialize(app_name, ) @app_name = app_name @options = end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/devbin/commands/rails/server.rb', line 14 def execute(input: $stdin, output: $stdout) # Command logic goes here ... begin run "docker-sync start", chdir: docker_sync_pwd rescue TTY::Command::ExitError => e unless e. =~ /warning\s+docker-sync\salready\sstarted\sfor\sthis\sconfiguration/ raise e end end run "docker-compose up -d #{@app_name}", chdir: docker_pwd unless @options[:detach] require_relative "attach" Devbin::Commands::Rails::Attach.new(@app_name, {}).execute end output.puts "OK" end |