oasis 0.3.0 → 0.3.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/VERSION +1 -1
- data/lib/oasis.rb +10 -7
- data/lib/oasis/app/list.rb +4 -3
- data/lib/oasis/app/loader.rb +3 -1
- data/oasis.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/oasis.rb
CHANGED
@@ -3,20 +3,23 @@ require "#{path}/oasis/debug"
|
|
3
3
|
require "#{path}/oasis/app/loader"
|
4
4
|
require "#{path}/oasis/dependencies"
|
5
5
|
|
6
|
-
# extend the routing system, if its loaded.
|
7
6
|
require "#{path}/oasis/routes" if defined? ActionController::Routing
|
8
|
-
# extend the layout system, if its loaded.
|
9
7
|
require "#{path}/oasis/layout" if defined? ActionController::Layout
|
10
8
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
# this block of code is responsible for making sure that
|
10
|
+
# while in development mode, Rails will treat anything it
|
11
|
+
# considers a "rails engine", will completely reload everything in app/ and lib/
|
12
|
+
# within itself.
|
13
|
+
if defined? Rails && RAILS_ENV == "development"
|
14
|
+
Rails.configuration.after_initialize do
|
15
|
+
app_names = Oasis.apps.collect { |app| Regexp.escape(app.name) }.join("|")
|
16
|
+
load_once_paths = ActiveSupport::Dependencies.load_once_paths.dup.reject { |path| path =~ /\/#{app_names}\// }
|
17
|
+
ActiveSupport::Dependencies.load_once_paths = load_once_paths
|
15
18
|
end
|
16
19
|
end
|
17
20
|
|
18
21
|
module Oasis
|
19
|
-
#
|
22
|
+
# an array of all loaded rails engines, that Oasis can know about.
|
20
23
|
mattr_accessor :apps
|
21
24
|
self.apps = Oasis::App::List.new
|
22
25
|
end
|
data/lib/oasis/app/list.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# this code was taken from the now dead Rails Engines project.
|
2
|
+
# thanks to everyone who contributed this!
|
1
3
|
module Oasis
|
2
4
|
module App
|
3
5
|
class List < Array
|
4
6
|
# Finds plugins with the set with the given name (accepts Strings or Symbols), or
|
5
|
-
# index. So,
|
7
|
+
# index. So, Oasis.apps[0] returns the first-loaded Plugin, and Oasis.apps[:engines]
|
6
8
|
# returns the Plugin instance for the engines plugin itself.
|
7
9
|
def [](name_or_index)
|
8
10
|
if name_or_index.is_a?(Fixnum)
|
@@ -12,8 +14,7 @@ module Oasis
|
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
15
|
-
# Go through each plugin, highest priority first (last loaded first).
|
16
|
-
# this is like <tt>Engines.plugins.reverse</tt>
|
17
|
+
# Go through each plugin, highest priority first (last loaded first).
|
17
18
|
def by_precedence
|
18
19
|
reverse
|
19
20
|
end
|
data/lib/oasis/app/loader.rb
CHANGED
@@ -2,10 +2,12 @@ module Oasis
|
|
2
2
|
module App
|
3
3
|
module Loader
|
4
4
|
|
5
|
+
# this is used to capture and record when a plugin has been
|
6
|
+
# loaded that Rails has decided is a rails engine.
|
5
7
|
def register_plugin_as_loaded_with_oasis(plugin)
|
6
8
|
register_plugin_as_loaded_without_oasis(plugin)
|
7
9
|
Oasis.apps << plugin if plugin.engine?
|
8
|
-
Oasis::Debug.log "
|
10
|
+
Oasis::Debug.log "Loading Rails App: #{plugin.name}"
|
9
11
|
end
|
10
12
|
|
11
13
|
def self.included(base)
|
data/oasis.gemspec
CHANGED