jubilee 1.1.0.rc1 → 1.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f1455eb032eecbf34eb4c64b1f7c2275bf6a712
4
- data.tar.gz: f69992911c71786735f250f043720d56fc8ea825
3
+ metadata.gz: 38c7ff14a0556dd319caf62874e40fc69a1380c2
4
+ data.tar.gz: 3022b1786dda6ac2a2cef500e5f128996225159c
5
5
  SHA512:
6
- metadata.gz: ff9925abef232206f19275b9e04f4438c5ce568b74cb4962acd5b368c6f798d514bd8d37cdfdae961504ec82b69d8cbfe19fae256fed5a65e7283287a954915c
7
- data.tar.gz: c6b4adf8cd09c53d3cf79c8d4cef04a2c420ee81f10b0ef7d106029a9d838a70d6275f0329b0fe4372b5a2f3ee20b7e922f44f9fc81a33dfc687e707782bfe3c
6
+ metadata.gz: ccf4e457c07dd123ed41aed249cb3a8c632b789dfeb5c9a937fc52274dc8b857cba2e89e05dee742e0937cf312ef019dba25d6ba931675dc98c8baaf7c8aa82d
7
+ data.tar.gz: 2dffccc0cd663b3254123e7b3b0f81c89acea0e1ffbd0c9a9af2335218f768ab4688c1835a22d480319f747d4900285d4b44050ef5c5581c55e9750e7860344e
data/README.md CHANGED
@@ -46,7 +46,7 @@ Setup
46
46
  -----
47
47
 
48
48
  If you use bundler, you might want to add `jubilee` to your Gemfile,
49
- this is required if you want use rails http stream
49
+ this is also required if you want use rails http streaming,
50
50
 
51
51
  $ jubilee
52
52
 
@@ -15,7 +15,6 @@ import org.jruby.util.ByteList;
15
15
  import org.jruby.util.StringSupport;
16
16
  import org.vertx.java.core.http.HttpServerRequest;
17
17
 
18
- import java.util.Arrays;
19
18
  import java.util.concurrent.atomic.AtomicBoolean;
20
19
 
21
20
  /**
@@ -26,7 +25,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
26
25
  */
