jubilee 1.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/.ruby-version +1 -0
  3. data/.travis.yml +5 -0
  4. data/CHANGELOG +32 -0
  5. data/Gemfile +35 -0
  6. data/Gemfile.lock +244 -0
  7. data/Guardfile +24 -0
  8. data/KNOWN_ISSUES +6 -0
  9. data/LICENSE.txt +20 -0
  10. data/README.md +147 -0
  11. data/ROADMAP +5 -0
  12. data/Rakefile +98 -0
  13. data/bin/jubilee +6 -0
  14. data/bin/jubilee_d +13 -0
  15. data/examples/chatapp/Gemfile +5 -0
  16. data/examples/chatapp/Gemfile.lock +27 -0
  17. data/examples/chatapp/README.md +17 -0
  18. data/examples/chatapp/app.rb +57 -0
  19. data/examples/chatapp/config.ru +3 -0
  20. data/examples/chatapp/public/assets/javascripts/application.js +67 -0
  21. data/examples/chatapp/public/assets/javascripts/jquery.js +5 -0
  22. data/examples/chatapp/public/assets/javascripts/sockjs-0.3.4.min.js +27 -0
  23. data/examples/chatapp/public/assets/javascripts/vertxbus.js +216 -0
  24. data/examples/chatapp/public/assets/stylesheets/application.css +29 -0
  25. data/examples/client/sockjs-0.3.4.min.js +27 -0
  26. data/examples/client/vertxbus.js +216 -0
  27. data/examples/jubilee.conf.rb +12 -0
  28. data/examples/jubilee/keystore.jks +0 -0
  29. data/examples/jubilee/server-keystore.jks +0 -0
  30. data/jars/hazelcast-2.6.3.jar +0 -0
  31. data/jars/jackson-annotations-2.2.2.jar +0 -0
  32. data/jars/jackson-core-2.2.2.jar +0 -0
  33. data/jars/jackson-databind-2.2.2.jar +0 -0
  34. data/jars/netty-all-4.0.13.Final.jar +0 -0
  35. data/jars/vertx-core-2.1M3-SNAPSHOT.jar +0 -0
  36. data/jars/vertx-hazelcast-2.1M3-SNAPSHOT.jar +0 -0
  37. data/java/src/jubilee/JubileeService.java +20 -0
  38. data/java/src/org/jruby/jubilee/Const.java +32 -0
  39. data/java/src/org/jruby/jubilee/RackApplication.java +103 -0
  40. data/java/src/org/jruby/jubilee/RackEnvironment.java +150 -0
  41. data/java/src/org/jruby/jubilee/RackEnvironmentHash.java +449 -0
  42. data/java/src/org/jruby/jubilee/RackInput.java +62 -0
  43. data/java/src/org/jruby/jubilee/RackResponse.java +11 -0
  44. data/java/src/org/jruby/jubilee/RubyHttpServerResponse.java +88 -0
  45. data/java/src/org/jruby/jubilee/RubyServer.java +171 -0
  46. data/java/src/org/jruby/jubilee/deploy/Starter.java +26 -0
  47. data/java/src/org/jruby/jubilee/impl/RubyIORackInput.java +201 -0
  48. data/java/src/org/jruby/jubilee/impl/RubyNullIO.java +107 -0
  49. data/java/src/org/jruby/jubilee/utils/RubyHelper.java +37 -0
  50. data/java/src/org/jruby/jubilee/vertx/JubileeVertx.java +38 -0
  51. data/jubilee.gemspec +201 -0
  52. data/lib/jubilee.rb +17 -0
  53. data/lib/jubilee/application.rb +13 -0
  54. data/lib/jubilee/cli.rb +127 -0
  55. data/lib/jubilee/configuration.rb +177 -0
  56. data/lib/jubilee/const.rb +40 -0
  57. data/lib/jubilee/jubilee.jar +0 -0
  58. data/lib/jubilee/response.rb +69 -0
  59. data/lib/jubilee/server.rb +12 -0
  60. data/lib/jubilee/version.rb +10 -0
  61. data/lib/rack/chunked.rb +38 -0
  62. data/lib/rack/handler/jubilee.rb +44 -0
  63. data/lib/vertx.rb +26 -0
  64. data/lib/vertx/README.md +7 -0
  65. data/lib/vertx/buffer.rb +251 -0
  66. data/lib/vertx/event_bus.rb +206 -0
  67. data/lib/vertx/shared_data.rb +214 -0
  68. data/spec/apps/rack/basic/config.ru +50 -0
  69. data/spec/apps/rails4/basic/.gitignore +16 -0
  70. data/spec/apps/rails4/basic/Gemfile +41 -0
  71. data/spec/apps/rails4/basic/Gemfile.lock +127 -0
  72. data/spec/apps/rails4/basic/README.rdoc +28 -0
  73. data/spec/apps/rails4/basic/Rakefile +6 -0
  74. data/spec/apps/rails4/basic/app/assets/images/.keep +0 -0
  75. data/spec/apps/rails4/basic/app/assets/images/rails.png +0 -0
  76. data/spec/apps/rails4/basic/app/assets/javascripts/application.js +12 -0
  77. data/spec/apps/rails4/basic/app/assets/stylesheets/application.css +13 -0
  78. data/spec/apps/rails4/basic/app/controllers/application_controller.rb +5 -0
  79. data/spec/apps/rails4/basic/app/controllers/concerns/.keep +0 -0
  80. data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb +11 -0
  81. data/spec/apps/rails4/basic/app/controllers/reloader_controller.rb.erb +11 -0
  82. data/spec/apps/rails4/basic/app/controllers/root_controller.rb +14 -0
  83. data/spec/apps/rails4/basic/app/helpers/application_helper.rb +2 -0
  84. data/spec/apps/rails4/basic/app/mailers/.keep +0 -0
  85. data/spec/apps/rails4/basic/app/models/.keep +0 -0
  86. data/spec/apps/rails4/basic/app/models/concerns/.keep +0 -0
  87. data/spec/apps/rails4/basic/app/views/layouts/application.html.erb +14 -0
  88. data/spec/apps/rails4/basic/app/views/reloader/index.html.erb +1 -0
  89. data/spec/apps/rails4/basic/app/views/root/index.html.erb +8 -0
  90. data/spec/apps/rails4/basic/app/views/root/streaming.html.erb +6 -0
  91. data/spec/apps/rails4/basic/bin/bundle +3 -0
  92. data/spec/apps/rails4/basic/bin/rails +4 -0
  93. data/spec/apps/rails4/basic/bin/rake +4 -0
  94. data/spec/apps/rails4/basic/config.ru +4 -0
  95. data/spec/apps/rails4/basic/config/application.rb +23 -0
  96. data/spec/apps/rails4/basic/config/boot.rb +4 -0
  97. data/spec/apps/rails4/basic/config/database.yml +20 -0
  98. data/spec/apps/rails4/basic/config/environment.rb +5 -0
  99. data/spec/apps/rails4/basic/config/environments/development.rb +29 -0
  100. data/spec/apps/rails4/basic/config/environments/production.rb +80 -0
  101. data/spec/apps/rails4/basic/config/environments/test.rb +36 -0
  102. data/spec/apps/rails4/basic/config/initializers/backtrace_silencers.rb +7 -0
  103. data/spec/apps/rails4/basic/config/initializers/filter_parameter_logging.rb +4 -0
  104. data/spec/apps/rails4/basic/config/initializers/inflections.rb +16 -0
  105. data/spec/apps/rails4/basic/config/initializers/mime_types.rb +5 -0
  106. data/spec/apps/rails4/basic/config/initializers/secret_token.rb +12 -0
  107. data/spec/apps/rails4/basic/config/initializers/session_store.rb +2 -0
  108. data/spec/apps/rails4/basic/config/initializers/wrap_parameters.rb +14 -0
  109. data/spec/apps/rails4/basic/config/locales/en.yml +23 -0
  110. data/spec/apps/rails4/basic/config/routes.rb +5 -0
  111. data/spec/apps/rails4/basic/db/seeds.rb +7 -0
  112. data/spec/apps/rails4/basic/lib/assets/.keep +0 -0
  113. data/spec/apps/rails4/basic/lib/tasks/.keep +0 -0
  114. data/spec/apps/rails4/basic/public/404.html +58 -0
  115. data/spec/apps/rails4/basic/public/422.html +58 -0
  116. data/spec/apps/rails4/basic/public/500.html +57 -0
  117. data/spec/apps/rails4/basic/public/favicon.ico +0 -0
  118. data/spec/apps/rails4/basic/public/robots.txt +5 -0
  119. data/spec/apps/rails4/basic/public/some_page.html +7 -0
  120. data/spec/apps/rails4/basic/test/controllers/.keep +0 -0
  121. data/spec/apps/rails4/basic/test/fixtures/.keep +0 -0
  122. data/spec/apps/rails4/basic/test/helpers/.keep +0 -0
  123. data/spec/apps/rails4/basic/test/integration/.keep +0 -0
  124. data/spec/apps/rails4/basic/test/mailers/.keep +0 -0
  125. data/spec/apps/rails4/basic/test/models/.keep +0 -0
  126. data/spec/apps/rails4/basic/test/test_helper.rb +15 -0
  127. data/spec/apps/rails4/basic/vendor/assets/javascripts/.keep +0 -0
  128. data/spec/apps/rails4/basic/vendor/assets/stylesheets/.keep +0 -0
  129. data/spec/apps/sinatra/basic/Gemfile +4 -0
  130. data/spec/apps/sinatra/basic/Gemfile.lock +20 -0
  131. data/spec/apps/sinatra/basic/basic.rb +27 -0
  132. data/spec/apps/sinatra/basic/config.ru +7 -0
  133. data/spec/apps/sinatra/basic/public/some_page.html +7 -0
  134. data/spec/apps/sinatra/basic/views/index.erb +4 -0
  135. data/spec/apps/sinatra/basic/views/posted.haml +2 -0
  136. data/spec/apps/sinatra/basic/views/poster.haml +4 -0
  137. data/spec/apps/sinatra/basic/views/request_mapping.haml +4 -0
  138. data/spec/integration/basic_rack_spec.rb +89 -0
  139. data/spec/integration/basic_rails4_spec.rb +64 -0
  140. data/spec/integration/basic_sinatra_spec.rb +80 -0
  141. data/spec/spec_helper.rb +13 -0
  142. data/test/.ruby-version +1 -0
  143. data/test/config/app.rb +5 -0
  144. data/test/jubilee/test_cli.rb +11 -0
  145. data/test/jubilee/test_configuration.rb +31 -0
  146. data/test/jubilee/test_rack_server.rb +137 -0
  147. data/test/jubilee/test_response.rb +272 -0
  148. data/test/jubilee/test_server.rb +72 -0
  149. data/test/jubilee/test_upload.rb +301 -0
  150. data/test/sinatra_app/app.rb +31 -0
  151. data/test/sinatra_app/config.ru +6 -0
  152. data/test/sinatra_app/public/test.html +10 -0
  153. data/test/sinatra_app/unicorn.conf.rb +29 -0
  154. data/test/test_helper.rb +93 -0
  155. metadata +242 -0
