wedge 0.1.51 → 0.1.52

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: c3ad8d941cd3af9d92f147392177d8f43b4e3fe1
4
- data.tar.gz: a50aed46139f03ba646fab9b2c1cba2efbbc1319
3
+ metadata.gz: a70f7009ba5b2069a4d05afe8da0c7d534e4b23f
4
+ data.tar.gz: 9745f755aee6277fdb2162ce8f7e087415464048
5
5
  SHA512:
6
- metadata.gz: 93e268ea73428650088be288c5fd34960d9e9d0ea050ff9089f1781197e1f504db017eca99929ddc31c572d6e50c5bbfd37737e33a8154787fd184e5373cbb14
7
- data.tar.gz: b2844908b03495a43c2e533ac28fc39b27b028419cd0ad70352c6104b1a01e3af56edf48acbb2963ce6a48c8cd030d76bd6c328b987a629eb58f5c94fb5a3d78
6
+ metadata.gz: d763d59eebc9999b3b82c95b782630849c10e86a77dd6e41829c4d7618599cbdb91f78c9ce7994d5d2e0e40ea131cc9b00bb955c0ef6e1eed685d8d023d06a46
7
+ data.tar.gz: c1d981a77a58e63097403fbe58a82eb25340ea656ff55e9cec0518c497fc940b273aef022a06bceaa5738d9cd2e6dd20023271376b6176c7767aa6d3c16b9cdc
@@ -107,7 +107,25 @@ class Wedge
107
107
  @opal[:sprockets].call e
108
108
  end
109
109
  else
110
- @opal[:server].call env
110
+ status, headers, body = @opal[:server].call env
111
+
112
+ headers['Content-Type'] = 'application/javascript; charset=UTF-8'
113
+
114
+ if Wedge.config.gzip_assets
115
+ require 'zlib'
116
+
117
+ headers['Content-Encoding'] = 'gzip'
118
+
119
+ wio = StringIO.new("")
120
+ w_gz = Zlib::GzipWriter.new(wio)
121
+ w_gz.write(body.last.to_s)
122
+ w_gz.close
123
+ body = wio.string
124
+
125
+ headers['Content-Length'] = body.length.to_s
126
+ end
127
+
128
+ [status, headers, [body]]
111
129
  end
112
130
  end
113
131
  else
@@ -138,17 +138,6 @@ unless RUBY_ENGINE == 'opal'
138
138
  if env['PATH_INFO'][@server.prefix]
139
139
  status, headers, body = @app.call env
140
140
 
141
- headers = {
142
- 'Content-Type' => 'application/javascript; charset=UTF-8'
143
- }.merge headers
144
-
145
- if server.gzip
146
- require 'zlib'
147
-
148
- headers['Content-Encoding'] = 'gzip'
149
- body = Zlib::Deflate.deflate body
150
- end
151
-
152
141
  [status, headers.merge(@server.headers), [body]]
153
142
  else
154
143
  @app.call env
@@ -1,3 +1,3 @@
1
1
  class Wedge
2
- VERSION = '0.1.51'
2
+ VERSION = '0.1.52'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wedge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.51
4
+ version: 0.1.52
5
5
  platform: ruby
6
6
  authors:
7
7
  - cj