Skip to content

Commit

Permalink
Prefer require_relative for internal requires (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
tagliala authored Sep 26, 2024
1 parent 6bf1025 commit fd48b5e
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 26 deletions.
20 changes: 10 additions & 10 deletions lib/shakapacker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def ensure_log_goes_to_stdout
delegate :bootstrap, :clean, :clobber, :compile, to: :commands
end

require "shakapacker/instance"
require "shakapacker/env"
require "shakapacker/configuration"
require "shakapacker/manifest"
require "shakapacker/compiler"
require "shakapacker/commands"
require "shakapacker/dev_server"
require "shakapacker/deprecation_helper"

require "shakapacker/railtie" if defined?(Rails)
require_relative "shakapacker/instance"
require_relative "shakapacker/env"
require_relative "shakapacker/configuration"
require_relative "shakapacker/manifest"
require_relative "shakapacker/compiler"
require_relative "shakapacker/commands"
require_relative "shakapacker/dev_server"
require_relative "shakapacker/deprecation_helper"

require_relative "shakapacker/railtie" if defined?(Rails)
3 changes: 2 additions & 1 deletion lib/shakapacker/compiler.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require "open3"
require "shakapacker/compiler_strategy"
require "fileutils"

require_relative "compiler_strategy"

class Shakapacker::Compiler
# Additional environment variables that the compiler is being run with
# Shakapacker::Compiler.env['FRONTEND_API_KEY'] = 'your_secret_key'
Expand Down
4 changes: 2 additions & 2 deletions lib/shakapacker/compiler_strategy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "shakapacker/mtime_strategy"
require "shakapacker/digest_strategy"
require_relative "mtime_strategy"
require_relative "digest_strategy"

module Shakapacker
class CompilerStrategy
Expand Down
7 changes: 4 additions & 3 deletions lib/shakapacker/dev_server_runner.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
require "shellwords"
require "socket"
require "shakapacker/configuration"
require "shakapacker/dev_server"
require "shakapacker/runner"

require_relative "configuration"
require_relative "dev_server"
require_relative "runner"

module Shakapacker
class DevServerRunner < Shakapacker::Runner
Expand Down
3 changes: 2 additions & 1 deletion lib/shakapacker/digest_strategy.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "digest/sha1"
require "shakapacker/base_strategy"

require_relative "base_strategy"

module Shakapacker
class DigestStrategy < BaseStrategy
Expand Down
2 changes: 1 addition & 1 deletion lib/shakapacker/mtime_strategy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "shakapacker/base_strategy"
require_relative "base_strategy"

module Shakapacker
class MtimeStrategy < BaseStrategy
Expand Down
8 changes: 4 additions & 4 deletions lib/shakapacker/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require "rails/railtie"

require "shakapacker/helper"
require "shakapacker/dev_server_proxy"
require "shakapacker/version_checker"
require "shakapacker/utils/manager"
require_relative "helper"
require_relative "dev_server_proxy"
require_relative "version_checker"
require_relative "utils/manager"

class Shakapacker::Engine < ::Rails::Engine
# Allows Shakapacker config values to be set via Rails env config files
Expand Down
5 changes: 3 additions & 2 deletions lib/shakapacker/runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "shakapacker/utils/misc"
require "shakapacker/utils/manager"
require_relative "utils/misc"
require_relative "utils/manager"

require "package_json"

module Shakapacker
Expand Down
2 changes: 1 addition & 1 deletion lib/shakapacker/version_checker.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true
require "shakapacker/version"
require_relative "version"

module Shakapacker
class VersionChecker
Expand Down
3 changes: 2 additions & 1 deletion lib/shakapacker/webpack_runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "shellwords"
require "shakapacker/runner"

require_relative "runner"

module Shakapacker
class WebpackRunner < Shakapacker::Runner
Expand Down

0 comments on commit fd48b5e

Please sign in to comment.