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 CHANGED
@@ -13,3 +13,5 @@ test/dummy*/vendor/bundle/
13
13
 
14
14
  test/dummy310rc6/app/controllers/root_controller.rb
15
15
  test/dummy3010/app/controllers/root_controller.rb
16
+ test/dummy310rc6/log/dependencies/
17
+ test/dummy3010/log/
@@ -19,5 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_development_dependency "rake"
22
+ s.add_development_dependency "active_support"
22
23
  s.add_development_dependency "bbq"
23
24
  end
@@ -84,6 +84,7 @@ module ActiveReload
84
84
  @replaced = proc_collection.pop
85
85
  if rails31?
86
86
  proc_source.to_prepare(&new)
87
+ proc_source.__define_runner(:cleanup)
87
88
  else
88
89
  proc_source.before(&new)
89
90
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveReload
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -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'))
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '3.1.0.rc6'
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'))
@@ -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.0
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-08-23 00:00:00.000000000 +02:00
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: &76816250 !ruby/object:Gem::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: *76816250
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: &76815770 !ruby/object:Gem::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: *76815770
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: 819203987
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: 819203987
180
+ hash: 303634081
170
181
  requirements: []
171
182
  rubyforge_project: active_reload
172
183
  rubygems_version: 1.6.2