Skip to content

Commit

Permalink
Switch to autoloading instead of explicit requires
Browse files Browse the repository at this point in the history
  • Loading branch information
sfnelson committed Jul 15, 2024
1 parent e93649b commit 0dda3fb
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
katalyst-content (2.5.0)
katalyst-content (2.5.1)
active_storage_validations
katalyst-html-attributes
katalyst-kpop
Expand Down
2 changes: 1 addition & 1 deletion katalyst-content.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "katalyst-content"
spec.version = "2.5.0"
spec.version = "2.5.1"
spec.authors = ["Katalyst Interactive"]
spec.email = ["[email protected]"]

Expand Down
10 changes: 5 additions & 5 deletions lib/katalyst/content.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# frozen_string_literal: true

require "active_support"
require "katalyst/html_attributes"
require "katalyst/kpop"

require "katalyst/content/config"
require "katalyst/content/engine"

module Katalyst
module Content
extend ActiveSupport::Autoload
extend self

autoload :Config

def config
@config ||= Config.new
end
Expand All @@ -20,3 +18,5 @@ def configure
end
end
end

require "katalyst/content/engine"
5 changes: 4 additions & 1 deletion lib/katalyst/content/engine.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# frozen_string_literal: true

require "rails"
require "katalyst/html_attributes"
require "katalyst/kpop"
require "rails/engine"

module Katalyst
module Content
class Engine < ::Rails::Engine
isolate_namespace Katalyst::Content
config.eager_load_namespaces << Katalyst::Content

initializer "katalyst-content.factories", after: "factory_bot.set_factory_paths" do
FactoryBot.definition_file_paths << Engine.root.join("spec/factories") if defined?(FactoryBot)
Expand Down
18 changes: 0 additions & 18 deletions lib/tasks/yarn.rake

This file was deleted.

2 changes: 0 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "katalyst/content"

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = ".rspec_status"
Expand Down

0 comments on commit 0dda3fb

Please sign in to comment.