Commit Graph

2448 Commits

Author SHA1 Message Date
Piotr Sarnacki
6648babded Allow running generators for Engine with usage of other application.
After that commit, developers can set ENGINE_PATH in ENGINE/scripts/rails
file and load application's ./script/rails (most of the time it will be
dummy application used for testing). When running ./script/rails g it will
use application to boot up, but then it will use Engine's root and
configuration for generators.
2010-09-30 09:47:06 +02:00
Piotr Sarnacki
f851352318 Added config.app_generators to allow configuring application's generators from railties.
With config.generators becomes a way to configure generators
for current instance only. For example:

module Blog
  class Engine < Rails::Engine
    config.generators do |g|
      g.orm :active_record
    end

    config.app_generators do |g|
      g.test_framework :rspec
    end
  end
end

such definition sets :active_record as orm for engine and :rspec
as test_framework for application. The values set with app_generators
can be overwritten in application using config.generators as you would
normally do:

module MyApp
  class Application < Rails::Application
    config.generators do |g|
      g.test_framework :test_unit
    end
  end
end
2010-09-30 09:47:06 +02:00
Piotr Sarnacki
57aa79e6be Move routes_reloader to a class: RoutesReloader 2010-09-30 09:47:06 +02:00
Piotr Sarnacki
ec5d846ac6 Properly reload routes defined in class definition
Sometimes it's easier to define routes inside Engine or
Application class definition (e.g. one file applications). The
problem with such case is that if there is a plugin that
has config/routes.rb file, it will trigger routes reload on application.
Since routes definition for application is not in config/routes.rb
file routes_reloader will fail to reload application's routes
properly. With this commit you can pass routes definition as a block
to routes method, which will allow to properly reload it:

class MyApp::Application < Rails::Application
  routes do
    resources :users
  end
