提交 67db41aa 编写于 作者: Y yuuji.yaginuma

Do not run `active_storage:install` when bundle install is skipped

In order to execute the `rails` command, need to run bundle install in
advance.
Therefore, if skipped bundle install, `rails` command may fail and
should not do it.
上级 daf77db6
......@@ -461,7 +461,11 @@ def generate_spring_binstubs
def run_active_storage
unless skip_active_storage?
rails_command "active_storage:install", capture: options[:quiet]
if bundle_install?
rails_command "active_storage:install", capture: options[:quiet]
else
log("Active Storage installation was skipped. Please run 'bin/rails active_storage:install' to install Active Storage files.")
end
end
end
......
......@@ -68,7 +68,6 @@
config/spring.rb
config/storage.yml
db
db/migrate
db/seeds.rb
lib
lib/tasks
......@@ -304,6 +303,21 @@ def test_active_storage_mini_magick_gem
assert_file "Gemfile", /^# gem 'mini_magick'/
end
def test_active_storage_install
command_check = -> command, _ do
@binstub_called ||= 0
case command
when "active_storage:install"
@binstub_called += 1
assert_equal 1, @binstub_called, "active_storage:install expected to be called once, but was called #{@install_called} times."
end
end
generator.stub :rails_command, command_check do
quietly { generator.invoke_all }
end
end
def test_app_update_does_not_generate_active_storage_contents_when_skip_active_storage_is_given
app_root = File.join(destination_root, "myapp")
run_generator [app_root, "--skip-active-storage"]
......
......@@ -222,7 +222,6 @@ def test_generator_for_active_storage
end
assert_file "#{application_path}/config/storage.yml"
assert_directory "#{application_path}/db/migrate"
assert_directory "#{application_path}/storage"
assert_directory "#{application_path}/tmp/storage"
......
......@@ -90,6 +90,8 @@ def up
boot_rails
Dir.chdir(app_path) do
# Install Active Storage migration file first so as not to affect test.
`bundle exec rake active_storage:install`
output = `bundle exec rake bukkits:install:migrations`
["CreateUsers", "AddLastNameToUsers", "CreateSessions"].each do |migration_name|
......@@ -175,6 +177,8 @@ class CreateKeys < ActiveRecord::Migration::Current; end
boot_rails
Dir.chdir(app_path) do
# Install Active Storage migration file first so as not to affect test.
`bundle exec rake active_storage:install`
output = `bundle exec rake railties:install:migrations`.split("\n")
assert_match(/Copied migration \d+_create_users\.core_engine\.rb from core_engine/, output.first)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册