nolman-jetty-rails 0.9.6-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/History.txt +49 -0
  2. data/Licenses.txt +37 -0
  3. data/Manifest.txt +51 -0
  4. data/PostInstall.txt +2 -0
  5. data/README.rdoc +130 -0
  6. data/Rakefile +27 -0
  7. data/TODO.txt +11 -0
  8. data/bin/jetty_merb +41 -0
  9. data/bin/jetty_rails +41 -0
  10. data/jetty-libs/core-3.1.1.jar +0 -0
  11. data/jetty-libs/jetty-6.1.14.jar +0 -0
  12. data/jetty-libs/jetty-plus-6.1.14.jar +0 -0
  13. data/jetty-libs/jetty-util-6.1.14.jar +0 -0
  14. data/jetty-libs/jsp-2.1.jar +0 -0
  15. data/jetty-libs/jsp-api-2.1.jar +0 -0
  16. data/jetty-libs/servlet-api-2.5-6.1.14.jar +0 -0
  17. data/lib/jetty_rails.rb +26 -0
  18. data/lib/jetty_rails/adapters/abstract_adapter.rb +25 -0
  19. data/lib/jetty_rails/adapters/merb_adapter.rb +34 -0
  20. data/lib/jetty_rails/adapters/rails_adapter.rb +22 -0
  21. data/lib/jetty_rails/adapters/rails_jms_adapter.rb +104 -0
  22. data/lib/jetty_rails/config/command_line_reader.rb +75 -0
  23. data/lib/jetty_rails/config/rdoc_fix.rb +28 -0
  24. data/lib/jetty_rails/handler/delegate_on_errors_handler.rb +29 -0
  25. data/lib/jetty_rails/handler/public_directory_handler.rb +24 -0
  26. data/lib/jetty_rails/handler/web_app_handler.rb +85 -0
  27. data/lib/jetty_rails/jars.rb +36 -0
  28. data/lib/jetty_rails/runner.rb +46 -0
  29. data/lib/jetty_rails/server.rb +79 -0
  30. data/lib/jetty_rails/warbler_reader.rb +13 -0
  31. data/lib/jruby-rack-0.9.7-SNAPSHOT.jar +0 -0
  32. data/script/console +10 -0
  33. data/script/destroy +14 -0
  34. data/script/generate +14 -0
  35. data/script/txt2html +71 -0
  36. data/spec/config.yml +28 -0
  37. data/spec/jetty_merb_spec.rb +195 -0
  38. data/spec/jetty_rails/config_file_spec.rb +68 -0
  39. data/spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb +29 -0
  40. data/spec/jetty_rails/runner_spec.rb +162 -0
  41. data/spec/jetty_rails_sample_1.yml +13 -0
  42. data/spec/jetty_rails_sample_2.yml +28 -0
  43. data/spec/jetty_rails_spec.rb +195 -0
  44. data/spec/spec.opts +2 -0
  45. data/spec/spec_helper.rb +12 -0
  46. data/tasks/jruby.rake +7 -0
  47. data/tasks/rspec.rake +49 -0
  48. data/website/index.txt +194 -0
  49. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  50. data/website/stylesheets/screen.css +159 -0
  51. data/website/template.html.erb +56 -0
  52. metadata +174 -0
