Skip to content

Commit

Permalink
Fix zeitwerk loader (#105)
Browse files Browse the repository at this point in the history
* Fix zeitwerk loader

* rubocop

* add changelog entry, bump version

---------

Co-authored-by: jonathan schatz <jon@divisionbyzero.com>
  • Loading branch information
hasghari and modosc authored Dec 16, 2023
1 parent 1e3a66f commit aeb9677
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 10 deletions.
10 changes: 9 additions & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-12-11 04:03:08 UTC using RuboCop version 1.58.0.
# on 2023-12-16 21:20:23 UTC using RuboCop version 1.59.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -37,6 +37,14 @@ Metrics/AbcSize:
Metrics/MethodLength:
Max: 11

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/cloudflare-rails.rb'

# Offense count: 2
# Configuration parameters: ForbiddenDelimiters.
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.0.1] - 2023-12-16
- Fix `zeitwerk` loading issue (https://github.com/modosc/cloudflare-rails/pull/105)

## [5.0.0] - 2023-12-15
### Breaking Changes
- Change namespace from `Cloudflare::Rails` to `CloudflareRails`. This avoids issues with the [cloudflare](https://github.com/socketry/cloudflare) gem as well as the global `Rails` namespace.
Expand Down
3 changes: 3 additions & 0 deletions lib/cloudflare-rails.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'cloudflare_rails'
4 changes: 3 additions & 1 deletion lib/cloudflare_rails.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
require 'zeitwerk'
loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/cloudflare-rails.rb")
loader.setup
loader.eager_load

module CloudflareRails
end

loader.eager_load
2 changes: 1 addition & 1 deletion lib/cloudflare_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CloudflareRails
VERSION = '5.0.0'.freeze
VERSION = '5.0.1'.freeze
end
8 changes: 1 addition & 7 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# copied from https://codingdaily.wordpress.com/2011/01/14/test-a-gem-with-the-rails-3-stack/
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)

ENV['RAILS_ENV'] ||= 'test'

require 'bundler/setup'
Bundler.setup

require 'rubygems'
require 'pry'

# Only the parts of rails we want to use
Expand All @@ -24,7 +18,7 @@
require 'rack/attack'
end

require 'cloudflare_rails'
require 'cloudflare-rails'

if ENV['RACK_ATTACK'] == 'last'
# pull in rack/attack last to make sure patches work with it
Expand Down

0 comments on commit aeb9677

Please sign in to comment.