fivepointssolutions-serve 0.9.11
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/History.txt +52 -0
- data/License.txt +20 -0
- data/Quickstart.textile +148 -0
- data/README.txt +105 -0
- data/VERSION.yml +4 -0
- data/bin/serve +12 -0
- data/lib/serve.rb +10 -0
- data/lib/serve/application.rb +150 -0
- data/lib/serve/file_resolver.rb +46 -0
- data/lib/serve/handlers/dynamic_handler.rb +210 -0
- data/lib/serve/handlers/email_handler.rb +23 -0
- data/lib/serve/handlers/file_type_handler.rb +37 -0
- data/lib/serve/handlers/markdown_handler.rb +10 -0
- data/lib/serve/handlers/redirect_handler.rb +13 -0
- data/lib/serve/handlers/sass_handler.rb +19 -0
- data/lib/serve/handlers/textile_handler.rb +10 -0
- data/lib/serve/rails.rb +3 -0
- data/lib/serve/rails/configuration.rb +69 -0
- data/lib/serve/rails/controllers/serve_controller.rb +43 -0
- data/lib/serve/rails/mount.rb +29 -0
- data/lib/serve/rails/routing.rb +25 -0
- data/lib/serve/response_cache.rb +172 -0
- data/lib/serve/version.rb +13 -0
- data/lib/serve/webrick/extensions.rb +98 -0
- data/lib/serve/webrick/server.rb +17 -0
- data/lib/serve/webrick/servlet.rb +19 -0
- data/spec/response_cache_spec.rb +248 -0
- data/spec/serve_application_spec.rb +75 -0
- data/spec/serve_spec.rb +13 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +12 -0
- metadata +89 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require 'serve/application'
|
3
|
+
|
4
|
+
describe Serve::Application do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
@app = Serve::Application.new
|
8
|
+
@defopts = {
|
9
|
+
:help => false,
|
10
|
+
:help => false,
|
11
|
+
:version => false,
|
12
|
+
:environment => 'development',
|
13
|
+
:port => 4000,
|
14
|
+
:address => '0.0.0.0',
|
15
|
+
:root => Dir.pwd
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "parsing" do
|
20
|
+
it "should parse no arguments" do
|
21
|
+
@app.parse([]).should == @defopts
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should parse with only the port" do
|
25
|
+
@app.parse(["2000"])[:port].should == "2000"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should parse with the port and address" do
|
29
|
+
@app.parse(["1.1.1.1", "2000"]).should ==
|
30
|
+
@defopts.update(:address => "1.1.1.1", :port=>"2000")
|
31
|
+
@app.parse(["1.1.1.1:2000"]).should ==
|
32
|
+
@defopts.update(:address => "1.1.1.1", :port=>"2000")
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should parse with the port, address, and protocol" do
|
36
|
+
@app.parse(["http://1.1.1.1:2000"]).should ==
|
37
|
+
@defopts.update(:address => "1.1.1.1", :port=>"2000")
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should parse help" do
|
41
|
+
@app.parse([])[:help].should be_false
|
42
|
+
@app.parse(["-h"])[:help].should be_true
|
43
|
+
@app.parse(["--help"])[:help].should be_true
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should parse version" do
|
47
|
+
@app.parse([])[:version].should be_false
|
48
|
+
@app.parse(["-v"])[:version].should be_true
|
49
|
+
@app.parse(["--version"])[:version].should be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should parse environment" do
|
53
|
+
@app.parse([])[:environment].should == "development"
|
54
|
+
@app.parse(["production"])[:environment].should == "production"
|
55
|
+
@app.parse(["test"])[:environment].should == "test"
|
56
|
+
@app.parse(["development"])[:environment].should == "development"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should parse working directory" do
|
60
|
+
@app.parse([])[:root].should == Dir.pwd
|
61
|
+
dir = File.dirname(__FILE__)
|
62
|
+
@app.parse([dir])[:root].should == File.expand_path(dir)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should detect invalid arguments" do
|
66
|
+
lambda { @app.parse(["--invalid"]) }.should raise_error(Serve::Application::InvalidArgumentsError)
|
67
|
+
lambda { @app.parse(["invalid"]) }.should raise_error(Serve::Application::InvalidArgumentsError)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "running" do
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
data/spec/serve_spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
require 'serve/application'
|
3
|
+
|
4
|
+
describe "Serve" do
|
5
|
+
|
6
|
+
it "should register all of the file type handlers" do
|
7
|
+
Serve::WEBrick::Server.register_handlers
|
8
|
+
handlers = ["cgi", "css", "email", "erb", "haml", "html.erb", "html.haml", "markdown", "redirect", "rhtml", "sass", "textile"]
|
9
|
+
table = WEBrick::HTTPServlet::FileHandler::HandlerTable
|
10
|
+
table.keys.sort.should == handlers
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fivepointssolutions-serve
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.11
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John W. Long
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-17 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Serve is a small Ruby script that makes it easy to start up a WEBrick server in any directory. Serve is ideal for HTML prototyping and simple file sharing. If the haml, redcloth, and bluecloth gems are installed serve can handle Haml, Sass, Textile, and Markdown (in addition to HTML).
|
17
|
+
email: me@johnwlong.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- History.txt
|
26
|
+
- License.txt
|
27
|
+
- Quickstart.textile
|
28
|
+
- README.txt
|
29
|
+
- VERSION.yml
|
30
|
+
- bin/serve
|
31
|
+
- lib/serve
|
32
|
+
- lib/serve/application.rb
|
33
|
+
- lib/serve/file_resolver.rb
|
34
|
+
- lib/serve/handlers
|
35
|
+
- lib/serve/handlers/dynamic_handler.rb
|
36
|
+
- lib/serve/handlers/email_handler.rb
|
37
|
+
- lib/serve/handlers/file_type_handler.rb
|
38
|
+
- lib/serve/handlers/markdown_handler.rb
|
39
|
+
- lib/serve/handlers/redirect_handler.rb
|
40
|
+
- lib/serve/handlers/sass_handler.rb
|
41
|
+
- lib/serve/handlers/textile_handler.rb
|
42
|
+
- lib/serve/rails
|
43
|
+
- lib/serve/rails/configuration.rb
|
44
|
+
- lib/serve/rails/controllers
|
45
|
+
- lib/serve/rails/controllers/serve_controller.rb
|
46
|
+
- lib/serve/rails/mount.rb
|
47
|
+
- lib/serve/rails/routing.rb
|
48
|
+
- lib/serve/rails.rb
|
49
|
+
- lib/serve/response_cache.rb
|
50
|
+
- lib/serve/version.rb
|
51
|
+
- lib/serve/webrick
|
52
|
+
- lib/serve/webrick/extensions.rb
|
53
|
+
- lib/serve/webrick/server.rb
|
54
|
+
- lib/serve/webrick/servlet.rb
|
55
|
+
- lib/serve.rb
|
56
|
+
- spec/response_cache_spec.rb
|
57
|
+
- spec/serve_application_spec.rb
|
58
|
+
- spec/serve_spec.rb
|
59
|
+
- spec/spec.opts
|
60
|
+
- spec/spec_helper.rb
|
61
|
+
- spec/tmp
|
62
|
+
has_rdoc: false
|
63
|
+
homepage: http://github.com/jlong/serve
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: "0"
|
74
|
+
version:
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
requirements: []
|
82
|
+
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 1.2.0
|
85
|
+
signing_key:
|
86
|
+
specification_version: 2
|
87
|
+
summary: Serve is a small Ruby script that makes it easy to start up a WEBrick server in any directory. Serve is ideal for HTML prototyping and simple file sharing. If the haml, redcloth, and bluecloth gems are installed serve can handle Haml, Sass, Textile, and Markdown (in addition to HTML).
|
88
|
+
test_files: []
|
89
|
+
|