require_reloader 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +15 -24
- data/Rakefile +7 -0
- data/lib/require_reloader/version.rb +1 -1
- data/lib/require_reloader.rb +3 -0
- data/require_reloader.gemspec +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# RequireReloader
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/require_reloader)
|
4
|
+
|
3
5
|
Auto-reload `require` files or local gems without restarting server
|
4
6
|
during Rails development.
|
5
7
|
|
@@ -7,18 +9,18 @@ Currently, it supports Rails 3+ and above, including 3.1 and 3.2.
|
|
7
9
|
|
8
10
|
It uses `ActionDispatch::Callbacks.to_prepare` to reload the
|
9
11
|
`require` files before each request. In Rails 3.2, it uses
|
10
|
-
`watchable_dirs` to reload only when you modify a file.
|
12
|
+
`watchable_dirs` to reload only when you modify a file. More details in [this blog post](http://teohm.github.com/blog/2013/01/10/reload-required-files-in-rails/).
|
11
13
|
|
12
14
|
## Usage
|
13
15
|
|
14
|
-
|
15
|
-
attributes):
|
16
|
+
Given a `Gemfile`
|
16
17
|
|
17
18
|
# Gemfile
|
18
|
-
..
|
19
19
|
gem 'my_gem', :path => '~/work/my_gem'
|
20
20
|
gem 'my_gem2', :path => '~/fun/my_gem2'
|
21
21
|
|
22
|
+
To reload all **local gems** (the ones with `:path` attribute,
|
23
|
+
or using [local git repo](http://gembundler.com/v1.2/git.html#local)):
|
22
24
|
|
23
25
|
# config/environments/development.rb
|
24
26
|
YourApp::Application.configure do
|
@@ -26,27 +28,18 @@ attributes):
|
|
26
28
|
RequireReloader.watch_local_gems!
|
27
29
|
end
|
28
30
|
|
29
|
-
To reload a local gem
|
31
|
+
To reload a specific local gem:
|
30
32
|
|
31
|
-
|
32
|
-
YourApp::Application.configure do
|
33
|
-
...
|
34
|
-
RequireReloader.watch :my_gem
|
35
|
-
end
|
33
|
+
RequireReloader.watch :my_gem
|
36
34
|
|
37
|
-
You can also reload a `.rb` file in `lib
|
35
|
+
You can also **reload a `.rb` file in `lib`** or any directory:
|
38
36
|
|
39
|
-
#
|
40
|
-
|
41
|
-
...
|
42
|
-
RequireReloader.watch :half_baked_gem # in lib/
|
43
|
-
RequireReloader.watch :foo, :path => 'app/models'
|
44
|
-
end
|
37
|
+
RequireReloader.watch :half_baked_gem # in lib dir
|
38
|
+
RequireReloader.watch :foo, :path => 'app/models'
|
45
39
|
|
46
|
-
`:path` option is
|
47
|
-
|
48
|
-
`lib` and `vendor/gems` into `watchable_dirs`. So,
|
49
|
-
specify `:path` if the file is located in other directory.
|
40
|
+
The `:path` option is *optional*. In **Rails 3.2**, `:path` value is added into `watchable_dirs`. Rails 3.1 and 3.0 ignore this value.
|
41
|
+
|
42
|
+
RequireReloader adds `lib` and `vendor/gems` into `watchable_dirs`. So, specify `:path` only if the file is located in other directory.
|
50
43
|
|
51
44
|
|
52
45
|
## Installation
|
@@ -59,9 +52,6 @@ And then execute:
|
|
59
52
|
|
60
53
|
$ bundle
|
61
54
|
|
62
|
-
Or install it yourself as:
|
63
|
-
|
64
|
-
$ gem install require_reloader
|
65
55
|
|
66
56
|
## Contributing
|
67
57
|
|
@@ -78,6 +68,7 @@ This gem is forked from Colin Young's [gem_reloader](https://github.com/colinyou
|
|
78
68
|
|
79
69
|
## Changelog
|
80
70
|
|
71
|
+
- v0.1.3: Skip reload local gem if it's itself; added integration tests.
|
81
72
|
- v0.1.2: Minor rephrase on gem's description and summary.
|
82
73
|
- v0.1.1: Use Bundler to fetch local gems info, instead of parsing Gemfile by hand.
|
83
74
|
- v0.1.0: Forked colinyoung/gem_reloader, renamed & major rewrite to support Rails 3.2 and new features.
|
data/Rakefile
CHANGED
@@ -1,2 +1,9 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
+
|
4
|
+
desc "run all integration tests"
|
5
|
+
task :test do
|
6
|
+
system "cd test/resources/rails32-app; bundle exec rake test:integration; cd -"
|
7
|
+
system "cd test/resources/rails31-app; bundle exec rake test:integration; cd -"
|
8
|
+
system "cd test/resources/rails30-app; bundle exec rake test:integration; cd -"
|
9
|
+
end
|
data/lib/require_reloader.rb
CHANGED
data/require_reloader.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{Auto-reload require files or local gems without restarting Rails server.}
|
9
9
|
gem.homepage = "https://github.com/teohm/require_reloader"
|
10
10
|
|
11
|
-
gem.files = `git ls-files`.split($\)
|
11
|
+
gem.files = `git ls-files`.split($\).reject{|f| f =~ /^test/}
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
13
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
14
|
gem.name = "require_reloader"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: require_reloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-01-
|
13
|
+
date: 2013-01-16 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Auto-reload require files or local gems without restarting server during
|
16
16
|
Rails development.
|