Skip to content

Commit

Permalink
fix: properly ignoring files
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Oct 31, 2024
1 parent cd7e7ee commit 016e18d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ PATH
bunny
concurrent-ruby
multi_json
thor
zeitwerk

GEM
Expand Down Expand Up @@ -92,6 +93,7 @@ GEM
standard-performance (1.4.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.21.0)
thor (1.3.2)
unicode-display_width (2.6.0)
webmock (3.24.0)
addressable (>= 2.8.0)
Expand Down
1 change: 1 addition & 0 deletions lepus.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "bunny", ">= 0.0.0"
spec.add_dependency "thor", ">= 0.0.0"
spec.add_dependency "zeitwerk", ">= 0.0.0"
spec.add_dependency "concurrent-ruby", ">= 0.0.0"
spec.add_dependency "multi_json", ">= 0.0.0"
Expand Down
33 changes: 16 additions & 17 deletions lib/lepus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@
require "yaml"
require "zeitwerk"

loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
loader.inflector.inflect "json" => "JSON"
loader.inflector.inflect "cli" => "CLI"
loader.collapse("#{__dir__}/lepus/rails/*")
loader.collapse("#{__dir__}/lepus/rails/*")
loader.ignore("#{__dir__}/puma")
loader.ignore("#{__dir__}/lepus/rails")
loader.ignore("#{__dir__}/lepus/rails.rb")
loader.ignore("#{__dir__}/lepus/cli.rb")
loader.ignore("#{__dir__}/lepus/middlewares")
loader.log! if ENV["DEBUG"]
loader.setup

module Lepus
DEFAULT_LOGGER = Logger.new($stdout)

Expand Down Expand Up @@ -65,20 +78,6 @@ def initialize(last_heartbeat_at)

extend self

def loader
@loader ||= Zeitwerk::Loader.for_gem(warn_on_extra_files: false).tap do |loader|
loader.inflector.inflect "json" => "JSON"
loader.inflector.inflect "cli" => "CLI"
loader.collapse("#{__dir__}/rails/railtie")
loader.collapse("#{__dir__}/rails/log_subscriber")
# loader.ignore("#{__dir__}/rails")
loader.ignore("#{__dir__}/puma")
loader.ignore("#{__dir__}/cli")
loader.ignore("#{__dir__}/middlewares")
loader.log! if ENV["DEBUG"]
end
end

def logger
@logger ||= DEFAULT_LOGGER
end
Expand Down Expand Up @@ -113,10 +112,10 @@ def self.config
def self.configure
yield config
end

loader.setup
end

if defined?(::Rails)
require_relative "lepus/rails"
# require_relative "lepus/rails"
end

loader.eager_load
2 changes: 0 additions & 2 deletions lib/lepus/rails/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require_relative "log_subscriber"

module Lepus
class Railtie < ::Rails::Railtie
config.lepus = ActiveSupport::OrderedOptions.new
Expand Down
File renamed without changes.

0 comments on commit 016e18d

Please sign in to comment.