Sha256: 0fbad3c8422598f622c2eaa5a3a5f44a3175a706377878fd7cf4905e37f53e57
Contents?: true
Size: 994 Bytes
Versions: 1
Compression:
Stored size: 994 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.on('--once COMMAND','run the command once at server startup.') do | command | options[:once] = command 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] set :bind, '0.0.0.0' enable :run end puts`#{options[:once]}` if options[:once] post options[:url] {`#{ARGV[0]}`} get '/*' do 404 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubyhook-0.2.1 | bin/rubyhook |