aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/CHANGELOG11
-rw-r--r--railties/Rakefile2
-rw-r--r--railties/environments/shared.rb7
-rw-r--r--railties/environments/shared_for_gem.rb7
-rw-r--r--railties/lib/rails_generator/generators/applications/app/app_generator.rb1
5 files changed, 27 insertions, 1 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 2182dbc716..2dbfefa6f7 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,5 +1,16 @@
*SVN*
+* Added support for independent components residing in /components. Example:
+
+ Controller: components/list/items_controller.rb
+ (holds a List::ItemsController class with uses_component_template_root called)
+
+ Model : components/list/item.rb
+ (namespace is still shared, so an Item model in app/models will take precedence)
+
+ Views : components/list/items/show.rhtml
+
+
* Added --sandbox option to script/console that'll roll back all changes made to the database when you quit #672 [bitsweat]
* Added 'recent' as a rake target that'll run tests for files that changed in the last 10 minutes #612 [bitsweat]
diff --git a/railties/Rakefile b/railties/Rakefile
index 51165c263c..0acb2909ba 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -14,7 +14,7 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
-BASE_DIRS = %w( app config/environments db doc log lib public script test vendor )
+BASE_DIRS = %w( app config/environments components db doc log lib public script test vendor )
APP_DIRS = %w( apis models controllers helpers views views/layouts )
PUBLIC_DIRS = %w( images javascripts stylesheets _doc )
TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/testing )
diff --git a/railties/environments/shared.rb b/railties/environments/shared.rb
index 120ac08b2b..2e4e4ade13 100644
--- a/railties/environments/shared.rb
+++ b/railties/environments/shared.rb
@@ -7,6 +7,7 @@ ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
# Then model subdirectories.
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
+ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
# Followed by the standard includes.
ADDITIONAL_LOAD_PATHS.concat %w(
@@ -16,6 +17,7 @@ ADDITIONAL_LOAD_PATHS.concat %w(
app/helpers
app/apis
config
+ components
lib
vendor
vendor/railties
@@ -61,4 +63,9 @@ end
[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
ActionController::Routing::Routes.reload
+Controllers = Dependencies::LoadingModule.root(
+ File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')),
+ File.expand_path(File.join(RAILS_ROOT, 'components'))
+)
+
# Include your app's configuration here:
diff --git a/railties/environments/shared_for_gem.rb b/railties/environments/shared_for_gem.rb
index dc424aa6b3..ee77e3341a 100644
--- a/railties/environments/shared_for_gem.rb
+++ b/railties/environments/shared_for_gem.rb
@@ -7,6 +7,7 @@ ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"]
# Then model subdirectories.
ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"])
+ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"])
# Followed by the standard includes.
ADDITIONAL_LOAD_PATHS.concat %w(
@@ -16,6 +17,7 @@ ADDITIONAL_LOAD_PATHS.concat %w(
app/helpers
app/apis
config
+ components
lib
vendor
).map { |dir| "#{RAILS_ROOT}/#{dir}" }
@@ -56,4 +58,9 @@ end
[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
ActionController::Routing::Routes.reload
+Controllers = Dependencies::LoadingModule.root(
+ File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')),
+ File.expand_path(File.join(RAILS_ROOT, 'components'))
+)
+
# Include your app's configuration here:
diff --git a/railties/lib/rails_generator/generators/applications/app/app_generator.rb b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
index 8bdc6db86b..a8f1778f02 100644
--- a/railties/lib/rails_generator/generators/applications/app/app_generator.rb
+++ b/railties/lib/rails_generator/generators/applications/app/app_generator.rb
@@ -102,6 +102,7 @@ class AppGenerator < Rails::Generator::Base
app/models
app/views/layouts
config/environments
+ components
db
doc
lib