active_reload 0.2.0 → 0.3.0
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 +7 -0
- data/lib/active_reload.rb +22 -2
- data/lib/active_reload/version.rb +1 -1
- data/test/dummy310rc4/app/controllers/empty_controller.rb +5 -0
- data/test/dummy310rc4/config/initializers/session_store.rb +1 -1
- data/test/dummy310rc4/config/initializers/wrap_parameters.rb +1 -1
- data/test/unit/reload_test.rb +15 -1
- metadata +12 -9
data/README.md
CHANGED
@@ -15,6 +15,13 @@ up to a big value. It means that after change first request in development mode
|
|
15
15
|
and take as much time as it takes without this gem but subsequent request will be faster until next
|
16
16
|
changes due to lack of code reloading.
|
17
17
|
|
18
|
+
## It works for you so you want to thank? There are many options:
|
19
|
+
|
20
|
+
* Meet me at wroc_love.rb conference : http://wrocloverb.com/ and buy me a beer.
|
21
|
+
* Tweet about the gem
|
22
|
+
* Tell you friends to try it
|
23
|
+
* Donate
|
24
|
+
|
18
25
|
## Y U NO BELIEVE ?
|
19
26
|
|
20
27
|
Watch these videos for comparison:
|
data/lib/active_reload.rb
CHANGED
@@ -8,6 +8,26 @@ module ActiveReload
|
|
8
8
|
end
|
9
9
|
end # Railtie
|
10
10
|
|
11
|
+
module ProcInspector
|
12
|
+
if RUBY_VERSION.start_with?("1.8")
|
13
|
+
# Proc#source_location is not available in Ruby 1.8
|
14
|
+
def source_file
|
15
|
+
# Extract from format like this: "#<Proc:0xb750a994@/home/rupert/.rvm/gems/ruby-1.8.7-p174/gems/activerecord-3.0.9/lib/active_record/railtie.rb:74>"
|
16
|
+
to_s.match(/.*@(.*):[0-9]+>/)[1]
|
17
|
+
end
|
18
|
+
else
|
19
|
+
def source_file
|
20
|
+
# ActionDispatch::Callbacks._call_callbacks.last.raw_filter.source_location
|
21
|
+
# => ["/home/rupert/.rvm/gems/ruby-1.9.2-p180-fastrequire/gems/activerecord-3.0.9/lib/active_record/railtie.rb", 74]
|
22
|
+
source_location.first
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def source?(file)
|
27
|
+
source_file.match( Regexp.new(file) )
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
11
31
|
def self.replace?
|
12
32
|
!Rails.application.config.cache_classes && replace_proc?(proc_collection.last)
|
13
33
|
end
|
@@ -30,8 +50,8 @@ module ActiveReload
|
|
30
50
|
|
31
51
|
def self.replace_proc?(last)
|
32
52
|
last.respond_to?(:raw_filter) &&
|
33
|
-
|
34
|
-
|
53
|
+
last.raw_filter.is_a?(Proc) &&
|
54
|
+
last.raw_filter.extend(ProcInspector).source?("railties.*/lib/rails/application/bootstrap.rb")
|
35
55
|
end
|
36
56
|
|
37
57
|
def self.replace!
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
2
2
|
|
3
|
-
Dummy310rc4::Application.config.session_store :cookie_store, key
|
3
|
+
Dummy310rc4::Application.config.session_store :cookie_store, :key => '_dummy310rc4_session'
|
4
4
|
|
5
5
|
# Use the database for sessions instead of the cookie-based default,
|
6
6
|
# which shouldn't be used to store highly confidential information
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# is enabled by default.
|
5
5
|
|
6
6
|
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActionController::Base.wrap_parameters format
|
7
|
+
ActionController::Base.wrap_parameters :format => [:json]
|
8
8
|
|
9
9
|
# Disable root element in JSON by default.
|
10
10
|
if defined?(ActiveRecord)
|
data/test/unit/reload_test.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'test/unit'
|
2
|
+
require 'rubygems'
|
2
3
|
require 'bbq/test'
|
3
4
|
require 'pathname'
|
4
5
|
require 'socket'
|
5
6
|
require 'timeout'
|
7
|
+
require 'fileutils'
|
6
8
|
|
7
9
|
module FileCommandHelper
|
8
10
|
def create_file(path, content)
|
@@ -19,6 +21,15 @@ module FileCommandHelper
|
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
24
|
+
#module Sleepy
|
25
|
+
# def visit(path)
|
26
|
+
# super.tap{
|
27
|
+
# puts path
|
28
|
+
# sleep(5)
|
29
|
+
# }
|
30
|
+
# end
|
31
|
+
#end
|
32
|
+
|
22
33
|
class ReloadTest < Bbq::TestCase
|
23
34
|
include FileCommandHelper
|
24
35
|
|
@@ -43,14 +54,17 @@ class ReloadTest < Bbq::TestCase
|
|
43
54
|
pid = fork do
|
44
55
|
Dir.chdir(app_root)
|
45
56
|
ENV['BUNDLE_GEMFILE'] = app_gemfile
|
57
|
+
#puts ENV['BUNDLE_GEMFILE']
|
46
58
|
#puts `bundle install --path #{app_vendor}` # Why it does not work ?
|
47
|
-
puts `bundle install --system`
|
59
|
+
#puts `bundle install --system` # This does not sometimes work well too...
|
48
60
|
`bundle exec rails s --port #{app_port}`
|
49
61
|
end
|
50
62
|
|
51
63
|
wait_for_rails(app_port)
|
52
64
|
Capybara.app_host = "http://localhost:#{app_port}"
|
53
65
|
user = Bbq::TestUser.new(:driver => :selenium)
|
66
|
+
#user.extend(Sleepy)
|
67
|
+
# VITODO: user.visit('/rails/version') && user.see!(...)
|
54
68
|
user.visit('/const/RootController') # RootController not loaded
|
55
69
|
user.see!('nil')
|
56
70
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_reload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-07-
|
12
|
+
date: 2011-07-23 00:00:00.000000000 +02:00
|
13
|
+
default_executable:
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: rake
|
16
|
-
requirement: &
|
17
|
+
requirement: &74053820 !ruby/object:Gem::Requirement
|
17
18
|
none: false
|
18
19
|
requirements:
|
19
20
|
- - ! '>='
|
@@ -21,10 +22,10 @@ dependencies:
|
|
21
22
|
version: '0'
|
22
23
|
type: :development
|
23
24
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
+
version_requirements: *74053820
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: bbq
|
27
|
-
requirement: &
|
28
|
+
requirement: &74053610 !ruby/object:Gem::Requirement
|
28
29
|
none: false
|
29
30
|
requirements:
|
30
31
|
- - ! '>='
|
@@ -32,7 +33,7 @@ dependencies:
|
|
32
33
|
version: '0'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
+
version_requirements: *74053610
|
36
37
|
description: Reload Rails code in development mode only when change is deteced
|
37
38
|
email:
|
38
39
|
- robert.pankowecki@gmail.com
|
@@ -99,6 +100,7 @@ files:
|
|
99
100
|
- test/dummy310rc4/app/assets/javascripts/application.js
|
100
101
|
- test/dummy310rc4/app/assets/stylesheets/application.css
|
101
102
|
- test/dummy310rc4/app/controllers/application_controller.rb
|
103
|
+
- test/dummy310rc4/app/controllers/empty_controller.rb
|
102
104
|
- test/dummy310rc4/app/helpers/application_helper.rb
|
103
105
|
- test/dummy310rc4/app/mailers/.gitkeep
|
104
106
|
- test/dummy310rc4/app/models/.gitkeep
|
@@ -140,6 +142,7 @@ files:
|
|
140
142
|
- test/dummy310rc4/vendor/plugins/.gitkeep
|
141
143
|
- test/support/defined_middleware.rb
|
142
144
|
- test/unit/reload_test.rb
|
145
|
+
has_rdoc: true
|
143
146
|
homepage: https://github.com/paneq/active_reload
|
144
147
|
licenses: []
|
145
148
|
post_install_message:
|
@@ -154,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
157
|
version: '0'
|
155
158
|
segments:
|
156
159
|
- 0
|
157
|
-
hash:
|
160
|
+
hash: 916816691
|
158
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
162
|
none: false
|
160
163
|
requirements:
|
@@ -163,10 +166,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
166
|
version: '0'
|
164
167
|
segments:
|
165
168
|
- 0
|
166
|
-
hash:
|
169
|
+
hash: 916816691
|
167
170
|
requirements: []
|
168
171
|
rubyforge_project: active_reload
|
169
|
-
rubygems_version: 1.
|
172
|
+
rubygems_version: 1.6.2
|
170
173
|
signing_key:
|
171
174
|
specification_version: 3
|
172
175
|
summary: Reload Rails code in development mode only when change is deteced
|