1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Merge pull request #27550 from mtsmfm/fix-generator-command-for-nested-rails-engine"

This reverts commit 1e969bfb98, reversing
changes made to a5041f267d.

Reason: It breaks the public API
This commit is contained in:
Rafael Mendonça França 2017-01-03 21:51:18 -05:00
parent 1e969bfb98
commit b6ffb5efcb
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
9 changed files with 9 additions and 29 deletions

View file

@ -26,7 +26,7 @@ module Rails
def application_mailer_file_name
@_application_mailer_file_name ||= if mountable_engine?
File.join("app/mailers", namespaced_path, "application_mailer.rb")
"app/mailers/#{namespaced_path}/application_mailer.rb"
else
"app/mailers/application_mailer.rb"
end

View file

@ -28,7 +28,7 @@ module Rails # :nodoc:
private
def application_job_file_name
@application_job_file_name ||= if mountable_engine?
File.join("app/jobs", namespaced_path, "application_job.rb")
"app/jobs/#{namespaced_path}/application_job.rb"
else
"app/jobs/application_job.rb"
end

View file

@ -59,7 +59,7 @@ module ActiveRecord
def application_record_file_name
@application_record_file_name ||= if mountable_engine?
File.join("app/models", namespaced_path, "application_record.rb")
"app/models/#{namespaced_path}/application_record.rb"
else
"app/models/application_record.rb"
end

View file

@ -95,11 +95,11 @@ module Rails
end
def namespaced_class_path # :doc:
@namespaced_class_path ||= namespaced_path + @class_path
@namespaced_class_path ||= [namespaced_path] + @class_path
end
def namespaced_path # :doc:
@namespaced_path ||= namespace.name.split("::").map(&:underscore)
@namespaced_path ||= namespace.name.split("::").first.underscore
end
def class_name # :doc:

View file

@ -1,5 +1,5 @@
<% if namespaced? -%>
require_dependency "<%= File.join(namespaced_path) %>/application_controller"
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>

View file

@ -1,5 +1,5 @@
<% if namespaced? -%>
require_dependency "<%= File.join(namespaced_path) %>/application_controller"
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>

View file

@ -1,5 +1,5 @@
<% if namespaced? -%>
require_dependency "<%= File.join(namespaced_path) %>/application_controller"
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>

View file

@ -22,7 +22,7 @@ module TestUnit # :nodoc:
def fixture_name
@fixture_name ||=
if mountable_engine?
"%s_%s" % [namespaced_path.join("_"), table_name]
"%s_%s" % [namespaced_path, table_name]
else
table_name
end

View file

@ -492,26 +492,6 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase
end
end
def test_scaffold_tests_pass_by_default_inside_namespaced_mountable_engine
Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits-admin --mountable` }
engine_path = File.join(destination_root, "bukkits-admin")
Dir.chdir(engine_path) do
quietly do
`bin/rails g scaffold User name:string age:integer;
bin/rails db:migrate`
end
assert_file "bukkits-admin/app/controllers/bukkits/admin/users_controller.rb" do |content|
assert_match(/module Bukkits::Admin/, content)
assert_match(/class UsersController < ApplicationController/, content)
end
assert_match(/8 runs, 10 assertions, 0 failures, 0 errors/, `bin/rails test 2>&1`)
end
end
def test_scaffold_tests_pass_by_default_inside_full_engine
Dir.chdir(destination_root) { `bundle exec rails plugin new bukkits --full` }