27
26
  public class RubyIORackInput extends RubyObject implements RackInput {
28
27
  private Encoding BINARY = ASCIIEncoding.INSTANCE;
29
- private HttpServerRequest request;
30
28
  private int len;
31
29
  private boolean chunked;
32
30
  private ByteBuf buf;
@@ -52,7 +50,6 @@ public class RubyIORackInput extends RubyObject implements RackInput {
52
50
 
53
51
  public RubyIORackInput(Ruby runtime, RubyClass rubyClass, HttpServerRequest request, ByteBuf buf, AtomicBoolean eof) {
54
52
  this(runtime, rubyClass);
55
- this.request = request;
56
53
  String hdr = request.headers().get(Const.Vertx.CONTENT_LENGTH);
57
54
  this.chunked = hdr == null;
58
55
  this.len = this.chunked ? 0 : Integer.parseInt(hdr);
@@ -71,16 +68,19 @@ public class RubyIORackInput extends RubyObject implements RackInput {
71
68
  @Override
72
69
  @JRubyMethod
73
70
  public IRubyObject gets(ThreadContext context) {
74
- RubyString line = RubyString.newEmptyString(getRuntime(), BINARY);
75
- if (isEOF())
76
- return getRuntime().getNil();
71
+ Ruby runtime = context.runtime;
72
+ RubyString line = RubyString.newEmptyString(context.runtime, BINARY);
73
+
74
+ if (isEOF()) return runtime.getNil();
75
+
77
76
  int lineEnd = -1;
78
- while (lineEnd == -1 && !isEOF())
77
+ while (lineEnd == -1 && !eof.get()) {
79
78
  lineEnd = buf.indexOf(buf.readerIndex(), buf.writerIndex(), Const.EOL);
79
+ }
80
80
 
81
81
  // No line break found, read all
82
82
  if (lineEnd == -1)
83
- return readAll(line);
83
+ return readAll(runtime, line);
84
84
 
85
85
  int readLength = lineEnd - buf.readerIndex();
86
86
  byte[] dst = new byte[readLength + 1];
@@ -105,22 +105,23 @@ public class RubyIORackInput extends RubyObject implements RackInput {
105
105
  @Override
106
106
  @JRubyMethod(optional = 2)
107
107
  public IRubyObject read(ThreadContext context, IRubyObject[] args) {
108
- RubyString dst = RubyString.newStringNoCopy(getRuntime(), new ByteList(), BINARY, StringSupport.CR_VALID);
108
+ Ruby runtime = context.runtime;
109
+ RubyString dst = RubyString.newStringNoCopy(context.runtime, new ByteList(), BINARY, StringSupport.CR_VALID);
109
110
  if (isEOF())
110
- return getRuntime().getNil();
111
+ return runtime.getNil();
111
112
  int length;
112
113
  switch (args.length) {
113
114
  case 0:
114
- return readAll(dst);
115
+ return readAll(runtime, dst);
115
116
  case 1:
116
- length = RubyInteger.num2int(args[0]);
117
+ length = RubyNumeric.num2int(args[0]);
117
118
  break;
118
119
  default:
119
- length = RubyInteger.num2int(args[0]);
120
+ length = RubyNumeric.num2int(args[0]);
120
121
  dst = (RubyString) args[1];
121
122
  }
122
123
  if (length < 0)
123
- getRuntime().newArgumentError("Negative length " + length + " given");
124
+ runtime.newArgumentError("Negative length " + length + " given");
124
125
  byte[] buffer = new byte[length];
125
126
  int toRead = length;
126
127
  while (toRead > 0 && !isEOF()) {
@@ -146,7 +147,7 @@ public class RubyIORackInput extends RubyObject implements RackInput {
146
147
  while (!(str = gets(context)).isNil()) {
147
148
  block.yield(context, str);
148
149
  }
149
- return getRuntime().getNil();
150
+ return context.runtime.getNil();
150
151
  }
151
152
 
152
153
  /**
@@ -162,7 +163,7 @@ public class RubyIORackInput extends RubyObject implements RackInput {
162
163
  @JRubyMethod
163
164
  public IRubyObject rewind(ThreadContext context) {
164
165
  buf.readerIndex(0);
165
- return getRuntime().getNil();
166
+ return context.runtime.getNil();
166
167
  }
167
168
 
168
169
  /**
@@ -172,7 +173,7 @@ public class RubyIORackInput extends RubyObject implements RackInput {
172
173
  @JRubyMethod
173
174
  public IRubyObject close(ThreadContext context) {
174
175
  buf.clear();
175
- return getRuntime().getNil();
176
+ return context.runtime.getNil();
176
177
  }
177
178
 
178
179
  private int readableBytes() {
@@ -188,14 +189,13 @@ public class RubyIORackInput extends RubyObject implements RackInput {
188
189
  return buf.readableBytes() == 0 && eof.get();
189
190
  }
190
191
 
191
- private IRubyObject readAll(RubyString dst) {
192
- buf.readerIndex(0);
192
+ private IRubyObject readAll(Ruby runtime, RubyString dst) {
193
193
  while(!eof.get())
194
194
  ; // wait until all data received
195
195
  int length = this.chunked ? buf.readableBytes() : Math.min(this.len, buf.readableBytes());
196
196
  byte[] data = new byte[length];
197
197
  buf.readBytes(data);
198
198
  dst.cat(data);
199
- return dst.isEmpty() ? getRuntime().getNil() : dst;
199
+ return dst.isEmpty() ? runtime.getNil() : dst;
200
200
  }
201
201
  }
Binary file
@@ -3,7 +3,7 @@ module Jubilee
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
5
  PATCH = 0
6
- BUILD = 'rc1'
6
+ BUILD = 'rc2'
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
9
9
  end
@@ -10,7 +10,3 @@
10
10
  // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require turbolinks
16
- //= require_tree .
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jubilee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc1
4
+ version: 1.1.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Isaiah Peng