Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 37 lines (31 sloc) 0.911 kb
c2adfbf @mislav rewrite test script in bash
mislav authored
1 #!/usr/bin/env ruby
2 old_verbose, $VERBOSE = $VERBOSE, nil
3 begin
4 require File.expand_path('../../test/live_server', __FILE__)
5 ensure
6 $VERBOSE = old_verbose
7 end
8 require 'webrick'
9
10 port = 4000
11 if found = ARGV.index('-p')
12 port = ARGV[found + 1].to_i
13 end
14
eed0943 @mislav have script/server log to stdout when called directly
mislav authored
15 log_io = $stdout
c2adfbf @mislav rewrite test script in bash
mislav authored
16 log_io.sync = true
17
18 webrick_opts = {
19 :Port => port, :Logger => WEBrick::Log::new(log_io),
20 :AccessLog => [[log_io, "[%{X-Faraday-Adapter}i] %m %U -> %s %b"]]
21 }
22
23 if ENV['SSL_KEY']
24 require 'openssl'
25 require 'webrick/https'
26 webrick_opts.update \
27 :SSLEnable => true,
28 :SSLPrivateKey => OpenSSL::PKey::RSA.new(File.read(ENV['SSL_KEY'])),
29 :SSLCertificate => OpenSSL::X509::Certificate.new(File.read(ENV['SSL_FILE'])),
30 :SSLVerifyClient => OpenSSL::SSL::VERIFY_NONE
31 end
32
33 Rack::Handler::WEBrick.run(Faraday::LiveServer, webrick_opts) do |server|
34 trap(:INT) { server.stop }
35 trap(:TERM) { server.stop }
36 end
Something went wrong with that request. Please try again.