calavera-tomcat-rails 0.1.0 → 0.1.1
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/VERSION +1 -1
- data/lib/tomcat-rails/command_line_parser.rb +47 -0
- data/lib/tomcat-rails/server.rb +3 -4
- metadata +2 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module TomcatRails
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
class CommandLineParser
|
5
|
+
def self.parse
|
6
|
+
default_options = {
|
7
|
+
:port => '3000',
|
8
|
+
:environment => 'development',
|
9
|
+
:context_path => '/',
|
10
|
+
}
|
11
|
+
|
12
|
+
parser = OptionParser.new do |opts|
|
13
|
+
opts.banner = 'Tomcat server default options:'
|
14
|
+
opts.separator ''
|
15
|
+
|
16
|
+
opts.on('-e', '--env ENVIRONMENT', 'Rails environment',
|
17
|
+
"default: #{default_options[:environment]}") do |v|
|
18
|
+
default_options[:environment] = v
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on('-p', '--port PORT', 'Port to bind to',
|
22
|
+
"default: #{default_options[:port]}") do |v|
|
23
|
+
default_options[:port] = v
|
24
|
+
end
|
25
|
+
|
26
|
+
opts.on('-c', '--context CONTEXT_PATH', 'The application context path',
|
27
|
+
"default: #{default_options[:context_path]}") do |v|
|
28
|
+
default_options[:context_path] = v
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-v', '--version', 'display the current version') do
|
32
|
+
puts File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
|
33
|
+
exit
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on('-h', '--help', 'display the help') do
|
37
|
+
puts opts
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.parse!(ARGV)
|
42
|
+
end
|
43
|
+
|
44
|
+
default_options
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/tomcat-rails/server.rb
CHANGED
@@ -63,13 +63,12 @@ module TomcatRails
|
|
63
63
|
web_app.addParameter('jruby.initial.runtimes', @config[:jruby_min_runtimes].to_s)
|
64
64
|
web_app.addParameter('rails.env', @config[:environment].to_s)
|
65
65
|
web_app.addParameter('rails.root', '/')
|
66
|
+
web_app.addParameter('public.root', '/public')
|
67
|
+
|
66
68
|
end
|
67
69
|
|
68
70
|
def add_web_dir_resources(web_app)
|
69
|
-
|
70
|
-
dir_context.setDocBase(File.join(Dir.pwd, "public"))
|
71
|
-
|
72
|
-
web_app.setResources(dir_context)
|
71
|
+
web_app.setDocBase(File.join(Dir.pwd, "public/"))
|
73
72
|
end
|
74
73
|
end
|
75
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calavera-tomcat-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Calavera
|
@@ -33,6 +33,7 @@ files:
|
|
33
33
|
- VERSION
|
34
34
|
- bin/tomcat_rails
|
35
35
|
- lib/tomcat-rails.rb
|
36
|
+
- lib/tomcat-rails/command_line_parser.rb
|
36
37
|
- lib/tomcat-rails/jars.rb
|
37
38
|
- lib/tomcat-rails/server.rb
|
38
39
|
- test/test_helper.rb
|