webify 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/webify/backend/thin.rb +29 -0
- data/lib/webify/runner.rb +3 -2
- data/lib/webify/version.rb +1 -1
- metadata +4 -3
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Webify
|
|
2
2
|
|
|
3
|
-
A simple utility
|
|
3
|
+
A simple utility to serve static files to your browser. Handy to test Javascript apps. Supported backends include: WEBrick, Thin, and Mongrel.
|
|
4
4
|
|
|
5
5
|
Written by Rida Al Barazi and Peter Kieltyka from Nulayer Inc.
|
|
6
6
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'thin'
|
|
3
|
+
rescue LoadError => ex
|
|
4
|
+
$stderr.puts "Oops.. can't load Thin, try: gem install thin"
|
|
5
|
+
exit!
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module Webify
|
|
9
|
+
module Backend
|
|
10
|
+
|
|
11
|
+
class Thin
|
|
12
|
+
def self.start!(options={})
|
|
13
|
+
dir = File.expand_path(options[:dir] || Webify::DEFAULT_DIR)
|
|
14
|
+
port = options[:port] || Webify::DEFAULT_PORT
|
|
15
|
+
|
|
16
|
+
server = ::Thin::Server.new('0.0.0.0', port) do
|
|
17
|
+
use Rack::CommonLogger
|
|
18
|
+
run Rack::Static.new(nil, { :urls => ['/'], :root => dir })
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
trap('INT') { server.stop! }
|
|
22
|
+
|
|
23
|
+
Dir.chdir(dir)
|
|
24
|
+
server.start!
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/webify/runner.rb
CHANGED
|
@@ -12,12 +12,13 @@ module Webify
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
options_parser = OptionParser.new do |opts|
|
|
15
|
-
opts.banner = "Webify -- serve any directory to your browser\n"+
|
|
15
|
+
opts.banner = "Webify v#{Webify::VERSION} -- serve any directory to your browser\n"+
|
|
16
16
|
"Usage: webify [options]"
|
|
17
17
|
|
|
18
18
|
opts.separator ""
|
|
19
19
|
opts.separator "Server options:"
|
|
20
20
|
|
|
21
|
+
opts.on('-t', '--thin', "Use Thin as the backend (default: #{options[:backend]})") { options[:backend] = 'Thin' }
|
|
21
22
|
opts.on('-m', '--mongrel', "Use Mongrel as the backend (default: #{options[:backend]})") { options[:backend] = 'Mongrel' }
|
|
22
23
|
opts.on('-d', '--dir DIRECTORY', "Document root DIRECTORY (default: #{options[:dir]})") {|val| options[:dir] = val }
|
|
23
24
|
opts.on('-p', '--port PORT', "Use PORT (default: #{options[:port]})") {|val| options[:port] = val }
|
|
@@ -25,7 +26,7 @@ module Webify
|
|
|
25
26
|
|
|
26
27
|
opts.separator ""
|
|
27
28
|
opts.separator "Mongrel backend options:"
|
|
28
|
-
opts.on('-
|
|
29
|
+
opts.on('-r', '--throttle TIME', "Time to pause (in hundredths of a second) between accepting clients. (default: #{options[:throttle]})") {|val| options[:throttle] = val }
|
|
29
30
|
end
|
|
30
31
|
options_parser.parse!(ARGV)
|
|
31
32
|
|
data/lib/webify/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: webify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2011-
|
|
13
|
+
date: 2011-12-29 00:00:00.000000000 Z
|
|
14
14
|
dependencies: []
|
|
15
15
|
description: Serve any directory to your browser
|
|
16
16
|
email:
|
|
@@ -23,6 +23,7 @@ extra_rdoc_files: []
|
|
|
23
23
|
files:
|
|
24
24
|
- README.md
|
|
25
25
|
- lib/webify/backend/mongrel.rb
|
|
26
|
+
- lib/webify/backend/thin.rb
|
|
26
27
|
- lib/webify/backend/webrick.rb
|
|
27
28
|
- lib/webify/runner.rb
|
|
28
29
|
- lib/webify/version.rb
|
|
@@ -48,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
48
49
|
version: 1.3.6
|
|
49
50
|
requirements: []
|
|
50
51
|
rubyforge_project:
|
|
51
|
-
rubygems_version: 1.8.
|
|
52
|
+
rubygems_version: 1.8.13
|
|
52
53
|
signing_key:
|
|
53
54
|
specification_version: 3
|
|
54
55
|
summary: Serve any directory to your browser
|