rack-livereload 0.3.16 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,9 @@ module Rack
4
4
  class LiveReload
5
5
  class BodyProcessor
6
6
  LIVERELOAD_JS_PATH = '/__rack/livereload.js'
7
- HEAD_TAG_REGEX = /<head>|<head[^(er)][^<]*>/
7
+ HEAD_TAG_REGEX = /<head( [^<]+)?>/
8
8
  LIVERELOAD_PORT = 35729
9
+ LIVERELOAD_SCHEME = "ws"
9
10
 
10
11
  attr_reader :content_length, :new_body, :livereload_added
11
12
 
@@ -14,12 +15,14 @@ module Rack
14
15
  end
15
16
 
16
17
  def livereload_local_uri
17
- "#{protocol}://localhost:#{@options[:live_reload_port]}/livereload.js"
18
+ "#{protocol}://localhost:#{@options[:live_reload_port]}/" +
19
+ 'livereload.js'
18
20
  end
19
21
 
20
22
  def initialize(body, options)
21
23
  @body, @options = body, options
22
24
  @options[:live_reload_port] ||= LIVERELOAD_PORT
25
+ @options[:live_reload_scheme] ||= LIVERELOAD_SCHEME
23
26
 
24
27
  @processed = false
25
28
  end
@@ -20,11 +20,11 @@ module Rack
20
20
  end
21
21
 
22
22
  def chunked?
23
- @headers['Transfer-Encoding'] == 'chunked'
23
+ @headers['transfer-encoding'] == 'chunked'
24
24
  end
25
25
 
26
26
  def inline?
27
- @headers['Content-Disposition'] =~ %r{^inline}
27
+ @headers['content-disposition'] =~ %r{^inline}
28
28
  end
29
29
 
30
30
  def ignored?
@@ -37,7 +37,7 @@ module Rack
37
37
  end
38
38
 
39
39
  def html?
40
- @headers['Content-Type'] =~ %r{text/html}
40
+ @headers['content-type'] =~ %r{text/html|application/xhtml\+xml}
41
41
  end
42
42
 
43
43
  def get?
@@ -27,10 +27,10 @@ module Rack
27
27
  processor = BodyProcessor.new(body, @options)
28
28
  processor.process!(env)
29
29
 
30
- headers['Content-Length'] = processor.content_length.to_s
30
+ headers['content-length'] = processor.content_length.to_s
31
31
 
32
32
  if processor.livereload_added
33
- headers['X-Rack-LiveReload'] = '1'
33
+ headers['x-rack-livereload'] = '1'
34
34
  end
35
35
 
36
36
  [ status, headers, processor.new_body ]
@@ -46,7 +46,7 @@ module Rack
46
46
  'application/swf'
47
47
  end
48
48
 
49
- [ 200, { 'Content-Type' => type, 'Content-Length' => ::File.size(file).to_s }, [ ::File.read(file) ] ]
49
+ [ 200, { 'content-type' => type, 'content-length' => ::File.size(file).to_s }, [ ::File.read(file) ] ]
50
50
  end
51
51
  end
52
52
  end
@@ -1,6 +1,6 @@
1
1
  require "rack/livereload"
2
2
 
3
3
  class Rack::LiveReload
4
- VERSION = '0.3.16'
4
+ VERSION = '0.5.1'
5
5
  end
6
6
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Rack::LiveReload::VERSION
8
8
  s.authors = ["John Bintz"]
