diff --git a/lib/tapioca/generator.rb b/lib/tapioca/generator.rb index afc123d78..63909d37f 100644 --- a/lib/tapioca/generator.rb +++ b/lib/tapioca/generator.rb @@ -3,7 +3,6 @@ require "pathname" require "thor" -require "rake" module Tapioca class Generator < ::Thor::Shell::Color @@ -697,6 +696,7 @@ def report_diff_and_exit_if_out_of_date(diff, command) sig { void } def abort_if_pending_migrations! return unless File.exist?("config/application.rb") + return unless defined?(::Rake) Rails.application.load_tasks Rake::Task["db:abort_if_pending_migrations"].invoke if Rake::Task.task_defined?("db:abort_if_pending_migrations") diff --git a/spec/support/repo/Gemfile b/spec/support/repo/Gemfile index 5b175061f..d838cd301 100644 --- a/spec/support/repo/Gemfile +++ b/spec/support/repo/Gemfile @@ -15,6 +15,7 @@ gem("psych") gem("extras") # Needed for DSL generation tests. The simplest # gems that we have a DSL generator for. +gem("rake", "13.0.6") gem("smart_properties", "1.15.0") gem("sidekiq", "6.2.1") gem("activesupport", "6.1.3.2") diff --git a/spec/support/repo/config/application.rb b/spec/support/repo/config/application.rb index 7fc8f315a..b8179f38a 100644 --- a/spec/support/repo/config/application.rb +++ b/spec/support/repo/config/application.rb @@ -1,6 +1,7 @@ # typed: true # frozen_string_literal: true +require "rake" require "sidekiq" require "smart_properties" require "active_support/all" diff --git a/spec/tapioca/cli/require_spec.rb b/spec/tapioca/cli/require_spec.rb index 1602adbbd..50a9bd39c 100644 --- a/spec/tapioca/cli/require_spec.rb +++ b/spec/tapioca/cli/require_spec.rb @@ -51,6 +51,7 @@ class RequireSpec < CliSpec require "baz" require "foo/secret" require "foo/will_fail" + require "rake" require "sidekiq" require "smart_properties" CONTENTS