oasis 0.3.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,9 +1,14 @@
1
+ $: << File.join(File.dirname(__FILE__), 'lib')
2
+ require 'oasis/version'
3
+
1
4
  require 'rubygems'
2
5
  require 'rake'
3
6
 
7
+
4
8
  begin
5
9
  require 'jeweler'
6
10
  Jeweler::Tasks.new do |gem|
11
+ gem.version = Oasis::VERSION
7
12
  gem.name = "oasis"
8
13
  gem.summary = %Q{a collection of enhancements for rails engines.}
9
14
  gem.description = %Q{a collection of enhancements for rails engines. Designed to work with Rails 2.3.}
data/lib/oasis.rb CHANGED
@@ -1,25 +1,16 @@
1
- path = File.dirname(__FILE__)
2
- require "#{path}/oasis/debug"
3
- require "#{path}/oasis/app/loader"
4
- require "#{path}/oasis/dependencies"
1
+ require 'active_support/core_ext/module'
2
+ require "oasis/version"
3
+ require "oasis/debug"
4
+ require "oasis/app/list"
5
+ require "oasis/app/loader"
6
+ require "oasis/dependencies"
7
+ require "oasis/development"
5
8
 
6
- require "#{path}/oasis/routes" if defined? ActionController::Routing
7
- require "#{path}/oasis/layout" if defined? ActionController::Layout
8
-
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
18
- end
19
- end
9
+ require "oasis/routes" if defined? ActionController::Routing
10
+ require "oasis/layout" if defined? ActionController::Layout
20
11
 
21
12
  module Oasis
22
13
  # an array of all loaded rails engines, that Oasis can know about.
23
14
  mattr_accessor :apps
24
15
  self.apps = Oasis::App::List.new
25
- end
16
+ end
@@ -19,5 +19,4 @@ module Oasis
19
19
  end
20
20
  end
21
21
  end
22
-
23
- Rails::Plugin::Loader.send :include, Oasis::App::Loader
22
+ Rails::Plugin::Loader.send :include, Oasis::App::Loader if defined? Rails
@@ -6,6 +6,7 @@ module Oasis
6
6
  module Dependencies
7
7
 
8
8
  def require_or_load(file_name, const_path=nil)
9
+ super(file_name, const_path) unless defined? RAILS_ROOT
9
10
  file_loaded = false
10
11
  # only look for controller and helper files.
11
12
  %w(controller helper).each do |file_type|
@@ -0,0 +1,17 @@
1
+ module Oasis
2
+ module Development
3
+ extend self
4
+ # this block of code is responsible for making sure that
5
+ # while in development mode, Rails will treat anything it
6
+ # considers a "rails engine", will completely reload everything in app/ and lib/
7
+ # within itself.
8
+ def configure!(config = nil)
9
+ config ||= Rails.configuration if defined? Rails
10
+ config.after_initialize do
11
+ app_names = Oasis.apps.collect { |app| Regexp.escape(app.name) }.join("|")
12
+ load_once_paths = ActiveSupport::Dependencies.load_once_paths.dup.reject { |path| path =~ /\/#{app_names}\// }
13
+ ActiveSupport::Dependencies.load_once_paths = load_once_paths
14
+ end
15
+ end
16
+ end
17
+ end
data/lib/oasis/loader.rb CHANGED
@@ -36,9 +36,10 @@ module Oasis
36
36
  paths << #{name}_path if has_#{name}_directory? # paths << cells_path if has_cells_directory?
37
37
  paths # paths
38
38
  end # end
39
- alias_method_chain :load_paths, :#{name} # alias_method_chain :load_paths, :cells
39
+ alias_method :load_paths_without_#{name}, :load_paths
40
+ alias_method :load_paths, :load_paths_with_#{name}
40
41
  EOS
41
- end
42
+ end
42
43
  end
43
- end
44
+ end
44
45
  end
@@ -0,0 +1,3 @@
1
+ module Oasis
2
+ VERSION = "0.4.1"
3
+ end
data/test/helper.rb CHANGED
@@ -7,6 +7,19 @@ require 'redgreen' rescue nil
7
7
 
8
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  $LOAD_PATH.unshift(File.dirname(__FILE__))
10
+
11
+ RAILS_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
12
+ unless defined?(Rails)
13
+ module Rails
14
+ class Plugin
15
+ class Loader
16
+ def register_plugin_as_loaded
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+
10
23
  require 'oasis'
11
24
 
12
25
  # silence the logger, or define a new path for logging.
@@ -18,5 +31,6 @@ module Oasis
18
31
  end
19
32
  end
20
33
 
34
+
21
35
  class Test::Unit::TestCase
22
36
  end
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.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Perez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-29 00:00:00 -08:00
13
+ date: 2009-12-30 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -38,15 +38,16 @@ files:
38
38
  - LICENSE
39
39
  - README.rdoc
40
40
  - Rakefile
41
- - VERSION
42
41
  - lib/oasis.rb
43
42
  - lib/oasis/app/list.rb
44
43
  - lib/oasis/app/loader.rb
45
44
  - lib/oasis/debug.rb
46
45
  - lib/oasis/dependencies.rb
46
+ - lib/oasis/development.rb
47
47
  - lib/oasis/layout.rb
48
48
  - lib/oasis/loader.rb
49
49
  - lib/oasis/routes.rb
50
+ - lib/oasis/version.rb
50
51
  - oasis.gemspec
51
52
  - test/fixtures/layout_tests/views/layouts/default_layout.html.erb
52
53
  - test/fixtures/layout_tests/views/layouts/fancy_products.html.erb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.1