9
9
  s.email = ["john@coswellproductions.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/onesupercoder/rack-livereload"
11
11
  s.license = "MIT"
12
12
  s.summary = %q{Insert LiveReload into your app easily as Rack middleware}
13
13
  s.description = %q{Insert LiveReload into your app easily as Rack middleware}
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # specify any dependencies here; for example:
23
23
  s.add_development_dependency "rspec"
24
- s.add_development_dependency "cucumber"
24
+ s.add_development_dependency "cucumber", "< 3"
25
25
  s.add_development_dependency "httparty"
26
26
  s.add_development_dependency "sinatra"
27
27
  s.add_development_dependency "shotgun"
@@ -32,9 +32,10 @@ Gem::Specification.new do |s|
32
32
  s.add_development_dependency "guard-rspec"
33
33
  s.add_development_dependency "guard-cucumber"
34
34
  s.add_development_dependency "guard-livereload"
35
+ s.add_development_dependency "guard-bundler"
35
36
  s.add_development_dependency "webmock"
36
37
  s.add_development_dependency "nokogiri", ("< 1.6" if RUBY_VERSION < "1.9") # Nokogiri >= 1.6 requires Ruby >= 1.9
37
- s.add_development_dependency 'appraisal', '~> 0.4'
38
+ s.add_development_dependency 'appraisal', '~> 2.2.0'
38
39
  s.add_runtime_dependency "rack"
39
40
  end
40
41
 
@@ -10,6 +10,7 @@
10
10
  <% end %>
11
11
  <script type="text/javascript">
12
12
  RACK_LIVERELOAD_PORT = <%= @options[:live_reload_port] %>;
13
+ RACK_LIVERELOAD_SCHEME = "<%= @options[:live_reload_scheme] %>";
13
14
  </script>
14
15
  <script type="text/javascript" src="<%= livereload_source %>"></script>
15
16
 
@@ -40,7 +40,7 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
40
40
  end
41
41
 
42
42
  context 'chunked response' do
43
- let(:headers) { { 'Transfer-Encoding' => 'chunked' } }
43
+ let(:headers) { { 'transfer-encoding' => 'chunked' } }
44
44
 
45
45
  it { should be_chunked }
46
46
  end
@@ -48,7 +48,7 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
48
48
 
49
49
  describe '#inline?' do
50
50
  context 'inline disposition' do
51
- let(:headers) { { 'Content-Disposition' => 'inline; filename=my_inlined_file' } }
51
+ let(:headers) { { 'content-disposition' => 'inline; filename=my_inlined_file' } }
52
52
 
53
53
  it { should be_inline }
54
54
  end
@@ -90,13 +90,19 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do
90
90
 
91
91
  describe '#html?' do
92
92
  context 'HTML content' do
93
- let(:headers) { { 'Content-Type' => 'text/html' } }
93
+ let(:headers) { { 'content-type' => 'text/html' } }
94
+
95
+ it { should be_html }
96
+ end
97
+
98
+ context 'XHTML content' do
99
+ let(:headers) { { 'content-type' => 'application/xhtml+xml' } }
94
100
 
95
101
  it { should be_html }
96
102
  end
97
103
 
98
104
  context 'PDF content' do
99
- let(:headers) { { 'Content-Type' => 'application/pdf' } }
105
+ let(:headers) { { 'content-type' => 'application/pdf' } }
100
106
 
101
107
  it { should_not be_html }
102
108
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-livereload
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bintz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-03 00:00:00.000000000 Z
11
+ date: 2023-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: cucumber
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: guard-bundler
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: webmock
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -212,14 +226,14 @@ dependencies:
212
226
  requirements:
213
227
  - - "~>"
214
228
  - !ruby/object:Gem::Version
215
- version: '0.4'
229
+ version: 2.2.0
216
230
  type: :development
217
231
  prerelease: false
218
232
  version_requirements: !ruby/object:Gem::Requirement
219
233
  requirements:
220
234
  - - "~>"
221
235
  - !ruby/object:Gem::Version
222
- version: '0.4'
236
+ version: 2.2.0
223
237
  - !ruby/object:Gem::Dependency
224
238
  name: rack
225
239
  requirement: !ruby/object:Gem::Requirement
@@ -255,8 +269,9 @@ files:
255
269
  - features/step_definitions/then/i_should_not_have_livereload_code.rb
256
270
  - features/step_definitions/when/i_make_a_request_with_headers.rb
257
271
  - features/support/env.rb
258
- - gemfiles/rails32.gemfile
259
- - gemfiles/rails40.gemfile
272
+ - gemfiles/rails51.gemfile
273
+ - gemfiles/rails602.gemfile
274
+ - gemfiles/rails7.gemfile
260
275
  - index.html
261
276
  - js/WebSocketMain.swf
262
277
  - js/livereload.js
@@ -272,7 +287,7 @@ files:
272
287
  - spec/rack/livereload/processing_skip_analyzer_spec.rb
273
288
  - spec/rack/livereload_spec.rb
274
289
  - spec/spec_helper.rb
275
- homepage: ''
290
+ homepage: https://github.com/onesupercoder/rack-livereload
276
291
  licenses:
277
292
  - MIT
278
293
  metadata: {}
@@ -291,9 +306,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
291
306
  - !ruby/object:Gem::Version
292
307
  version: '0'
293
308
  requirements: []
294
- rubyforge_project: rack-livereload
295
- rubygems_version: 2.4.6
309
+ rubygems_version: 3.0.3.1
296
310
  signing_key:
297
311
  specification_version: 4
298
312
  summary: Insert LiveReload into your app easily as Rack middleware
299
- test_files: []
313
+ test_files:
314
+ - features/skip_certain_browsers.feature
315
+ - features/step_definitions/given/i_have_a_rack_app_with_live_reload.rb
316
+ - features/step_definitions/then/i_should_not_have_livereload_code.rb
317
+ - features/step_definitions/when/i_make_a_request_with_headers.rb
318
+ - features/support/env.rb
319
+ - spec/rack/livereload/body_processor_spec.rb
320
+ - spec/rack/livereload/processing_skip_analyzer_spec.rb
321
+ - spec/rack/livereload_spec.rb
322
+ - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rails", "~> 3.2.0"
6
-
7
- gemspec :path=>"../"
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "rails", "~> 4.0.0"
6
-
7
- gemspec :path=>"../"