sinatra-auto-reload 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +13 -0
- data/README.rdoc +13 -4
- data/Rakefile +1 -1
- data/examples/app.rb +3 -0
- data/lib/sinatra/auto-reload.rb +12 -3
- metadata +3 -3
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -12,14 +12,23 @@ Sinatra Auto Reloader automatically reload your browser when you save code/html/
|
|
12
12
|
|
13
13
|
== SYNOPSIS:
|
14
14
|
|
15
|
-
|
15
|
+
* load on your sinatra application
|
16
16
|
require 'sinatra/auto-reloader' if development?
|
17
17
|
|
18
|
-
|
18
|
+
* Install userscript for chrome/firefox
|
19
19
|
http://hostname:port/sinatra_auto_reload.user.js
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
It checks last modified time (http://hostname:port/sinatra_auto_reload)
|
22
|
+
every second.
|
23
|
+
|
24
|
+
* ignore files
|
25
|
+
define on your application
|
26
|
+
|
27
|
+
def auto_reload_ignores
|
28
|
+
[/db.*/, /config.yaml/]
|
29
|
+
end
|
30
|
+
|
31
|
+
* see examples/app.rb
|
23
32
|
|
24
33
|
== REQUIREMENTS:
|
25
34
|
|
data/Rakefile
CHANGED
data/examples/app.rb
CHANGED
data/lib/sinatra/auto-reload.rb
CHANGED
@@ -6,9 +6,18 @@ require 'sinatra/sugar'
|
|
6
6
|
module Sinatra
|
7
7
|
|
8
8
|
get '/sinatra_auto_reload' do
|
9
|
-
[Dir.glob("*"),
|
10
|
-
|
11
|
-
|
9
|
+
files = [Dir.glob("*"),
|
10
|
+
Dir.glob("*/*"),
|
11
|
+
Dir.glob("*/*/*"),
|
12
|
+
Dir.glob("*/*/*/*")].flatten
|
13
|
+
|
14
|
+
begin
|
15
|
+
auto_reload_ignores.each{|pattern|
|
16
|
+
files = files.delete_if{|f| f =~ pattern}
|
17
|
+
}
|
18
|
+
rescue
|
19
|
+
end
|
20
|
+
files.map{|f| File::mtime(f).to_i}.sort.last.to_s;
|
12
21
|
end
|
13
22
|
|
14
23
|
get '/sinatra_auto_reload.user.js' do # user.js
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-auto-reload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- shokai
|