Class: Frank::MacLauncher
- Inherits:
-
Object
- Object
- Frank::MacLauncher
- Defined in:
- lib/frank-cucumber/mac_launcher.rb
Instance Method Summary collapse
-
#initialize(app_path) ⇒ MacLauncher
constructor
A new instance of MacLauncher.
- #launch ⇒ Object
- #quit_if_running ⇒ Object
- #relaunch ⇒ Object
Constructor Details
#initialize(app_path) ⇒ MacLauncher
Returns a new instance of MacLauncher.
6 7 8 |
# File 'lib/frank-cucumber/mac_launcher.rb', line 6 def initialize(app_path) @app_path = app_path end |
Instance Method Details
#launch ⇒ Object
10 11 12 |
# File 'lib/frank-cucumber/mac_launcher.rb', line 10 def launch `open "#{@app_path}"` end |
#quit_if_running ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/frank-cucumber/mac_launcher.rb', line 14 def quit_if_running pid = `ps -ax | grep "#{@app_path}" | grep -v grep` if pid != "" pid = pid.strip.split[0] `kill #{pid}` end Timeout::timeout(60) { while pid != "" pid = `ps -ax | grep "#{@app_path}" | grep -v grep` end } end |
#relaunch ⇒ Object
30 31 32 33 |
# File 'lib/frank-cucumber/mac_launcher.rb', line 30 def relaunch self.quit_if_running self.launch end |