Sha256: b49a44e892b7345b83571385cfe169d9df6848c2eeaa39f45572ae5f8d8fcdbb

Contents?: true

Size: 575 Bytes

Versions: 4

Compression:

Stored size: 575 Bytes

Contents

require 'launchy'

class Tane::Commands::Open < Tane::Commands::Base
  class << self
    def process(args)
      timeout = opts.timeout || 120

      started = try_for(:seconds => timeout) do
        begin
          RestClient.get("http://localhost:3000/")
          true
        rescue => e
          false
        end
      end

      Launchy.open("http://localhost:3000/") if started
    end

    def help_text
      <<-EOL
Usage:

    tane open

Waits until there's a webserver running at port 3000 and then opens the browser to it.

    tane open
EOL
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tane-0.0.5 lib/tane/commands/open.rb
tane-0.0.4 lib/tane/commands/open.rb
tane-0.0.3 lib/tane/commands/open.rb
tane-0.0.2 lib/tane/commands/open.rb