Skip to content

Commit

Permalink
Merge pull request #331 from ifad/chore/prefer-require-relative
Browse files Browse the repository at this point in the history
Prefer require_relative for internal requires
  • Loading branch information
tagliala authored Sep 20, 2024
2 parents d4cbb11 + f65722b commit 2dce4ce
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .rubocop_todo.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'chrono_model'
require_relative '../../chrono_model'

module ActiveRecord
# TODO: Remove when dropping Rails < 7.2 compatibility
Expand Down
20 changes: 10 additions & 10 deletions lib/chrono_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

require 'active_record'

require 'chrono_model/chrono'
require 'chrono_model/conversions'
require 'chrono_model/patches'
require 'chrono_model/adapter'
require 'chrono_model/time_machine'
require 'chrono_model/time_gate'
require 'chrono_model/version'

require 'chrono_model/railtie' if defined?(Rails::Railtie)
require 'chrono_model/db_console' if defined?(Rails::DBConsole) && Rails.version < '7.1'
require_relative 'chrono_model/chrono'
require_relative 'chrono_model/conversions'
require_relative 'chrono_model/patches'
require_relative 'chrono_model/adapter'
require_relative 'chrono_model/time_machine'
require_relative 'chrono_model/time_gate'
require_relative 'chrono_model/version'

require_relative 'chrono_model/railtie' if defined?(Rails::Railtie)
require_relative 'chrono_model/db_console' if defined?(Rails::DBConsole) && Rails.version < '7.1'

module ChronoModel
class Error < ActiveRecord::ActiveRecordError # :nodoc:
Expand Down
10 changes: 5 additions & 5 deletions lib/chrono_model/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

require 'active_record/connection_adapters/postgresql_adapter'

require 'chrono_model/adapter/migrations'
require 'chrono_model/adapter/migrations_modules/stable'
require_relative 'adapter/migrations'
require_relative 'adapter/migrations_modules/stable'

require 'chrono_model/adapter/ddl'
require 'chrono_model/adapter/indexes'
require 'chrono_model/adapter/upgrade'
require_relative 'adapter/ddl'
require_relative 'adapter/indexes'
require_relative 'adapter/upgrade'

module ChronoModel
# This class implements all ActiveRecord::ConnectionAdapters::SchemaStatements
Expand Down
2 changes: 1 addition & 1 deletion lib/chrono_model/db_console.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

require 'chrono_model/patches/db_console'
require_relative 'patches/db_console'

Rails::DBConsole.prepend ChronoModel::Patches::DBConsole::DbConfig
14 changes: 7 additions & 7 deletions lib/chrono_model/patches.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

require 'chrono_model/patches/as_of_time_holder'
require 'chrono_model/patches/as_of_time_relation'
require_relative 'patches/as_of_time_holder'
require_relative 'patches/as_of_time_relation'

require 'chrono_model/patches/join_node'
require 'chrono_model/patches/relation'
require 'chrono_model/patches/preloader'
require 'chrono_model/patches/association'
require 'chrono_model/patches/batches'
require_relative 'patches/join_node'
require_relative 'patches/relation'
require_relative 'patches/preloader'
require_relative 'patches/association'
require_relative 'patches/batches'
2 changes: 1 addition & 1 deletion lib/chrono_model/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require 'active_record/tasks/chronomodel_database_tasks'
require_relative '../active_record/tasks/chronomodel_database_tasks'

module ChronoModel
class Railtie < ::Rails::Railtie
Expand Down
6 changes: 3 additions & 3 deletions lib/chrono_model/time_machine.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

require 'chrono_model/time_machine/time_query'
require 'chrono_model/time_machine/timeline'
require 'chrono_model/time_machine/history_model'
require_relative 'time_machine/time_query'
require_relative 'time_machine/timeline'
require_relative 'time_machine/history_model'

module ChronoModel
module TimeMachine
Expand Down

0 comments on commit 2dce4ce

Please sign in to comment.