activeadmin 0.3.2 → 0.3.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.
Potentially problematic release.
This version of activeadmin might be problematic. Click here for more details.
- data/CHANGELOG.md +14 -0
- data/features/support/env.rb +9 -3
- data/lib/active_admin/application.rb +1 -1
- data/lib/active_admin/reloader.rb +7 -2
- data/lib/active_admin/version.rb +1 -1
- data/spec/unit/reloader_spec.rb +12 -4
- metadata +5 -4
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
Nothing yet
|
4
4
|
|
5
|
+
## 0.3.3
|
6
|
+
|
7
|
+
1 commit by 1 author
|
8
|
+
|
9
|
+
### Enhancements
|
10
|
+
|
11
|
+
* Only reload Active Admin when files in the load paths have changed. This is a
|
12
|
+
major speed increase in development mode. Also helps with memory consumption
|
13
|
+
because we aren't reloading Active admin all the time.
|
14
|
+
|
15
|
+
### Contributors
|
16
|
+
|
17
|
+
* Greg Bell
|
18
|
+
|
5
19
|
## 0.3.2
|
6
20
|
|
7
21
|
45 commits by 15 contributors
|
data/features/support/env.rb
CHANGED
@@ -9,18 +9,24 @@ ENV['BUNDLE_GEMFILE'] = File.expand_path('../../../Gemfile', __FILE__)
|
|
9
9
|
require File.expand_path('../../../spec/support/detect_rails_version', __FILE__)
|
10
10
|
ENV["RAILS"] = detect_rails_version
|
11
11
|
|
12
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
13
|
+
ENV['RAILS_ROOT'] = File.expand_path("../../../spec/rails/rails-#{ENV["RAILS"]}", __FILE__)
|
14
|
+
|
15
|
+
|
12
16
|
require 'rubygems'
|
13
17
|
require "bundler"
|
14
18
|
Bundler.setup
|
15
19
|
|
16
|
-
ENV["RAILS_ENV"] ||= "cucumber"
|
17
|
-
ENV['RAILS_ROOT'] = File.expand_path("../../../spec/rails/rails-#{ENV["RAILS"]}", __FILE__)
|
18
|
-
|
19
20
|
# Create the test app if it doesn't exists
|
20
21
|
unless File.exists?(ENV['RAILS_ROOT'])
|
21
22
|
system 'rake setup'
|
22
23
|
end
|
23
24
|
|
25
|
+
# Ensure the Active Admin load path is happy
|
26
|
+
require 'rails'
|
27
|
+
require 'active_admin'
|
28
|
+
ActiveAdmin.application.load_paths = [ENV['RAILS_ROOT'] + "/app/admin"]
|
29
|
+
|
24
30
|
require ENV['RAILS_ROOT'] + '/config/environment'
|
25
31
|
|
26
32
|
# Setup autoloading of ActiveAdmin and the load path
|
@@ -6,16 +6,21 @@ module ActiveAdmin
|
|
6
6
|
# @param [String] rails_version
|
7
7
|
# The version of Rails we're using. We use this to switch between
|
8
8
|
# the correcr Rails reloader class.
|
9
|
-
def initialize(rails_version)
|
9
|
+
def initialize(app, rails_version)
|
10
|
+
@app = app
|
10
11
|
@rails_version = rails_version.to_s
|
11
12
|
end
|
12
13
|
|
13
14
|
# Attach to Rails and perform the reload on each request.
|
14
15
|
def attach!
|
15
|
-
|
16
|
+
file_update_checker = ActiveSupport::FileUpdateChecker.new(@app.load_paths) do
|
16
17
|
ActiveAdmin.application.unload!
|
17
18
|
Rails.application.reload_routes!
|
18
19
|
end
|
20
|
+
|
21
|
+
reloader_class.to_prepare do
|
22
|
+
file_update_checker.execute_if_updated
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def reloader_class
|
data/lib/active_admin/version.rb
CHANGED
data/spec/unit/reloader_spec.rb
CHANGED
@@ -4,25 +4,33 @@ require 'spec_helper'
|
|
4
4
|
begin
|
5
5
|
ActionDispatch::Reloader
|
6
6
|
rescue
|
7
|
-
module ActionDispatch; module Reloader; end; end
|
7
|
+
module ActionDispatch; module Reloader; def self.to_prepare; end; end; end
|
8
8
|
end
|
9
9
|
|
10
10
|
begin
|
11
11
|
ActionDispatch::Callbacks
|
12
12
|
rescue
|
13
|
-
module ActionDispatch; module Callbacks; end; end
|
13
|
+
module ActionDispatch; module Callbacks; def self.to_prepare; end; end; end
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
17
|
describe ActiveAdmin::Reloader do
|
18
18
|
|
19
|
+
let(:mock_app){ mock(:load_paths => []) }
|
20
|
+
|
19
21
|
it "should use ActionDispatch::Reloader if rails 3.1" do
|
20
|
-
reloader = ActiveAdmin::Reloader.new '3.1.0'
|
22
|
+
reloader = ActiveAdmin::Reloader.new mock_app, '3.1.0'
|
21
23
|
reloader.reloader_class.should == ActionDispatch::Reloader
|
22
24
|
end
|
23
25
|
|
24
26
|
it "should use ActionDispatch::Callbacks if rails 3.0" do
|
25
|
-
reloader = ActiveAdmin::Reloader.new '3.0.0'
|
27
|
+
reloader = ActiveAdmin::Reloader.new mock_app, '3.0.0'
|
26
28
|
reloader.reloader_class.should == ActionDispatch::Callbacks
|
27
29
|
end
|
30
|
+
|
31
|
+
it "should initialize a new file update checker" do
|
32
|
+
ActiveSupport::FileUpdateChecker.should_receive(:new).with(mock_app.load_paths).and_return(mock(:execute_if_updated => true))
|
33
|
+
ActiveAdmin::Reloader.new(mock_app, '3.1.0').attach!
|
34
|
+
end
|
35
|
+
|
28
36
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 3
|
10
|
+
version: 0.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Greg Bell
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-29 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -642,3 +642,4 @@ test_files:
|
|
642
642
|
- spec/unit/views/components/table_for_spec.rb
|
643
643
|
- spec/unit/views/pages/layout_spec.rb
|
644
644
|
- spec/unit/views/tabbed_navigation_spec.rb
|
645
|
+
has_rdoc:
|