@@ -0,0 +1,49 @@
1
+ == 0.8.1
2
+ * updating jruby-rack to be compatible with Rails 2.3.x
3
+ * better build system, upgrading to newer version of newgem
4
+
5
+ == 0.8
6
+ * reading config/web.xml file (not yet supporting config/web.xml.erb)
7
+ * supporting /public/WEB-INF dir for custom web resources (config files and taglibs)
8
+
9
+ == 0.7
10
+ * Merb 1.0 support!
11
+ * jruby-rack updated to the latest release (0.9.3)
12
+ * jetty server update to 6.1.14
13
+ * adding known issue with jruby-1.1.4 to the docs
14
+ * JSP and JSP Expression Language support
15
+ * some minor bugs
16
+
17
+ == 0.6
18
+ * load all java classes inside classes/ by default
19
+ * command line args to customize lib/ and classes/ directories
20
+ * -v showing jetty_rails version
21
+ * each web application context has its own classloader (isolated classpaths)
22
+ * upgraded to jruby-rack-0.9.2 (no more views being cached in development time)
23
+ * minor changes and refactorings
24
+ * improved docs for multi-server support
25
+
26
+ == 0.5
27
+ * load all jars inside lib/ by default
28
+ * using GEM_PATH environment variable, if exists
29
+ * fix signal handling (ctrl + c) for jetty_merb
30
+
31
+ == 0.4
32
+ * Merb support! jruby -S jetty_merb
33
+ * Changed default ports to 3000 (rails) and 4000 (merb)
34
+ * More specs
35
+
36
+ == 0.3
37
+
38
+ * Improved Documentation: rdoc and site.
39
+
40
+ == 0.2
41
+
42
+ * Running any rails applications with no extra classpath.
43
+ * Command line options for jett_rails binary executable.
44
+ See: <tt>jruby -S jetty_rails --help</tt> for details.
45
+
46
+ == 0.1
47
+
48
+ * Initial release.
49
+ * Running default rails applications inside Jetty.
@@ -0,0 +1,37 @@
1
+ = Jetty Rails
2
+
3
+ Jetty Rails is distributed under the terms of the MIT License.
4
+
5
+ Copyright (c) 2008 Fabio Kung
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ "Software"), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ = Additional Bundled Software
27
+
28
+ JRuby-Rack (jruby-rack-*.jar) is distributed under the terms of the
29
+ MIT license. See http://svn.codehaus.org/jruby-contrib/trunk/rack/LICENSE.txt
30
+ for details.
31
+
32
+ Jetty (jetty-*.jar) is distributed under the terms of the Apache 2.0 License.
33
+ See http://jetty.mortbay.org/jetty-6/LICENSE.txt for details.
34
+
35
+ Servlet API 2.5, a.k.a JSR-154, (servlet-api-2.5-*.jar) is distributed
36
+ under the terms of the Berkeley License. See http://developers.sun.com/license/berkeley_license.html
37
+ for details.
@@ -0,0 +1,51 @@
1
+ History.txt
2
+ Licenses.txt
3
+ Manifest.txt
4
+ PostInstall.txt
5
+ README.rdoc
6
+ Rakefile
7
+ TODO.txt
8
+ bin/jetty_merb
9
+ bin/jetty_rails
10
+ jetty-libs/core-3.1.1.jar
11
+ jetty-libs/jetty-6.1.14.jar
12
+ jetty-libs/jetty-plus-6.1.14.jar
13
+ jetty-libs/jetty-util-6.1.14.jar
14
+ jetty-libs/jsp-2.1.jar
15
+ jetty-libs/jsp-api-2.1.jar
16
+ jetty-libs/servlet-api-2.5-6.1.14.jar
17
+ lib/jetty_rails.rb
18
+ lib/jetty_rails/adapters/abstract_adapter.rb
19
+ lib/jetty_rails/adapters/merb_adapter.rb
20
+ lib/jetty_rails/adapters/rails_adapter.rb
21
+ lib/jetty_rails/adapters/rails_jms_adapter.rb
22
+ lib/jetty_rails/config/command_line_reader.rb
23
+ lib/jetty_rails/config/rdoc_fix.rb
24
+ lib/jetty_rails/handler/delegate_on_errors_handler.rb
25
+ lib/jetty_rails/handler/public_directory_handler.rb
26
+ lib/jetty_rails/handler/web_app_handler.rb
27
+ lib/jetty_rails/jars.rb
28
+ lib/jetty_rails/runner.rb
29
+ lib/jetty_rails/server.rb
30
+ lib/jetty_rails/warbler_reader.rb
31
+ lib/jruby-rack-0.9.5-SNAPSHOT.jar
32
+ script/console
33
+ script/destroy
34
+ script/generate
35
+ script/txt2html
36
+ spec/config.yml
37
+ spec/jetty_merb_spec.rb
38
+ spec/jetty_rails/config_file_spec.rb
39
+ spec/jetty_rails/handler/delegate_on_errors_handler_spec.rb
40
+ spec/jetty_rails/runner_spec.rb
41
+ spec/jetty_rails_sample_1.yml
42
+ spec/jetty_rails_sample_2.yml
43
+ spec/jetty_rails_spec.rb
44
+ spec/spec.opts
45
+ spec/spec_helper.rb
46
+ tasks/jruby.rake
47
+ tasks/rspec.rake
48
+ website/index.txt
49
+ website/javascripts/rounded_corners_lite.inc.js
50
+ website/stylesheets/screen.css
51
+ website/template.html.erb
@@ -0,0 +1,2 @@
1
+
2
+ For more information on jetty-rails, see http://jetty-rails.rubyforge.org
@@ -0,0 +1,130 @@
1
+ = jetty-rails
2
+
3
+ http://jetty-rails.rubyforge.net
4
+
5
+ == DESCRIPTION:
6
+
7
+ Jetty Rails aims to run Ruby on Rails and Merb applications with the Jetty Container, leveraging the power of JRuby and jruby-rack.
8
+
9
+ {Jetty}[http://jetty.mortbay.com/jetty/] is an excellent Java Web Server, being and at the same time extremely lightweight. This makes jetty-rails a good alternative for JRuby on Rails or Merb development and deployment.
10
+
11
+ The project has born from my own needs ({read more}[http://fabiokung.com/2008/05/14/jetty-rails-gem-simple-jruby-on-rails-development-with-servlet-containers/]). I needed to run {JForum}[http://jforum.net] in the same context of my JRuby on Rails application. I had also to integrate HttpSessions (avoiding single sign on) and use ServletContext in-memory cache store.
12
+
13
+ == FEATURES:
14
+
15
+ * Uses {JRuby Rack}[http://wiki.jruby.org/wiki/JRuby_Rack].
16
+ * Loads all jars inside your application lib/ dir, by default.
17
+ * Loads all classes inside your application classes/ dir, by default.
18
+ * Supports rails and merb applications out of the box.
19
+
20
+ == KNOWN ISSUES
21
+
22
+ * Doesn't work with gems inside $HOME/.gem, because jruby-rack overwrites custom gem paths. Please install jruby in writable places, or install your gems with sudo <tt>jruby -S gem install NAME</tt>.
23
+
24
+ * Doesn't work with JRuby 1.1.4: http://jira.codehaus.org/browse/JRUBY-2959
25
+
26
+ * To generate coverage report with jruby (>= 1.1) follow instructions from http://www.ruby-forum.com/topic/146252 and run (inside jetty-rails root dir):
27
+ jruby -S rake rcov
28
+
29
+ * Hoe in jruby has an issue reading the ~/.hoerc file. Just remove it.
30
+
31
+ == USAGE:
32
+
33
+ === Rails:
34
+
35
+ cd myrailsapp
36
+ jruby -S jetty_rails
37
+
38
+ help option shows usage details:
39
+
40
+ jruby -S jetty_rails --help
41
+
42
+ === Merb:
43
+
44
+ cd mymerbapp
45
+ jruby -S jetty_merb
46
+
47
+ help option shows usage details:
48
+
49
+ jruby -S jetty_merb --help
50
+
51
+ == REQUIREMENTS:
52
+
53
+ jetty-rails requires jruby (>=1.1). Please make sure you already have
54
+ it properly installed and inserted in your PATH environment variable.
55
+
56
+ {Installing JRuby Instructions}[http://wiki.jruby.org/wiki/Getting_Started]
57
+
58
+ == INSTALL:
59
+
60
+ jruby -S gem install jetty-rails
61
+
62
+ == BUGS AND NEW FEATURES
63
+
64
+ Using Lighthouse: http://fabiokung.lighthouseapp.com/projects/12666-jetty-rails
65
+
66
+
67
+ == MULTIPLE SERVERS:
68
+
69
+ You can specify a configuration yaml file rather than command line switches.
70
+ The file also allows specifying multiple servers and / or application contexts for single jetty container.
71
+
72
+ For example, you could set a context_path of /testA on port 8888 which is rails, /testB also that port which is merb.
73
+ Or, you could have /testA on port 8888 and /testB on port 9999.
74
+
75
+ jruby -S jetty_rails -c path/to/config.yml
76
+
77
+ The configuration options are inherited, so if you specify the environment to be "production" at the top level,
78
+ then any servers and application context will be "production" unless the choose to override the value.
79
+
80
+ - server settings:
81
+ <tt>:port</tt>, <tt>:jruby_min_runtimes</tt>, <tt>:jruby_max_runtimes</tt>, <tt>:thread_pool_max</tt>, <tt>:thread_pool_min</tt>, <tt>:acceptor_size</tt>
82
+
83
+ - application context settings:
84
+ <tt>:context_path</tt>, <tt>:base</tt>, <tt>:adapter</tt>, <tt>:environment</tt>, <tt>:lib_dir</tt>, <tt>:gem_path</tt>
85
+
86
+ As part of the configuration you have some control over jruby & jetty.
87
+
88
+ See spec/config.yml, spec/jetty_rails_sample_1.yml, and spec/jetty_rails_sample_2.yml for more examples.
89
+
90
+ === Rails:
91
+
92
+ If -c is not specified, by default jetty_rails will look for a config/jetty_rails.yml relative to where it is started.
93
+
94
+ Don't forget to add this into your config/environment.rb
95
+ ActionController::AbstractRequest.relative_url_root = "/testA"
96
+
97
+
98
+ === JRuby Configuration
99
+
100
+ You can tweak the JRuby runtimes per application context:
101
+
102
+ jruby_min_runtimes: 1
103
+ jruby_max_runtimes: 2
104
+
105
+
106
+ === Jetty Configuration
107
+
108
+ You can also modify the jetty per server configurations:
109
+
110
+ Thread pool will define the thread pool available to the jetty server using a QueuedThreadPool.
111
+
112
+ thread_pool_max: 40
113
+ thread_pool_min: 1
114
+
115
+
116
+ The acceptor size is the number of acceptor threads available for that server's channel connector.
117
+
118
+ acceptor_size: 20
119
+
120
+ See the jetty documentation for more information.
121
+
122
+
123
+ == LICENSE:
124
+
125
+ Jetty Rails is distributed under the terms of The MIT License.
126
+ Copyright (c) 2008 Fabio Kung <fabio.kung@gmail.com>
127
+
128
+ Read more details in the bundled +Licenses.txt+ file. There are other
129
+ pieces of software bundled with jetty-rails. Before using jetty-rails,
130
+ make sure you agree with all of them.
@@ -0,0 +1,27 @@
1
+ require 'rubygems' unless ENV['NO_RUBYGEMS']
2
+ %w[rake rake/clean fileutils newgem rubigen hoe].each { |f| require f }
3
+ require File.dirname(__FILE__) + '/lib/jetty_rails'
4
+
5
+ # Generate all the Rake tasks
6
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
7
+ $hoe = Hoe.new('jetty-rails', JettyRails::VERSION) do |p|
8
+ p.developer('Fabio Kung', 'fabio.kung@gmail.com')
9
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
10
+ p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
11
+ p.rubyforge_name = p.name # TODO this is default value
12
+ p.extra_deps = [
13
+ ['activesupport','>= 2.0.2'],
14
+ ]
15
+ p.extra_dev_deps = [
16
+ ['newgem', ">= #{::Newgem::VERSION}"]
17
+ ]
18
+
19
+ #p.spec_extras['platform'] = 'java' # JRuby gem created, e.g. jetty-rails-X.Y.Z-jruby.gem
20
+
21
+ p.clean_globs |= %w[**/.DS_Store tmp *.log **/.*.sw? *.gem .config]
22
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
23
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
24
+ p.rsync_args = '-av --delete --ignore-errors'
25
+ end
26
+
27
+ # task :default => :spec
@@ -0,0 +1,11 @@
1
+ == TODO never ends...
2
+
3
+ * Improve RDocs
4
+ * integration test for lib_dir jars loading
5
+ * read configuration from warble.rb
6
+ * install custom resources from warbler configuration
7
+ * add custom classes from warble.rb to the context classpath
8
+ * add custom jars from warble.rb to the context classpath
9
+ * support config/web.xml.erb
10
+ * read any custom jetty.xml
11
+ * support jetty-plus features (i.e.: jndi)
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ # == Synopsis
4
+ #
5
+ # jetty_merb: jetty server for merb applications
6
+ #
7
+ # == Usage
8
+ #
9
+ # jetty_merb [OPTION] ... BASEDIR
10
+ #
11
+ # -h, --help::
12
+ # show help
13
+ #
14
+ # --context-path PATH, -u PATH::
15
+ # change the application context path (default: '/')
16
+ #
17
+ # --port PORT, -p PORT::
18
+ # change server port (default: 4000)
19
+ #
20
+ # --environment ENV, -e ENV::
21
+ # change rails environment (default: development)
22
+ #
23
+ # --classes CLASSES_DIR::
24
+ # directory containing java classes used by the application (default: 'classes/')
25
+ #
26
+ # --lib LIB_DIR, --jars LIB_DIR::
27
+ # directory containing jars used by the application (default: 'lib/')
28
+ #
29
+ # --config FILE, -c FILE:: (optional)
30
+ # config file to use instead of command line switches (allows for multiple servers)
31
+ #
32
+ # BASEDIR (optional): directory to be run (default: current).
33
+
34
+ require "java"
35
+ $LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
36
+ $LOAD_PATH << "#{File.dirname(__FILE__)}/../jetty-libs"
37
+ require "jetty_rails"
38
+
39
+ options = CommandLineReader.new.read(:merb)
40
+ runner = JettyRails::Runner.new(options)
41
+ runner.start
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env jruby
2
+
3
+ # == Synopsis
4
+ #
5
+ # jetty_rails: jetty server for rails applications
6
+ #
7
+ # == Usage
8
+ #
9
+ # jetty_rails [OPTION] ... BASEDIR
10
+ #
11
+ # -h, --help::
12
+ # show help
13
+ #
14
+ # --context-path PATH, -u PATH::
15
+ # change the application context path (default: '/')
16
+ #
17
+ # --port PORT, -p PORT::
18
+ # change server port (default: 3000)
19
+ #
20
+ # --environment ENV, -e ENV::
21
+ # change rails environment (default: development)
22
+ #
23
+ # --classes CLASSES_DIR::
24
+ # directory containing java classes used by the application (default: 'classes/')
25
+ #
26
+ # --lib LIB_DIR, --jars LIB_DIR::
27
+ # directory containing jars used by the application (default: 'lib/')
28
+ #
29
+ # --config FILE, -c FILE:: (optional)
30
+ # config file to use instead of command line switches (allows for multiple servers)
31
+ #
32
+ # BASEDIR (optional): directory to be run (default: current).
33
+
34
+ require "java"
35
+ $LOAD_PATH << "#{File.dirname(__FILE__)}/../lib"
36
+ $LOAD_PATH << "#{File.dirname(__FILE__)}/../jetty-libs"
37
+ require "jetty_rails"
38
+
39
+ options = CommandLineReader.new.read(:rails)
40
+ runner = JettyRails::Runner.new(options)
41
+ runner.start
Binary file
Binary file
@@ -0,0 +1,26 @@
1
+ jetty_libs_dir = "#{File.dirname(__FILE__)}/../jetty-libs"
2
+ $:.unshift(File.expand_path(jetty_libs_dir)) unless
3
+ $:.include?(jetty_libs_dir) || $:.include?(File.expand_path(jetty_libs_dir))
4
+
5
+ $:.unshift(File.dirname(__FILE__)) unless
6
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
7
+
8
+ require "java"
9
+ require "rubygems"
10
+ require "activesupport"
11
+ require "jetty_rails/jars"
12
+ require "jetty_rails/adapters/abstract_adapter"
13
+ require "jetty_rails/adapters/rails_adapter"
14
+ require "jetty_rails/adapters/rails_jms_adapter"
15
+ require "jetty_rails/adapters/merb_adapter"
16
+ require "jetty_rails/runner"
17
+ require "jetty_rails/server"
18
+ require "jetty_rails/handler/delegate_on_errors_handler"
19
+ require "jetty_rails/handler/public_directory_handler"
20
+ require "jetty_rails/handler/web_app_handler"
21
+ require "jetty_rails/config/command_line_reader"
22
+
23
+ module JettyRails
24
+ VERSION = '0.8.1'
25
+ JETTY_RAILS_HOME = File.dirname(__FILE__) + "/.." unless defined?(JETTY_RAILS_HOME)
26
+ end
@@ -0,0 +1,25 @@
1
+ module JettyRails
2
+ module Adapters
3
+ class AbstractAdapter
4
+ attr_reader :config
5
+
6
+ def initialize(config)
7
+ @config = config
8
+ end
9
+
10
+ def base_init_params()
11
+ @base_init_params ||= {
12
+ 'public.root' => '/public',
13
+ 'gem.path' => config[:gem_path] || ENV['GEM_PATH'] || 'tmp/war/WEB-INF/gems',
14
+ 'jruby.initial.runtimes' => "#{config[:jruby_min_runtimes]}",
15
+ 'jruby.min.runtimes' => "#{config[:jruby_min_runtimes]}",
16
+ 'jruby.max.runtimes' => "#{config[:jruby_max_runtimes]}"
17
+ }
18
+ end
19
+
20
+ def event_listeners
21
+ []
22
+ end
23
+ end
24
+ end
25
+ end