@@ -0,0 +1,107 @@
1
+ package org.jruby.jubilee.impl;
2
+
3
+ import org.jruby.Ruby;
4
+ import org.jruby.RubyClass;
5
+ import org.jruby.RubyModule;
6
+ import org.jruby.RubyObject;
7
+ import org.jruby.anno.JRubyMethod;
8
+ import org.jruby.jubilee.RackInput;
9
+ import org.jruby.runtime.Block;
10
+ import org.jruby.runtime.ObjectAllocator;
11
+ import org.jruby.runtime.ThreadContext;
12
+ import org.jruby.runtime.builtin.IRubyObject;
13
+
14
+ /**
15
+ * Created with IntelliJ IDEA.
16
+ * User: isaiah
17
+ * Date: 11/26/12
18
+ * Time: 12:11 PM
19
+ */
20
+ public class RubyNullIO extends RubyObject implements RackInput {
21
+ public static RubyClass createNullIOClass(Ruby ruby) {
22
+ RubyModule jModule = ruby.getOrCreateModule("Jubilee");
23
+ RubyClass nullIOClass = jModule.defineClassUnder("NullIO", ruby.getObject(), ALLOCATOR);
24
+ nullIOClass.defineAnnotatedMethods(RubyNullIO.class);
25
+ return nullIOClass;
26
+ }
27
+
28
+ public static ObjectAllocator ALLOCATOR = new ObjectAllocator() {
29
+ @Override
30
+ public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
31
+ return new RubyNullIO(ruby, rubyClass);
32
+ }
33
+ };
34
+
35
+ public RubyNullIO(Ruby runtime, RubyClass metaClass) {
36
+ super(runtime, metaClass);
37
+ }
38
+
39
+ /**
40
+ * gets must be called without arguments and return a string, or nil on EOF.
41
+ *
42
+ * @param context it's a JRuby thing
43
+ * @return a string, or nil on EOF
44
+ */
45
+ @Override
46
+ @JRubyMethod(name = "gets")
47
+ public IRubyObject gets(ThreadContext context) {
48
+ return getRuntime().getNil();
49
+ }
50
+
51
+ /**
52
+ * read behaves like IO#read. Its signature is read([length, [buffer]]). If given,
53
+ * length must be an non-negative Integer (>= 0) or nil, and buffer must be a
54
+ * String and may not be nil. If length is given and not nil, then this method
55
+ * reads at most length bytes from the input stream. If length is not given or
56
+ * nil, then this method reads all data until EOF. When EOF is reached, this
57
+ * method returns nil if length is given and not nil, or "" if length is not
58
+ * given or is nil. If buffer is given, then the read data will be placed into
59
+ * buffer instead of a newly created String object.
60
+ *
61
+ * @param context it's a JRuby thing
62
+ * @param args [length, [buffer]]
63
+ * @return nil if length is given and not nil, or "" if length is not given or nil
64
+ */
65
+ @Override
66
+ @JRubyMethod(optional = 2)
67
+ public IRubyObject read(ThreadContext context, IRubyObject[] args) {
68
+ return getRuntime().getNil();
69
+ }
70
+
71
+ /**
72
+ * each must be called without arguments and only yield Strings.
73
+ *
74
+ * @param context it's a JRuby thing
75
+ * @param block that receives yield of Strings
76
+ * @return pretty much nil
77
+ */
78
+ @Override
79
+ @JRubyMethod
80
+ public IRubyObject each(ThreadContext context, Block block) {
81
+ return getRuntime().getNil();
82
+ }
83
+
84
+ /**
85
+ * rewind must be called without arguments. It rewinds the input stream back
86
+ * to the beginning. It must not raise Errno::ESPIPE: that is, it may not be
87
+ * a pipe or a socket. Therefore, handler developers must buffer the input
88
+ * data into some rewindable object if the underlying input stream is not rewindable.
89
+ *
90
+ * @param context it's a JRuby thing
91
+ * @return pretty much nil
92
+ */
93
+ @Override
94
+ @JRubyMethod
95
+ public IRubyObject rewind(ThreadContext context) {
96
+ return getRuntime().getNil();
97
+ }
98
+
99
+ /**
100
+ * Close the input. Exposed only to the Java side because the Rack spec says
101
+ * that application code must not call close, so we don't expose a close method to Ruby.
102
+ */
103
+ @Override
104
+ public IRubyObject close(ThreadContext context) {
105
+ return getRuntime().getNil();
106
+ }
107
+ }
@@ -0,0 +1,37 @@
1
+ package org.jruby.jubilee.utils;
2
+
3
+ import org.jcodings.specific.USASCIIEncoding;
4
+ import org.jruby.Ruby;
5
+ import org.jruby.RubyHash;
6
+ import org.jruby.RubyModule;
7
+ import org.jruby.RubyString;
8
+ import org.jruby.javasupport.JavaEmbedUtils;
9
+ import org.jruby.util.ByteList;
10
+
11
+ import java.util.Map;
12
+ import java.util.Map.Entry;
13
+
14
+ /**
15
+ * Ruby reflection helper utilities.
16
+ *
17
+ * @author Bob McWhirter <bmcwhirt@redhat.com>
18
+ */
19
+ public class RubyHelper {
20
+
21
+ public static final RubyString toUsAsciiRubyString(final Ruby runtime, final String string) {
22
+ byte[] bytes = new byte[string.length()];
23
+ for (int i = 0; i < bytes.length; i++) {
24
+ bytes[i] = (byte) string.charAt(i);
25
+ }
26
+ return toUsAsciiRubyString(runtime, bytes);
27
+ }
28
+
29
+ public static final RubyString toUsAsciiRubyString(final Ruby runtime, final byte[] bytes) {
30
+ return RubyString.newString(runtime, new ByteList(bytes, USASCIIEncoding.INSTANCE, false));
31
+ }
32
+
33
+ public static final RubyString toUnicodeRubyString(final Ruby runtime, final String string) {
34
+ return RubyString.newUnicodeString(runtime, string);
35
+ }
36
+ }
37
+
@@ -0,0 +1,38 @@
1
+ package org.jruby.jubilee.vertx;
2
+
3
+ import org.vertx.java.core.Vertx;
4
+ import org.vertx.java.core.VertxFactory;
5
+ import org.vertx.java.core.eventbus.EventBus;
6
+ import org.vertx.java.core.shareddata.SharedData;
7
+
8
+ /**
9
+ * Created with IntelliJ IDEA.
10
+ * User: isaiah
11
+ * Date: 20/09/2013
12
+ * Time: 15:24
13
+ */
14
+ public class JubileeVertx {
15
+ public static Vertx vertx;
16
+ private JubileeVertx() {
17
+ }
18
+ public static synchronized Vertx init(int port, String host) {
19
+ if (vertx != null) return vertx;
20
+ vertx = VertxFactory.newVertx(port, host);
21
+ return vertx;
22
+ }
23
+ public static synchronized Vertx init(String host) {
24
+ if (vertx != null) return vertx;
25
+ vertx = VertxFactory.newVertx(host);
26
+ return vertx;
27
+ }
28
+ public static synchronized Vertx init() {
29
+ if (vertx != null) return vertx;
30
+ vertx = VertxFactory.newVertx();
31
+ return vertx;
32
+ }
33
+
34
+ public synchronized static Vertx vertx() {
35
+ if (vertx == null) init();
36
+ return vertx;
37
+ }
38
+ }
@@ -0,0 +1,201 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: jubilee 1.1.0 java lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "jubilee"
9
+ s.version = "1.1.0"
10
+ s.platform = "java"
11
+
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
+ s.authors = ["Isaiah Peng"]
14
+ s.date = "2014-01-09"
15
+ s.description = "Jubilee is a rack server for JRuby built upon the high performance Vertx platform. It provides the best features of Vertx such as EventBus, SharedData, and clustering."
16
+ s.email = "issaria@gmail.com"
17
+ s.executables = ["jubilee", "jubilee_d"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE.txt",
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ ".ruby-version",
24
+ ".travis.yml",
25
+ "CHANGELOG",
26
+ "Gemfile",
27
+ "Gemfile.lock",
28
+ "Guardfile",
29
+ "KNOWN_ISSUES",
30
+ "LICENSE.txt",
31
+ "README.md",
32
+ "ROADMAP",
33
+ "Rakefile",
34
+ "bin/jubilee",
35
+ "bin/jubilee_d",
36
+ "examples/chatapp/Gemfile",
37
+ "examples/chatapp/Gemfile.lock",
38
+ "examples/chatapp/README.md",
39
+ "examples/chatapp/app.rb",
40
+ "examples/chatapp/config.ru",
41
+ "examples/chatapp/public/assets/javascripts/application.js",
42
+ "examples/chatapp/public/assets/javascripts/jquery.js",
43
+ "examples/chatapp/public/assets/javascripts/sockjs-0.3.4.min.js",
44
+ "examples/chatapp/public/assets/javascripts/vertxbus.js",
45
+ "examples/chatapp/public/assets/stylesheets/application.css",
46
+ "examples/client/sockjs-0.3.4.min.js",
47
+ "examples/client/vertxbus.js",
48
+ "examples/jubilee.conf.rb",
49
+ "examples/jubilee/keystore.jks",
50
+ "examples/jubilee/server-keystore.jks",
51
+ "jars/hazelcast-2.6.3.jar",
52
+ "jars/jackson-annotations-2.2.2.jar",
53
+ "jars/jackson-core-2.2.2.jar",
54
+ "jars/jackson-databind-2.2.2.jar",
55
+ "jars/netty-all-4.0.13.Final.jar",
56
+ "jars/vertx-core-2.1M3-SNAPSHOT.jar",
57
+ "jars/vertx-hazelcast-2.1M3-SNAPSHOT.jar",
58
+ "java/src/jubilee/JubileeService.java",
59
+ "java/src/org/jruby/jubilee/Const.java",
60
+ "java/src/org/jruby/jubilee/RackApplication.java",
61
+ "java/src/org/jruby/jubilee/RackEnvironment.java",
62
+ "java/src/org/jruby/jubilee/RackEnvironmentHash.java",
63
+ "java/src/org/jruby/jubilee/RackInput.java",
64
+ "java/src/org/jruby/jubilee/RackResponse.java",
65
+ "java/src/org/jruby/jubilee/RubyHttpServerResponse.java",
66
+ "java/src/org/jruby/jubilee/RubyServer.java",
67
+ "java/src/org/jruby/jubilee/deploy/Starter.java",
68
+ "java/src/org/jruby/jubilee/impl/RubyIORackInput.java",
69
+ "java/src/org/jruby/jubilee/impl/RubyNullIO.java",
70
+ "java/src/org/jruby/jubilee/utils/RubyHelper.java",
71
+ "java/src/org/jruby/jubilee/vertx/JubileeVertx.java",
72
+ "jubilee.gemspec",
73
+ "lib/jubilee.rb",
74
+ "lib/jubilee/application.rb",
75
+ "lib/jubilee/cli.rb",
76
+ "lib/jubilee/configuration.rb",
77
+ "lib/jubilee/const.rb",
78
+ "lib/jubilee/jubilee.jar",
79
+ "lib/jubilee/response.rb",
80
+ "lib/jubilee/server.rb",
81
+ "lib/jubilee/version.rb",
82
+ "lib/rack/chunked.rb",
83
+ "lib/rack/handler/jubilee.rb",
84
+ "lib/vertx.rb",
85
+ "lib/vertx/README.md",
86
+ "lib/vertx/buffer.rb",
87
+ "lib/vertx/event_bus.rb",
88
+ "lib/vertx/shared_data.rb",
89
+ "spec/apps/rack/basic/config.ru",
90
+ "spec/apps/rails4/basic/.gitignore",
91
+ "spec/apps/rails4/basic/Gemfile",
92
+ "spec/apps/rails4/basic/Gemfile.lock",
93
+ "spec/apps/rails4/basic/README.rdoc",
94
+ "spec/apps/rails4/basic/Rakefile",
95
+ "spec/apps/rails4/basic/app/assets/images/.keep",
96
+ "spec/apps/rails4/basic/app/assets/images/rails.png",
97
+ "spec/apps/rails4/basic/app/assets/javascripts/application.js",
98
+ "spec/apps/rails4/basic/app/assets/stylesheets/application.css",
99
+ "spec/apps/rails4/basic/app/controllers/application_controller.rb",
100
+ "spec/apps/rails4/basic/app/controllers/concerns/.keep",
101
+ "spec/apps/rails4/basic/app/controllers/reloader_controller.rb",
102
+ "spec/apps/rails4/basic/app/controllers/reloader_controller.rb.erb",
103
+ "spec/apps/rails4/basic/app/controllers/root_controller.rb",
104
+ "spec/apps/rails4/basic/app/helpers/application_helper.rb",
105
+ "spec/apps/rails4/basic/app/mailers/.keep",
106
+ "spec/apps/rails4/basic/app/models/.keep",
107
+ "spec/apps/rails4/basic/app/models/concerns/.keep",
108
+ "spec/apps/rails4/basic/app/views/layouts/application.html.erb",
109
+ "spec/apps/rails4/basic/app/views/reloader/index.html.erb",
110
+ "spec/apps/rails4/basic/app/views/root/index.html.erb",
111
+ "spec/apps/rails4/basic/app/views/root/streaming.html.erb",
112
+ "spec/apps/rails4/basic/bin/bundle",
113
+ "spec/apps/rails4/basic/bin/rails",
114
+ "spec/apps/rails4/basic/bin/rake",
115
+ "spec/apps/rails4/basic/config.ru",
116
+ "spec/apps/rails4/basic/config/application.rb",
117
+ "spec/apps/rails4/basic/config/boot.rb",
118
+ "spec/apps/rails4/basic/config/database.yml",
119
+ "spec/apps/rails4/basic/config/environment.rb",
120
+ "spec/apps/rails4/basic/config/environments/development.rb",
121
+ "spec/apps/rails4/basic/config/environments/production.rb",
122
+ "spec/apps/rails4/basic/config/environments/test.rb",
123
+ "spec/apps/rails4/basic/config/initializers/backtrace_silencers.rb",
124
+ "spec/apps/rails4/basic/config/initializers/filter_parameter_logging.rb",
125
+ "spec/apps/rails4/basic/config/initializers/inflections.rb",
126
+ "spec/apps/rails4/basic/config/initializers/mime_types.rb",
127
+ "spec/apps/rails4/basic/config/initializers/secret_token.rb",
128
+ "spec/apps/rails4/basic/config/initializers/session_store.rb",
129
+ "spec/apps/rails4/basic/config/initializers/wrap_parameters.rb",
130
+ "spec/apps/rails4/basic/config/locales/en.yml",
131
+ "spec/apps/rails4/basic/config/routes.rb",
132
+ "spec/apps/rails4/basic/db/seeds.rb",
133
+ "spec/apps/rails4/basic/lib/assets/.keep",
134
+ "spec/apps/rails4/basic/lib/tasks/.keep",
135
+ "spec/apps/rails4/basic/public/404.html",
136
+ "spec/apps/rails4/basic/public/422.html",
137
+ "spec/apps/rails4/basic/public/500.html",
138
+ "spec/apps/rails4/basic/public/favicon.ico",
139
+ "spec/apps/rails4/basic/public/robots.txt",
140
+ "spec/apps/rails4/basic/public/some_page.html",
141
+ "spec/apps/rails4/basic/test/controllers/.keep",
142
+ "spec/apps/rails4/basic/test/fixtures/.keep",
143
+ "spec/apps/rails4/basic/test/helpers/.keep",
144
+ "spec/apps/rails4/basic/test/integration/.keep",
145
+ "spec/apps/rails4/basic/test/mailers/.keep",
146
+ "spec/apps/rails4/basic/test/models/.keep",
147
+ "spec/apps/rails4/basic/test/test_helper.rb",
148
+ "spec/apps/rails4/basic/vendor/assets/javascripts/.keep",
149
+ "spec/apps/rails4/basic/vendor/assets/stylesheets/.keep",
150
+ "spec/apps/sinatra/basic/Gemfile",
151
+ "spec/apps/sinatra/basic/Gemfile.lock",
152
+ "spec/apps/sinatra/basic/basic.rb",
153
+ "spec/apps/sinatra/basic/config.ru",
154
+ "spec/apps/sinatra/basic/public/some_page.html",
155
+ "spec/apps/sinatra/basic/views/index.erb",
156
+ "spec/apps/sinatra/basic/views/posted.haml",
157
+ "spec/apps/sinatra/basic/views/poster.haml",
158
+ "spec/apps/sinatra/basic/views/request_mapping.haml",
159
+ "spec/integration/basic_rack_spec.rb",
160
+ "spec/integration/basic_rails4_spec.rb",
161
+ "spec/integration/basic_sinatra_spec.rb",
162
+ "spec/spec_helper.rb",
163
+ "test/.ruby-version",
164
+ "test/config/app.rb",
165
+ "test/jubilee/test_cli.rb",
166
+ "test/jubilee/test_configuration.rb",
167
+ "test/jubilee/test_rack_server.rb",
168
+ "test/jubilee/test_response.rb",
169
+ "test/jubilee/test_server.rb",
170
+ "test/jubilee/test_upload.rb",
171
+ "test/sinatra_app/app.rb",
172
+ "test/sinatra_app/config.ru",
173
+ "test/sinatra_app/public/test.html",
174
+ "test/sinatra_app/unicorn.conf.rb",
175
+ "test/test_helper.rb"
176
+ ]
177
+ s.homepage = "http://isaiah.github.io/jubilee"
178
+ s.licenses = ["MIT"]
179
+ s.require_paths = ["lib"]
180
+ s.rubygems_version = "2.1.9"
181
+ s.summary = "More than a server for rack applications."
182
+
183
+ if s.respond_to? :specification_version then
184
+ s.specification_version = 4
185
+
186
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
187
+ s.add_runtime_dependency(%q<rack>, [">= 1.4.1"])
188
+ s.add_runtime_dependency(%q<spoon>, ["~> 0.0.4"])
189
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
190
+ else
191
+ s.add_dependency(%q<rack>, [">= 1.4.1"])
192
+ s.add_dependency(%q<spoon>, ["~> 0.0.4"])
193
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
194
+ end
195
+ else
196
+ s.add_dependency(%q<rack>, [">= 1.4.1"])
197
+ s.add_dependency(%q<spoon>, ["~> 0.0.4"])
198
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
199
+ end
200
+ end
201
+
@@ -0,0 +1,17 @@
1
+ require File.join(File.dirname(__FILE__), "../jars/jackson-core-2.2.2.jar")
2
+ require File.join(File.dirname(__FILE__), "../jars/jackson-databind-2.2.2.jar")
3
+ require File.join(File.dirname(__FILE__), "../jars/jackson-annotations-2.2.2.jar")
4
+ require File.join(File.dirname(__FILE__), "../jars/hazelcast-2.6.3.jar")
5
+ require File.join(File.dirname(__FILE__), "../jars/vertx-core-2.1M3-SNAPSHOT.jar")
6
+ require File.join(File.dirname(__FILE__), "../jars/netty-all-4.0.13.Final.jar")
7
+
8
+ require 'jubilee/jubilee.jar'
9
+ require 'rack'
10
+ require 'jubilee/version'
11
+ require 'jubilee/const'
12
+ require 'jubilee/server'
13
+ require 'jubilee/application'
14
+ require 'jubilee/configuration'
15
+ require 'jubilee/response'
16
+ require 'rack/handler/jubilee'
17
+ require 'rack/chunked'
@@ -0,0 +1,13 @@
1
+ module Jubilee
2
+ class Application
3
+ def initialize(rack_app)
4
+ unless @app = rack_app
5
+ raise "rack application not found, make sure the rackup file path is correct"
6
+ end
7
+ end
8
+
9
+ def call(env)
10
+ Response.new(@app.call(env))
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,127 @@
1
+ require 'optparse'
2
+ require 'jubilee'
3
+ require 'java'
4
+
5
+ java_import java.lang.System
6
+
7
+ module Jubilee
8
+ class CLI
9
+ # Parsed options
10
+ attr_accessor :options
11
+ def initialize(argv)
12
+ @argv = argv
13
+ setup_options
14
+ end
15
+
16
+ def test_java_version!(version)
17
+ if version[0..2] < "1.7"
18
+ puts("Error: Jubilee requires JDK 1.7.0 or later. You can use the official Oracle distribution or the OpenJDK version.")
19
+ exit 1
20
+ end
21
+ end
22
+
23
+ def parse_options
24
+ argv = @argv.dup
25
+ @parser.parse! argv
26
+ if @argv.last
27
+ @options[:rackup] = argv.shift
28
+ end
29
+ end
30
+
31
+ def run
32
+ test_java_version!(System.getProperties["java.runtime.version"])
33
+ parse_options
34
+
35
+ ENV["RACK_ENV"] = @options[:environment]
36
+
37
+ if @options[:daemon]
38
+ puts "Starting Jubilee in daemon mode..."
39
+ `jubilee_d #{(@argv - ["-d", "--daemon"]).join(" ")}`
40
+ else
41
+ @config = Jubilee::Configuration.new(@options)
42
+ server = Jubilee::Server.new(@config.app, @config.options)
43
+ server.start
44
+ puts "Jubilee is listening on port #{@config.options[:Port]}, press Ctrl+C to quit"
45
+ starter = org.jruby.jubilee.deploy.Starter.new
46
+ starter.block
47
+ end
48
+ end
49
+
50
+ def setup_options
51
+ @options = {
52
+ debug: false,
53
+ daemon: false,
54
+ Port: 8080,
55
+ Host: "0.0.0.0",
56
+ ssl: false,
57
+ environment: ENV["RACK_ENV"] || "development"
58
+ }
59
+ @parser = OptionParser.new do |o|
60
+ o.separator ""
61
+ o.separator "Server options:"
62
+
63
+ o.on "-c", "--config PATH", "Load PATH as a config file" do |arg|
64
+ @options[:config_file] = arg
65
+ end
66
+ o.on "-d", "--daemon", "Daemonize the server" do
67
+ @options[:daemon] = true
68
+ end
69
+ o.on "--dir DIR", "Change to DIR before starting" do |arg|
70
+ @options[:working_directory] = arg
71
+ end
72
+ o.on "-p", "--port PORT", "Defind which PORT the server should bind" do |arg|
73
+ @options[:Port] = arg.to_i
74
+ end
75
+ o.on "--host HOST", "Defind which HOST the server should bind, default 0.0.0.0" do |arg|
76
+ @options[:Host] = arg
77
+ end
78
+ o.on "-e", "--environment ENV", "Rack environment" do |arg|
79
+ @options[:environment] = arg
80
+ end
81
+ o.separator ""
82
+ o.separator "SSL options:"
83
+ o.on "--ssl", "Enable SSL connection" do
84
+ @options[:ssl] = true
85
+ end
86
+ o.on "--ssl-keystore PATH", "SSL keystore path" do |arg|
87
+ @options[:keystore_path] = arg
88
+ end
89
+ o.on "--ssl-password PASS", "SSL keystore password" do |arg|
90
+ @options[:keystore_password] = arg
91
+ end
92
+ o.separator ""
93
+ o.separator "Event bus options:"
94
+ o.on "--eventbus PREFIX", "Event bus prefix, use allow-all policy by default" do |arg|
95
+ @options[:eventbus_prefix] = arg
96
+ end
97
+
98
+ o.separator ""
99
+ o.separator "Clustering options:"
100
+ o.on "--cluster", "Enable clustering" do
101
+ @options[:cluster_host] = "0.0.0.0"
102
+ end
103
+ o.on "--cluster-port", "If the cluster option has also been specified then this determines which port will be used for cluster communication with other Vert.x instances. Default is 0 -which means 'chose a free ephemeral port. You don't usually need to specify this parameter unless you really need to bind to a specific port." do |port|
104
+ @options[:cluster_host] = port
105
+ end
106
+ o.on "--cluster-host", "If the cluster option has also been specified then this determines which host address will be used for cluster communication with other Vert.x instances. By default it will try and pick one from the available interfaces. If you have more than one interface and you want to use a specific one, specify it here." do |host|
107
+ @options[:cluster_host] = host
108
+ end
109
+
110
+ o.separator ""
111
+ o.separator "Common options:"
112
+ o.on "--verbose", "Log low level debug information" do
113
+ @options[:debug] = true
114
+ end
115
+ o.on "-q", "--quiet" do
116
+ @options[:quiet] = true
117
+ end
118
+ end
119
+
120
+ @parser.banner = "jubilee <options> <rackup file>"
121
+ @parser.on_tail "-h", "--help", "Show this message" do
122
+ puts @parser
123
+ exit 1
124
+ end
125
+ end
126
+ end
127
+ end