lib/tapioca/runtime/loader.rb in tapioca-0.9.3 vs lib/tapioca/runtime/loader.rb in tapioca-0.9.4

- old
+ new

@@ -4,10 +4,11 @@ module Tapioca module Runtime class Loader extend(T::Sig) include Tapioca::GemHelper + include Thor::Base sig do params(gemfile: Tapioca::Gemfile, initialize_file: T.nilable(String), require_file: T.nilable(String)).void end def load_bundle(gemfile, initialize_file, require_file) @@ -27,15 +28,20 @@ return unless File.exist?("config/application.rb") silence_deprecations if environment_load - safe_require("./config/environment") + require "./config/environment" else - safe_require("./config/application") + require "./config/application" end eager_load_rails_app if eager_load + rescue LoadError, StandardError => e + say("Tapioca attempted to load the Rails application after encountering a `config/application.rb` file, " \ + "but it failed. If your application uses Rails please ensure it can be loaded correctly before generating " \ + "RBIs.\n#{e}", :yellow) + say("Continuing RBI generation without loading the Rails application.") end private sig { params(file: T.nilable(String)).void }