Class: ExportHTTP
- Inherits:
-
WEBrick::HTTPServer
- Object
- WEBrick::HTTPServer
- ExportHTTP
- Defined in:
- lib/export_http.rb
Class Method Summary collapse
Class Method Details
.kill ⇒ Object
17 18 19 |
# File 'lib/export_http.rb', line 17 def self.kill @server.stop end |
.run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/export_http.rb', line 3 def self.run dir = Dir.pwd port = (dir.hash % 1000) + 6000 host = `hostname` host = '0.0.0.0' if host == '' @server = self.new( :DocumentRoot => dir, :Port => port, :Host => host) trap("INT") {self.kill} puts "Sharing #{File.(dir)} on http://#{host}:#{port}/" @server.start end |