Module: BundlerSkills::Disabling

Defined in:
lib/bundler_skills/disabling.rb

Overview

Decides whether the post_install hook should run.

The hook only fires when a gem is actually installed, and in the recommended development-group setup the gem isn’t even present in production / CI — so there is no environment auto-detection here. The single escape hatch is the BUNDLER_SKILLS_DISABLED env var. The manual CLI ignores this entirely (running it is an explicit user action).

Constant Summary collapse

TRUTHY =
%w[1 true yes on].freeze

Class Method Summary collapse

Class Method Details

.disabled?(env: ENV) ⇒ Boolean

Returns true when the hook must not run.

Parameters:

  • env (Hash) (defaults to: ENV)

    environment variables (defaults to ENV)

Returns:

  • (Boolean)

    true when the hook must not run



18
19
20
# File 'lib/bundler_skills/disabling.rb', line 18

def disabled?(env: ENV)
  truthy?(env["BUNDLER_SKILLS_DISABLED"])
end

.truthy?(value) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/bundler_skills/disabling.rb', line 22

def truthy?(value)
  return false if value.nil?

  TRUTHY.include?(value.to_s.strip.downcase)
end