Sha256: cf475117062d52921ff29ed79d3e0e86929f4f9fe59e9024895318bf8a1e9e12

Contents?: true

Size: 695 Bytes

Versions: 24

Compression:

Stored size: 695 Bytes

Contents

require "timeout"

module Frank
    class MacLauncher

        def initialize(app_path)
            @app_path = app_path
        end

        def launch
            `open "#{@app_path}"`
        end

        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

        def relaunch
            self.quit_if_running
            self.launch
        end
    end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
frank-cucumber-1.1.8 lib/frank-cucumber/mac_launcher.rb
frank-cucumber-1.1.7 lib/frank-cucumber/mac_launcher.rb
frank-cucumber-1.1.6 lib/frank-cucumber/mac_launcher.rb
frank-cucumber-1.1.5 lib/frank-cucumber/mac_launcher.rb