diff --git a/.rubocop.yml b/.rubocop.yml index d329bfe..506ac61 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,7 +12,6 @@ AllCops: - bin/* - gemfiles/* - spec/dummy/**/* - - lib/generators/**/*.rb Gemspec/RequireMFA: Enabled: false diff --git a/lib/generators/royce/install_generator.rb b/lib/generators/royce/install_generator.rb index e97aa11..dba6485 100644 --- a/lib/generators/royce/install_generator.rb +++ b/lib/generators/royce/install_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails/generators' require 'rails/generators/active_record' @@ -6,7 +8,7 @@ class InstallGenerator < ::Rails::Generators::Base include ::Rails::Generators::Migration - source_root File.expand_path('../templates', __FILE__) + source_root File.expand_path('templates', __dir__) desc 'Generates DB migration files for Royce' def create_migration_file diff --git a/lib/royce.rb b/lib/royce.rb index f9fe0e6..e48f389 100644 --- a/lib/royce.rb +++ b/lib/royce.rb @@ -1,11 +1,14 @@ # frozen_string_literal: true +# require external dependencies require 'zeitwerk' -loader = Zeitwerk::Loader.for_gem -generators = "#{__dir__}/generators" -loader.ignore(generators) -loader.setup + +# load zeitwerk +Zeitwerk::Loader.for_gem.tap do |loader| + loader.ignore("#{__dir__}/generators") + loader.setup +end module Royce - require 'royce/engine' if defined?(Rails) + require_relative 'royce/engine' if defined?(Rails) end