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.
@@ -1,3 +1,16 @@
1
+
2
+ === 0.0.4
3
+
4
+ * ignore pattern file watching
5
+
6
+ === 0.0.3
7
+
8
+ * fix bug if use views :layout
9
+
10
+ === 0.0.2 2010-05-23
11
+
12
+ * add README
13
+
1
14
  === 0.0.1 2010-05-23
2
15
 
3
16
  * Initial release
@@ -12,14 +12,23 @@ Sinatra Auto Reloader automatically reload your browser when you save code/html/
12
12
 
13
13
  == SYNOPSIS:
14
14
 
15
- 1. load on your sinatra application
15
+ * load on your sinatra application
16
16
  require 'sinatra/auto-reloader' if development?
17
17
 
18
- 2. Install userscript for chrome/firefox
18
+ * Install userscript for chrome/firefox
19
19
  http://hostname:port/sinatra_auto_reload.user.js
20
20
 
21
- It checks last modified time (http://hostname:port/sinatra_auto_reload)
22
- every second.
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
@@ -4,7 +4,7 @@ require 'hoe'
4
4
  require 'fileutils'
5
5
  require './lib/sinatra/auto-reload'
6
6
 
7
- VERSION = '0.0.3'
7
+ VERSION = '0.0.4'
8
8
 
9
9
  Hoe.plugin :newgem
10
10
  # Hoe.plugin :website
@@ -5,6 +5,9 @@ require 'rack'
5
5
  #require 'sinatra/auto-reload' if development?
6
6
  require File.dirname(__FILE__)+'/../lib/sinatra/auto-reload' if development?
7
7
 
8
+ def auto_reload_ignores
9
+ [/db.*/, /config.yaml/]
10
+ end
8
11
 
9
12
  get '/' do
10
13
  @host = env['HTTP_HOST']
@@ -6,9 +6,18 @@ require 'sinatra/sugar'
6
6
  module Sinatra
7
7
 
8
8
  get '/sinatra_auto_reload' do
9
- [Dir.glob("*"),
10
- Dir.glob("*/*"),
11
- Dir.glob("*/*/*")].flatten.map{|f| File::mtime(f).to_i}.sort.last.to_s;
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: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - shokai