end
2010-09-30 09:47:05 +02:00
Piotr Sarnacki
74598fe7e9 Do not overwrite _railtie method on namespace while creating isolated engine or application.
In order to run Engine as standalone application, you will need
Rails::Application instance in the same namespace that engine
one. It's very important to leave _railtie bound to whatever
used "namespace" method first.
2010-09-30 09:47:05 +02:00
Santiago Pastorino
006cef7107 Add gem 'arel' from git commented out as an example of how to Bundle egde Rails with Arel edge
[#5723 state:committed]
2010-09-29 00:14:48 -03:00
Carlos Antonio da Silva
7fc1edd790 Remove deprecated stuff in ActionController
This removes all deprecated classes in ActionController related to
Routing, Abstract Request/Response and Integration/IntegrationTest.
All tests and docs were changed to ActionDispatch instead of ActionController.
2010-09-26 02:13:45 +08:00
Piotr Sarnacki
0134c5cc94 Refactor a few methods connected with namespacing in Rails::Generators::NamedBase
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
51c7660e08 Add namespacing to mailer generator
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
7acf64a81b Add namespacing for observer generator
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
Piotr Sarnacki
49c3ad7f77 Add namespace for test_unit generators
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 17:28:10 +02:00
José Valim
e6d503bcfb Update abort message (ht: tilsammans). 2010-09-25 11:01:43 +02:00
Piotr Sarnacki
135d6164c5 Rails.application is set anyway, we don't need to set it manually, this was purpose of different behavior in tests and in application
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:46:22 +02:00
Piotr Sarnacki
00aa13bc0e Generators fix: properly check if module should be created when creating a namespaced model
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-25 10:46:22 +02:00
Piotr Sarnacki
bac0826b1f Refactor namespaced generators to use module_namespacing block helper
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 21:02:30 +02:00
Piotr Sarnacki
e83634081a Generators are not aware of namespace of isolated engines and applications
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 21:02:24 +02:00
Emilio Tagua
63039b9c33 Fix typo and add sanity test for code statistics rake task.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 15:51:29 +02:00
Fred Wu
51e8435e34 Ensures the app generator generates the correct @app_name. [#5434 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 13:10:26 +02:00
David Chelimsky
672ce11d68 only abort in test_help in production env
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-24 12:52:38 +02:00
Emilio Tagua
8cfc6012f4 Perf: speed up 2 methods in railties.
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-22 18:08:03 -03:00
Piotr Sarnacki
07411ca490 List all of isolated engine changes
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 23:55:27 +02:00
Piotr Sarnacki
dfac9b1404 Strengthen documantation on engine's migrations and seed data
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 10:41:12 +02:00
Piotr Sarnacki
d475de7e25 Add helper for loading seed data for engine and application
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-20 10:41:05 +02:00
Thiago Pradi
800bab79b3 Updating error message on ruby_version_check.rb
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 22:32:23 -07:00
rohit
fd53bc85e7 Send 'rails runner' help message to stdout instead of stderr.
[#5661 state:committed]

Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-19 16:45:29 -07:00
David Trasbo
e808224652 Remove existing migration when using 'rails generate model' with --force [#5526 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-18 21:22:29 +02:00
Krekoten' Marjan
d4fa120671 Move capture to Kernel. [#5641 state:resolved] 2010-09-18 20:49:36 +02:00
rohit
76266a8184 Fix output of 'rails runner --help' [#4249 state:open] 2010-09-18 20:49:33 +02:00
Carl Lerche
117daba18a Update Rails' built in routes to use RouteSet#append 2010-09-17 12:27:48 -07:00
Sparky
eeb3246991 Only add Rack::Cache to the middleware stack if config.action_controller.perform_caching is set. 2010-09-15 12:58:49 -07:00
Xavier Noria
dd6efe98b6 Merge remote branch 'docrails/master' 2010-09-14 20:07:29 +02:00
rohit
b59a8d42c3 Application settings are specified in application.rb and not environment.rb 2010-09-14 10:07:34 +05:30
Xavier Noria
0207bc7cc9 get csrf_meta_tag back to the generated layout in deference to existing printed material, chomp also the generated HTML to be faithful to the output before the refactor 2010-09-14 01:35:44 +02:00
wycats
254ab7d916 First pass at Rack::Cache 2010-09-13 16:06:03 -07:00
Xavier Noria
a87b92db7b revises implementation and documentation of csrf_meta_tags, and aliases csrf_meta_tag to it for backwards compatibilty 2010-09-11 11:05:00 +02:00
Piotr Sarnacki
497b6af881 Set default asset_path only for engine 2010-09-10 17:20:16 +02:00
ISHIKAWA Takayuki
816ea74c8e revision of typo: crytographically [#5566 state:resolved]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-09-07 11:03:37 -03:00
Piotr Sarnacki
32157a2dd2 Add documentation on serving assets from engine strategies
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 17:09:31 +02:00
Piotr Sarnacki
24d2d6726e Added task for creating symlinks to engines' public directories
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 14:38:36 +02:00
Carlos Antonio da Silva
7204bb0feb Remove deprecation warnings in railties
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 13:38:12 +02:00
Piotr Sarnacki
e6b93fa6db Removed deprecated router API from railties 2010-09-05 13:44:37 +02:00
José Valim
f9c21ce658 Remove more deprecated behavior from plugins. 2010-09-04 01:11:22 +02:00
José Valim
6f194bb3a9 Small tidy up on Rails::Engine. 2010-09-04 00:52:07 +02:00
Piotr Sarnacki
9af189ac8f I've changed that test along the way, it should actually stay without changes 2010-09-03 22:59:16 +02:00
Piotr Sarnacki
6c906bf591 Use default_scope in isolated Engines to not force user to scope his routes 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
b43b686b02 engines_blank_point should always be the last initializer in Engine 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
a5e509d6b1 We should avoid creating additional initializers when we can, adding them makes boot process slower 2010-09-03 22:59:15 +02:00
Piotr Sarnacki
34cd8a68b1 Add some more docs on polymorphic_url with routes proxy 2010-09-03 22:59:14 +02:00
Piotr Sarnacki
e35c2043b1 Include all helpers from non-namespaced engines 2010-09-03 22:59:13 +02:00
Piotr Sarnacki
8284fd3855 Get rid of static_paths method and instead configure paths for ActionDispatch::Static in initializers 2010-09-03 22:59:12 +02:00