oasis 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
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
- if defined? Rails
12
- # this makes rails reload the models, controllers, etc. inside of a Rails Engine.
13
- Rails.configuration.after_initialize do
14
- ActiveSupport::Dependencies.load_once_paths = ActiveSupport::Dependencies.load_once_paths.select { |path| (path =~ /app/).nil? }
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
- # The set of all loaded plugins
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
@@ -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, Engines.plugins[0] returns the first-loaded Plugin, and Engines.plugins[:engines]
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). Effectively,
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
@@ -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 "**** Loading App: #{plugin.name}"
10
+ Oasis::Debug.log "Loading Rails App: #{plugin.name}"
9
11
  end
10
12
 
11
13
  def self.included(base)
data/oasis.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{oasis}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Derek Perez", "Chris Eppstein"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oasis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Perez