# frozen_string_literal: true module Wayfarer module CLI class Base < Thor include Thor::Actions def self.source_root File.expand_path("templates", __dir__) end private def mock_redis Wayfarer.config.redis.factory = ->(_) { MockRedis.new } end def load_environment load_rails || load_plain end def free_agent_pool Wayfarer::Networking::Pool.instance.free end def load_rails begin require "rails/app_loader" rescue LoadError return end return unless Rails::AppLoader.find_executable require File.expand_path("config/application", Dir.pwd) require File.expand_path("config/boot", Dir.pwd) require File.expand_path("config/environment", Dir.pwd) end def load_plain Wayfarer::CLI::Runner.loader.setup end end end end