nolman-jetty-rails 0.9.6-jruby
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 +49 -0
- data/Licenses.txt +37 -0
- data/Manifest.txt +51 -0
- data/PostInstall.txt +2 -0
- data/README.rdoc +130 -0
- data/Rakefile +27 -0
- data/TODO.txt +11 -0
- data/bin/jetty_merb +41 -0
- data/bin/jetty_rails +41 -0
- data/jetty-libs/core-3.1.1.jar +0 -0
- data/jetty-libs/jetty-6.1.14.jar +0 -0
- data/jetty-libs/jetty-plus-6.1.14.jar +0 -0
- data/jetty-libs/jetty-util-6.1.14.jar +0 -0
- data/jetty-libs/jsp-2.1.jar +0 -0
- data/jetty-libs/jsp-api-2.1.jar +0 -0
- data/jetty-libs/servlet-api-2.5-6.1.14.jar +0 -0
- data/lib/jetty_rails.rb +26 -0
- data/lib/jetty_rails/adapters/abstract_adapter.rb +25 -0
- data/lib/jetty_rails/adapters/merb_adapter.rb +34 -0
- data/lib/jetty_rails/adapters/rails_adapter.rb +22 -0
- data/lib/jetty_rails/adapters/rails_jms_adapter.rb +104 -0
- data/lib/jetty_rails/config/command_line_reader.rb +75 -0
- data/lib/jetty_rails/config/rdoc_fix.rb +28 -0
- data/lib/jetty_rails/handler/delegate_on_errors_handler.rb +29 -0
- data/lib/jetty_rails/handler/public_directory_handler.rb +24 -0
- data/lib/jetty_rails/handler/web_app_handler.rb +85 -0
- data/lib/jetty_rails/jars.rb +36 -0
- data/lib/jetty_rails/runner.rb +46 -0
- data/lib/jetty_rails/server.rb +79 -0
- data/lib/jetty_rails/warbler_reader.rb +13 -0
- data/lib/jruby-rack-0.9.7-SNAPSHOT.jar +0 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +71 -0
- data/spec/config.yml +28 -0
- data/spec/jetty_merb_spec.rb +195 -0
- data/spec/jetty_rails/config_file_spec.rb +68 -0
- data/spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb +29 -0
- data/spec/jetty_rails/runner_spec.rb +162 -0
- data/spec/jetty_rails_sample_1.yml +13 -0
- data/spec/jetty_rails_sample_2.yml +28 -0
- data/spec/jetty_rails_spec.rb +195 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +12 -0
- data/tasks/jruby.rake +7 -0
- data/tasks/rspec.rake +49 -0
- data/website/index.txt +194 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +159 -0
- data/website/template.html.erb +56 -0
- metadata +174 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe JettyRails::Runner, "with config file containing several servers and apps" do
|
4
|
+
before do
|
5
|
+
@yaml_config = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'config.yml'))
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should instantiate runner with config.yml and setup servers" do
|
9
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
10
|
+
runner.servers.size.should == 3
|
11
|
+
runner.servers[4000].should_not == nil
|
12
|
+
runner.servers[3000].should_not == nil
|
13
|
+
server = runner.servers[8080]
|
14
|
+
server.should_not == nil
|
15
|
+
server.app_contexts.size.should == 2
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should setup correct context_paths" do
|
19
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
20
|
+
runner.servers[4000].config[:context_path].should == "/testB"
|
21
|
+
runner.servers[3000].config[:context_path].should == "/testA"
|
22
|
+
|
23
|
+
runner.servers[8080].config[:context_path].should == "/"
|
24
|
+
runner.servers[8080].app_contexts[0].context_path.should == "/testC"
|
25
|
+
runner.servers[8080].app_contexts[1].context_path.should == "/testD"
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should setup correct adapters" do
|
29
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
30
|
+
runner.servers[4000].config[:adapter].should == :merb
|
31
|
+
runner.servers[3000].config[:adapter].should == :rails
|
32
|
+
|
33
|
+
runner.servers[8080].config[:adapter].should == :rails # default
|
34
|
+
runner.servers[8080].app_contexts[0].config[:adapter].should == :merb
|
35
|
+
runner.servers[8080].app_contexts[1].config[:adapter].should == :rails
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should inherit environment" do
|
39
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
40
|
+
runner.servers[4000].config[:environment].should == "production"
|
41
|
+
runner.servers[3000].config[:environment].should == "development"
|
42
|
+
|
43
|
+
runner.servers[8080].config[:environment].should == "production"
|
44
|
+
runner.servers[8080].app_contexts[0].config[:environment].should =="test"
|
45
|
+
runner.servers[8080].app_contexts[1].config[:environment].should =="production"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should setup jruby environment" do
|
49
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
50
|
+
runner.servers[4000].app_contexts.first.adapter.init_params['jruby.min.runtimes'].should == '1'
|
51
|
+
runner.servers[4000].app_contexts.first.adapter.init_params['jruby.max.runtimes'].should == '2'
|
52
|
+
|
53
|
+
runner.servers[3000].app_contexts.first.adapter.init_params['jruby.min.runtimes'].should == '2'
|
54
|
+
runner.servers[3000].app_contexts.first.adapter.init_params['jruby.max.runtimes'].should == '2'
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should setup the server thread pool" do
|
58
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
59
|
+
runner.servers[4000].server.thread_pool.max_threads.should == 40
|
60
|
+
runner.servers[4000].server.thread_pool.min_threads.should == 1
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should setup the server acceptors" do
|
64
|
+
runner = JettyRails::Runner.new(@yaml_config)
|
65
|
+
runner.servers[3000].server.connectors[0].acceptors.should == 20
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe JettyRails::Handler::DelegateOnErrorsHandler do
|
4
|
+
it "should decorate the original HttpServletResponse" do
|
5
|
+
original = mock("original handler", :null_object => true)
|
6
|
+
original.should_receive(:handle).once do |target, request, response, dispatch|
|
7
|
+
response.should be_kind_of(JettyRails::Handler::DelegateOnErrorsResponse)
|
8
|
+
end
|
9
|
+
delegator = JettyRails::Handler::DelegateOnErrorsHandler.new
|
10
|
+
delegator.handler = original
|
11
|
+
delegator.handle('/any/target', mock("request"), mock("response"), 0)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe JettyRails::Handler::DelegateOnErrorsResponse do
|
16
|
+
it "should delegate all method calls to wrapped response" do
|
17
|
+
response = mock('original response')
|
18
|
+
response.should_receive(:getContentType).once.and_return('text/html; charset=UTF-8')
|
19
|
+
wrapper = JettyRails::Handler::DelegateOnErrorsResponse.new response, mock('request')
|
20
|
+
wrapper.getContentType.should == 'text/html; charset=UTF-8'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should set request to not handled state on error" do
|
24
|
+
request = mock('request')
|
25
|
+
request.should_receive(:handled=).once.with(false)
|
26
|
+
wrapper = JettyRails::Handler::DelegateOnErrorsResponse.new mock('response'), request
|
27
|
+
wrapper.sendError(403)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe JettyRails::Runner, "with no extra configuration (rails adapter)" do
|
4
|
+
it "should require basedir to be run" do
|
5
|
+
lambda { JettyRails::Runner.new }.should raise_error
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should receive basedir configuration" do
|
9
|
+
runner = JettyRails::Runner.new :base => '/any/app/dir'
|
10
|
+
runner.servers[8080].config.should have_key(:base)
|
11
|
+
runner.servers[8080].config[:base].should == '/any/app/dir'
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should default to development environment" do
|
15
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
16
|
+
runner.servers[8080].config.should have_key(:environment)
|
17
|
+
runner.servers[8080].config[:environment].should == 'development'
|
18
|
+
runner.servers[8080].app_contexts.first.init_params['rails.env'].should == 'development'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should default to the root context path" do
|
22
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
23
|
+
runner.servers[8080].config.should have_key(:context_path)
|
24
|
+
runner.servers[8080].config[:context_path].should == '/'
|
25
|
+
runner.servers[8080].app_contexts.first.context_path.should == '/'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should set server default port to 8080" do
|
29
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
30
|
+
runner.servers[8080].config.should have_key(:port)
|
31
|
+
runner.servers[8080].config[:port].should == 8080
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should default lib_dir to lib" do
|
35
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
36
|
+
runner.servers[8080].config.should have_key(:lib_dir)
|
37
|
+
runner.servers[8080].config[:lib_dir].should == 'lib'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should set rails root" do
|
41
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
42
|
+
runner.servers[8080].app_contexts.first.init_params['rails.root'].should == '/'
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should set public root" do
|
46
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
47
|
+
runner.servers[8080].app_contexts.first.init_params['public.root'].should == '/public'
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should set gem path" do
|
51
|
+
original = ENV['GEM_PATH']
|
52
|
+
ENV['GEM_PATH'] = nil
|
53
|
+
begin
|
54
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
55
|
+
runner.servers[8080].app_contexts.first.init_params['gem.path'].should == 'tmp/war/WEB-INF/gems'
|
56
|
+
ensure
|
57
|
+
ENV['GEM_PATH'] = original
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should set gem path from environment" do
|
62
|
+
original = ENV['GEM_PATH']
|
63
|
+
ENV['GEM_PATH'] = "/usr/lib/ruby/gems/1.8/gems"
|
64
|
+
begin
|
65
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
66
|
+
runner.servers[8080].app_contexts.first.init_params['gem.path'].should == ENV['GEM_PATH']
|
67
|
+
ensure
|
68
|
+
ENV['GEM_PATH'] = original
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
it "should install RailsServletContextListener" do
|
74
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
75
|
+
listeners = runner.servers[8080].app_contexts.first.event_listeners
|
76
|
+
listeners.size.should == 1
|
77
|
+
listeners[0].should be_kind_of(JettyRails::Rack::RailsServletContextListener)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should have handlers for static and dynamic content" do
|
81
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
82
|
+
runner.servers[8080].server.handlers.size.should == 2
|
83
|
+
resource_handlers = runner.servers[8080].server.getChildHandlersByClass(JettyRails::Jetty::Handler::ResourceHandler)
|
84
|
+
resource_handlers.size.should == 1
|
85
|
+
webapp_handlers = runner.servers[8080].server.getChildHandlersByClass(JettyRails::Jetty::Handler::WebAppContext)
|
86
|
+
webapp_handlers.size.should == 1
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should delegate to rails handler if requested dir has no welcome file" do
|
90
|
+
runner = JettyRails::Runner.new :base => Dir.pwd
|
91
|
+
delegate_handler = runner.servers[8080].server.handlers[0]
|
92
|
+
delegate_handler.should be_kind_of(JettyRails::Handler::DelegateOnErrorsHandler)
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
96
|
+
|
97
|
+
describe JettyRails::Runner, "with custom configuration" do
|
98
|
+
|
99
|
+
it "should allow to override the environment" do
|
100
|
+
runner = JettyRails::Runner.new :base => Dir.pwd, :environment => 'production'
|
101
|
+
runner.servers[8080].config.should have_key(:environment)
|
102
|
+
runner.servers[8080].config[:environment].should == 'production'
|
103
|
+
runner.servers[8080].app_contexts.first.init_params['rails.env'].should == 'production'
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should allow to override the context path" do
|
107
|
+
runner = JettyRails::Runner.new :base => Dir.pwd, :context_path => "/myapp"
|
108
|
+
runner.servers[8080].config.should have_key(:context_path)
|
109
|
+
runner.servers[8080].config[:context_path].should == '/myapp'
|
110
|
+
runner.servers[8080].app_contexts.first.context_path.should == '/myapp'
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should allow to override the server port" do
|
114
|
+
runner = JettyRails::Runner.new :base => Dir.pwd, :port => 8585
|
115
|
+
runner.servers[8585].config.should have_key(:port)
|
116
|
+
runner.servers[8585].config[:port].should == 8585
|
117
|
+
runner.servers[8585].server.connectors[0].port.should == 8585
|
118
|
+
end
|
119
|
+
|
120
|
+
it "should handle custom context paths for static and dynamic content" do
|
121
|
+
runner = JettyRails::Runner.new :base => Dir.pwd, :context_path => "/myapp"
|
122
|
+
context_handlers = runner.servers[8080].server.getChildHandlersByClass(JettyRails::Jetty::Handler::ContextHandler)
|
123
|
+
context_handlers.size.should == 2 # one for static, one for dynamic
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
describe JettyRails::Runner, "with merb adapter" do
|
128
|
+
|
129
|
+
it "should set merb root" do
|
130
|
+
runner = JettyRails::Runner.new :adapter => :merb, :base => Dir.pwd
|
131
|
+
runner.servers[8080].app_contexts.first.init_params['merb.root'].should == '/'
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should set public root" do
|
135
|
+
runner = JettyRails::Runner.new :adapter => :merb, :base => Dir.pwd
|
136
|
+
runner.servers[8080].app_contexts.first.init_params['public.root'].should == '/public'
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should set gem path" do
|
140
|
+
original = ENV['GEM_PATH']
|
141
|
+
ENV['GEM_PATH'] = nil
|
142
|
+
begin
|
143
|
+
runner = JettyRails::Runner.new :adapter => :merb, :base => Dir.pwd
|
144
|
+
runner.servers[8080].app_contexts.first.init_params['gem.path'].should == 'tmp/war/WEB-INF/gems'
|
145
|
+
ensure
|
146
|
+
ENV['GEM_PATH'] = original
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should set merb environment to development" do
|
151
|
+
runner = JettyRails::Runner.new :adapter => :merb, :base => Dir.pwd
|
152
|
+
runner.servers[8080].app_contexts.first.init_params['merb.environment'].should == 'development'
|
153
|
+
end
|
154
|
+
|
155
|
+
it "should install MerbServletContextListener and SignalHandler" do
|
156
|
+
runner = JettyRails::Runner.new :adapter => :merb, :base => Dir.pwd
|
157
|
+
listeners = runner.servers[8080].app_contexts.first.event_listeners
|
158
|
+
listeners.size.should == 2
|
159
|
+
listeners[0].should be_kind_of(JettyRails::Rack::MerbServletContextListener)
|
160
|
+
listeners[1].should be_kind_of(JettyRails::Adapters::MerbAdapter::SignalHandler)
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
:servers:
|
3
|
+
- :context_path: /testB
|
4
|
+
:adapter: :rails
|
5
|
+
:base: jetty_rails_proj
|
6
|
+
:environment: development
|
7
|
+
:port: 3000
|
8
|
+
:environment: production
|
9
|
+
:jruby_min_runtimes: 1
|
10
|
+
:jruby_max_runtimes: 2
|
11
|
+
:thread_pool_max: 40
|
12
|
+
:thread_pool_min: 1
|
13
|
+
:acceptor_size: 20
|
@@ -0,0 +1,28 @@
|
|
1
|
+
---
|
2
|
+
:servers:
|
3
|
+
- :context_path: /testA
|
4
|
+
:base: jetty_rails_proj_2
|
5
|
+
:adapter: :rails
|
6
|
+
:environment: development
|
7
|
+
:port: 2000
|
8
|
+
- :context_path: /testB
|
9
|
+
:adapter: :rails
|
10
|
+
:base: jetty_rails_proj
|
11
|
+
:environment: production
|
12
|
+
:port: 3000
|
13
|
+
- :port: 4000
|
14
|
+
:apps:
|
15
|
+
- :context_path: /testB
|
16
|
+
:adapter: :rails
|
17
|
+
:base: jetty_rails_proj
|
18
|
+
:environment: development
|
19
|
+
- :context_path: /testA
|
20
|
+
:adapter: :rails
|
21
|
+
:base: jetty_rails_proj_2
|
22
|
+
:environment: production
|
23
|
+
:environment: production
|
24
|
+
:jruby_min_runtimes: 1
|
25
|
+
:jruby_max_runtimes: 2
|
26
|
+
:thread_pool_max: 40
|
27
|
+
:thread_pool_min: 1
|
28
|
+
:acceptor_size: 20
|
@@ -0,0 +1,195 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "binary executable with no command line arguments" do
|
4
|
+
|
5
|
+
it "should set adapter to rails" do
|
6
|
+
runner = mock("runner", :null_object => true)
|
7
|
+
current_dir = Dir.pwd
|
8
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
9
|
+
config.should have_key(:adapter)
|
10
|
+
config[:adapter].should == :rails
|
11
|
+
runner
|
12
|
+
end
|
13
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should provide the current execution dir as basedir" do
|
17
|
+
runner = mock("runner", :null_object => true)
|
18
|
+
current_dir = Dir.pwd
|
19
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
20
|
+
config.should have_key(:base)
|
21
|
+
config[:base].should == current_dir
|
22
|
+
runner
|
23
|
+
end
|
24
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should not set the context path by default" do
|
28
|
+
runner = mock("runner", :null_object => true)
|
29
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
30
|
+
config.should_not have_key(:context_path)
|
31
|
+
runner
|
32
|
+
end
|
33
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should not set the environment by default" do
|
37
|
+
runner = mock("runner", :null_object => true)
|
38
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
39
|
+
config.should_not have_key(:environment)
|
40
|
+
runner
|
41
|
+
end
|
42
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should set the port to 3000 by default" do
|
46
|
+
runner = mock("runner", :null_object => true)
|
47
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
48
|
+
config.should have_key(:port)
|
49
|
+
config[:port].should == 3000
|
50
|
+
runner
|
51
|
+
end
|
52
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should not set classes dir by default" do
|
56
|
+
runner = mock("runner", :null_object => true)
|
57
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
58
|
+
config.should_not have_key(:classes_dir)
|
59
|
+
runner
|
60
|
+
end
|
61
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should not set lib dir by default" do
|
65
|
+
runner = mock("runner", :null_object => true)
|
66
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
67
|
+
config.should_not have_key(:lib_dir)
|
68
|
+
runner
|
69
|
+
end
|
70
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "binary executable with command line arguments" do
|
75
|
+
|
76
|
+
it "should take the first command line argument as basedir" do
|
77
|
+
ARGV[0] = '/any/app/dir'
|
78
|
+
runner = mock("runner", :null_object => true)
|
79
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
80
|
+
config.should have_key(:base)
|
81
|
+
config[:base].should == '/any/app/dir'
|
82
|
+
runner
|
83
|
+
end
|
84
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should take --context-path command line option as context path" do
|
88
|
+
ARGV[0] = '--context-path'
|
89
|
+
ARGV[1] = '/myapp'
|
90
|
+
runner = mock("runner", :null_object => true)
|
91
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
92
|
+
config.should have_key(:context_path)
|
93
|
+
config[:context_path].should == '/myapp'
|
94
|
+
runner
|
95
|
+
end
|
96
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should take -u command line option as context path" do
|
100
|
+
ARGV[0] = '-u'
|
101
|
+
ARGV[1] = '/myapp'
|
102
|
+
runner = mock("runner", :null_object => true)
|
103
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
104
|
+
config.should have_key(:context_path)
|
105
|
+
config[:context_path].should == '/myapp'
|
106
|
+
runner
|
107
|
+
end
|
108
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
109
|
+
end
|
110
|
+
|
111
|
+
it "should take --environment command line option as custom environment" do
|
112
|
+
ARGV[0] = '--environment'
|
113
|
+
ARGV[1] = 'production'
|
114
|
+
runner = mock("runner", :null_object => true)
|
115
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
116
|
+
config.should have_key(:environment)
|
117
|
+
config[:environment].should == 'production'
|
118
|
+
runner
|
119
|
+
end
|
120
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should take -e command line option as custom environment" do
|
124
|
+
ARGV[0] = '-e'
|
125
|
+
ARGV[1] = 'production'
|
126
|
+
runner = mock("runner", :null_object => true)
|
127
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
128
|
+
config.should have_key(:environment)
|
129
|
+
config[:environment].should == 'production'
|
130
|
+
runner
|
131
|
+
end
|
132
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should take --port command line option as custom server port" do
|
136
|
+
ARGV[0] = '--port'
|
137
|
+
ARGV[1] = '80'
|
138
|
+
runner = mock("runner", :null_object => true)
|
139
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
140
|
+
config.should have_key(:port)
|
141
|
+
config[:port].should == 80
|
142
|
+
runner
|
143
|
+
end
|
144
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
145
|
+
end
|
146
|
+
|
147
|
+
it "should take -p command line option as custom server port" do
|
148
|
+
ARGV[0] = '-p'
|
149
|
+
ARGV[1] = '80'
|
150
|
+
runner = mock("runner", :null_object => true)
|
151
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
152
|
+
config.should have_key(:port)
|
153
|
+
config[:port].should == 80
|
154
|
+
runner
|
155
|
+
end
|
156
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
157
|
+
end
|
158
|
+
|
159
|
+
it "should take --classes command line option as custom classes dir" do
|
160
|
+
ARGV[0] = '--classes'
|
161
|
+
ARGV[1] = 'build/java/classes'
|
162
|
+
runner = mock("runner", :null_object => true)
|
163
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
164
|
+
config.should have_key(:classes_dir)
|
165
|
+
config[:classes_dir].should == 'build/java/classes'
|
166
|
+
runner
|
167
|
+
end
|
168
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should take --lib command line option as custom jars dir" do
|
172
|
+
ARGV[0] = '--lib'
|
173
|
+
ARGV[1] = 'java/jars'
|
174
|
+
runner = mock("runner", :null_object => true)
|
175
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
176
|
+
config.should have_key(:lib_dir)
|
177
|
+
config[:lib_dir].should == 'java/jars'
|
178
|
+
runner
|
179
|
+
end
|
180
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should take --jars command line option as custom jars dir" do
|
184
|
+
ARGV[0] = '--jars'
|
185
|
+
ARGV[1] = 'java/jars'
|
186
|
+
runner = mock("runner", :null_object => true)
|
187
|
+
JettyRails::Runner.should_receive(:new) do |config|
|
188
|
+
config.should have_key(:lib_dir)
|
189
|
+
config[:lib_dir].should == 'java/jars'
|
190
|
+
runner
|
191
|
+
end
|
192
|
+
load File.dirname(__FILE__) + '/../bin/jetty_rails'
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|