Class: Stable::Commands::Open
- Inherits:
-
Object
- Object
- Stable::Commands::Open
- Defined in:
- lib/stable/commands/open.rb
Overview
Open command - opens a Rails application in a browser
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(app_name) ⇒ Open
constructor
A new instance of Open.
Constructor Details
#initialize(app_name) ⇒ Open
Returns a new instance of Open.
7 8 9 |
# File 'lib/stable/commands/open.rb', line 7 def initialize(app_name) @app_name = app_name end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/stable/commands/open.rb', line 11 def call app = Services::AppRegistry.find(@app_name) abort "App '#{@app_name}' not found" unless app abort "App '#{@app_name}' is not running" unless app[:pid] && process_alive?(app[:pid]) url = build_url(app) open_browser(url) puts "✔ Opened #{url}" end |