fivepointssolutions-serve 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -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
@@ -0,0 +1,12 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
10
+
11
+ require 'activesupport'
12
+ require 'serve'
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
+