Sha256: 1b07e5e5871d844199202538341e5f3fca4cd5bc9a9b6c478c203309efe65d6f

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

#!/usr/bin/env ruby
require 'sinatra'
require 'optparse'
require 'rubyhook/version'


include Rubyhook

options = {port: 4000,url: '/update'}

OptionParser.new do |opts|

  opts.on('-p P','--port P','Listens on port P. Default is 4000') do |p|
    options[:port] = p
  end

  opts.on('-u U','--url U','The URL-path the server will be reacting to. Defaults to /update') do |u|
    options[:url] = u
  end

  opts.on('--version','prints the version of rh.') do
    puts "This is rubyhook, version #{VERSION}"
    exit
  end

  opts.banner = "Usage: rh [options] command"
end.parse!

abort "you need to specify a command \n type 'robyhook --help' for additional information" if ARGV.empty?

configure do
  set :port, options[:port]
  enable :run
end

post options[:url] {`#{ARGV[0]}`}

get '/*' do 
  404
end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyhook-0.1.0 bin/rubyhook