rack-livejs 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Rack::Livejs
2
2
 
3
- TODO: Write a gem description
3
+ Rack middleware to inject and serve "live.js", a handy javascript snippet for automatically updating content in browser when files in your local dev environment change.
4
+
5
+ "Just include Live.js and it will monitor the current page including local CSS and Javascript by sending consecutive HEAD requests to the server. Changes to CSS will be applied dynamically and HTML or Javascript changes will reload the page." - extracted form livejs.com
6
+
7
+ View [livejs.com](http://livejs.com) for more information on live.js and how it works
8
+
4
9
 
5
10
  ## Installation
6
11
 
@@ -18,7 +23,7 @@ Or install it yourself as:
18
23
 
19
24
  ## Usage
20
25
 
21
- TODO: Write usage instructions here
26
+ Nothing else to do. Rack will serve live.js into your site and will monitor your assets (css, js and html) changes.
22
27
 
23
28
  ## Contributing
24
29
 
@@ -31,7 +31,8 @@ module Rack
31
31
  end
32
32
 
33
33
  def inject_livejs(html)
34
- html.sub(%r{(<head( [^>]*)?>)}i) { $1 + %{<script src="#{bundled_livejs_path}"/>} }
34
+ livejs_snippet = %{<script src="#{bundled_livejs_path}"></script>}
35
+ html.sub(%r{(?=</head>)}i) { livejs_snippet }
35
36
  end
36
37
 
37
38
  def bundled_livejs_prefix
@@ -1,5 +1,5 @@
1
1
  module Rack
2
2
  class Livejs
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-livejs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-23 00:00:00.000000000 Z
12
+ date: 2014-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: -3427976022966837224
84
+ hash: 538134631761730897
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: -3427976022966837224
93
+ hash: 538134631761730897
94
94
  requirements: []
95
95
  rubyforge_project:
96
96
  rubygems_version: 1.8.23