active_reload 0.6.0 → 0.6.1
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/.gitignore +2 -0
- data/active_reload.gemspec +1 -0
- data/lib/active_reload.rb +1 -0
- data/lib/active_reload/version.rb +1 -1
- data/test/dummy3010/config/environments/development.rb +23 -1
- data/test/dummy310rc6/Gemfile +2 -2
- data/test/dummy310rc6/config/environments/development.rb +9 -1
- data/test/unit/reload_test.rb +6 -0
- metadata +19 -8
data/.gitignore
CHANGED
data/active_reload.gemspec
CHANGED
data/lib/active_reload.rb
CHANGED
@@ -26,4 +26,26 @@ Dummy3010::Application.configure do
|
|
26
26
|
config.action_dispatch.best_standards_support = :builtin
|
27
27
|
|
28
28
|
config.middleware.insert_after(ActionDispatch::Static, DefinedMiddleware)
|
29
|
-
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# http://railscasts.com/episodes/249-notifications-in-rails-3
|
32
|
+
ActiveSupport::Notifications.subscribe("active_support.dependencies.clear") do |*args|
|
33
|
+
msg = "Code reloaded!"
|
34
|
+
# Libnotify.show(:body => msg, :summary => Rails.application.class.name, :timeout => 2.5, :append => true) # https://github.com/splattael/libnotify
|
35
|
+
puts msg
|
36
|
+
Rails.logger.info(" --- #{msg} --- ")
|
37
|
+
end
|
38
|
+
|
39
|
+
ActiveSupport::Notifications.subscribe("active_reload.set_clear_dependencies_hook_replaced") do |*args|
|
40
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
41
|
+
msg = event.name
|
42
|
+
# Libnotify.show(:body => msg, :summary => Rails.application.class.name, :timeout => 2.5, :append => true) # https://github.com/splattael/libnotify
|
43
|
+
puts msg
|
44
|
+
Rails.logger.warn(" --- #{msg} --- ")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Log how dependencies (constants) are resolved automatically and when they are unloaded.
|
48
|
+
dependencies_logger_dir = File.join(Rails.root, 'log', 'dependencies')
|
49
|
+
FileUtils.mkpath(dependencies_logger_dir)
|
50
|
+
ActiveSupport::Dependencies.log_activity = true
|
51
|
+
ActiveSupport::Dependencies.logger = Logger.new(File.join(dependencies_logger_dir, Rails.env + '.log'))
|
data/test/dummy310rc6/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
gem 'rails', '3.1.0
|
3
|
+
gem 'rails', '3.1.0'
|
4
4
|
gem 'active_reload', :path => '../../../active_reload'
|
5
5
|
gem 'sqlite3'
|
6
6
|
|
@@ -9,4 +9,4 @@ gem 'sqlite3'
|
|
9
9
|
#gem 'coffee-script'
|
10
10
|
#gem 'uglifier'
|
11
11
|
|
12
|
-
gem 'jquery-rails'
|
12
|
+
gem 'jquery-rails'
|
@@ -34,6 +34,7 @@ end
|
|
34
34
|
ActiveSupport::Notifications.subscribe("active_support.dependencies.clear") do |*args|
|
35
35
|
msg = "Code reloaded!"
|
36
36
|
# Libnotify.show(:body => msg, :summary => Rails.application.class.name, :timeout => 2.5, :append => true) # https://github.com/splattael/libnotify
|
37
|
+
puts msg
|
37
38
|
Rails.logger.info(" --- #{msg} --- ")
|
38
39
|
end
|
39
40
|
|
@@ -41,5 +42,12 @@ ActiveSupport::Notifications.subscribe("active_reload.set_clear_dependencies_hoo
|
|
41
42
|
event = ActiveSupport::Notifications::Event.new(*args)
|
42
43
|
msg = event.name
|
43
44
|
# Libnotify.show(:body => msg, :summary => Rails.application.class.name, :timeout => 2.5, :append => true) # https://github.com/splattael/libnotify
|
45
|
+
puts msg
|
44
46
|
Rails.logger.warn(" --- #{msg} --- ")
|
45
|
-
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Log how dependencies (constants) are resolved automatically and when they are unloaded.
|
50
|
+
dependencies_logger_dir = File.join(Rails.root, 'log', 'dependencies')
|
51
|
+
FileUtils.mkpath(dependencies_logger_dir)
|
52
|
+
ActiveSupport::Dependencies.log_activity = true
|
53
|
+
ActiveSupport::Dependencies.logger = Logger.new(File.join(dependencies_logger_dir, Rails.env + '.log'))
|
data/test/unit/reload_test.rb
CHANGED
@@ -74,6 +74,12 @@ class ReloadTest < Bbq::TestCase
|
|
74
74
|
user.visit('/const/RootController')
|
75
75
|
user.see!('constant')
|
76
76
|
|
77
|
+
user.visit('/root') # load RootController
|
78
|
+
user.see!('first version') # in first version
|
79
|
+
|
80
|
+
user.visit('/const/RootController')
|
81
|
+
user.see!('constant')
|
82
|
+
|
77
83
|
user.visit('/empty') # rails would reload the code after /root request but we don't
|
78
84
|
user.visit('/const/RootController')
|
79
85
|
user.see!('constant') # so the constant RootController should be still defined
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-09 00:00:00.000000000 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &85328640 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,21 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *85328640
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: active_support
|
28
|
+
requirement: &85328140 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *85328140
|
26
37
|
- !ruby/object:Gem::Dependency
|
27
38
|
name: bbq
|
28
|
-
requirement: &
|
39
|
+
requirement: &85327730 !ruby/object:Gem::Requirement
|
29
40
|
none: false
|
30
41
|
requirements:
|
31
42
|
- - ! '>='
|
@@ -33,7 +44,7 @@ dependencies:
|
|
33
44
|
version: '0'
|
34
45
|
type: :development
|
35
46
|
prerelease: false
|
36
|
-
version_requirements: *
|
47
|
+
version_requirements: *85327730
|
37
48
|
description: Reload Rails code in development mode only when change is deteced
|
38
49
|
email:
|
39
50
|
- robert.pankowecki@gmail.com
|
@@ -157,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
168
|
version: '0'
|
158
169
|
segments:
|
159
170
|
- 0
|
160
|
-
hash:
|
171
|
+
hash: 303634081
|
161
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
173
|
none: false
|
163
174
|
requirements:
|
@@ -166,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
177
|
version: '0'
|
167
178
|
segments:
|
168
179
|
- 0
|
169
|
-
hash:
|
180
|
+
hash: 303634081
|
170
181
|
requirements: []
|
171
182
|
rubyforge_project: active_reload
|
172
183
|
rubygems_version: 1.6.2
|