kettle-dev 1.1.32 → 1.1.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -120,11 +120,17 @@ module Kettle
120
120
  end
121
121
 
122
122
  selected.values.each do |orig_src|
123
- src = helpers.prefer_example(orig_src)
123
+ src = helpers.prefer_example_with_osc_check(orig_src)
124
124
  # Destination path should never include the .example suffix.
125
125
  rel = orig_src.sub(/^#{Regexp.escape(gem_checkout_root)}\/?/, "").sub(/\.example\z/, "")
126
126
  dest = File.join(project_root, rel)
127
127
 
128
+ # Skip opencollective-specific files when Open Collective is disabled
129
+ if helpers.skip_for_disabled_opencollective?(rel)
130
+ puts "Skipping #{rel} (Open Collective disabled)"
131
+ next
132
+ end
133
+
128
134
  # Optional file: .github/workflows/discord-notifier.yml should NOT be copied by default.
129
135
  # Only copy when --include matches it.
130
136
  if rel == ".github/workflows/discord-notifier.yml"
@@ -422,7 +428,13 @@ module Kettle
422
428
  end
423
429
 
424
430
  files_to_copy.each do |rel|
425
- src = helpers.prefer_example(File.join(gem_checkout_root, rel))
431
+ # Skip opencollective-specific files when Open Collective is disabled
432
+ if helpers.skip_for_disabled_opencollective?(rel)
433
+ puts "Skipping #{rel} (Open Collective disabled)"
434
+ next
435
+ end
436
+
437
+ src = helpers.prefer_example_with_osc_check(File.join(gem_checkout_root, rel))
426
438
  dest = File.join(project_root, rel)
427
439
  next unless File.exist?(src)
428
440
 
@@ -76,6 +76,51 @@ module Kettle
76
76
  File.exist?(example) ? example : src_path
77
77
  end
78
78
 
79
+ # Check if Open Collective is disabled via environment variable.
80
+ # Returns true when OPENCOLLECTIVE_HANDLE or FUNDING_ORG is explicitly set to a falsey value.
81
+ # @return [Boolean]
82
+ def opencollective_disabled?
83
+ oc_handle = ENV["OPENCOLLECTIVE_HANDLE"]
84
+ funding_org = ENV["FUNDING_ORG"]
85
+
86
+ # Check if either variable is explicitly set to false
87
+ [oc_handle, funding_org].any? do |val|
88
+ val && val.to_s.strip.match(Kettle::Dev::ENV_FALSE_RE)
89
+ end
90
+ end
91
+
92
+ # Prefer a .no-osc.example variant when Open Collective is disabled.
93
+ # Otherwise, falls back to prefer_example behavior.
94
+ # For a given source path, this will return:
95
+ # - "path.no-osc.example" if opencollective_disabled? and it exists
96
+ # - Otherwise delegates to prefer_example
97
+ # @param src_path [String]
98
+ # @return [String]
99
+ def prefer_example_with_osc_check(src_path)
100
+ if opencollective_disabled?
101
+ # Try .no-osc.example first
102
+ base = src_path.sub(/\.example\z/, "")
103
+ no_osc = base + ".no-osc.example"
104
+ return no_osc if File.exist?(no_osc)
105
+ end
106
+ prefer_example(src_path)
107
+ end
108
+
109
+ # Check if a file should be skipped when Open Collective is disabled.
110
+ # Returns true for opencollective-specific files when opencollective_disabled? is true.
111
+ # @param relative_path [String] relative path from gem checkout root
112
+ # @return [Boolean]
113
+ def skip_for_disabled_opencollective?(relative_path)
114
+ return false unless opencollective_disabled?
115
+
116
+ opencollective_files = [
117
+ ".opencollective.yml",
118
+ ".github/workflows/opencollective.yml",
119
+ ]
120
+
121
+ opencollective_files.include?(relative_path)
122
+ end
123
+
79
124
  # Record a template action for a destination path
80
125
  # @param dest_path [String]
81
126
  # @param action [Symbol] one of :create, :replace, :skip, :dir_create, :dir_replace
@@ -6,7 +6,7 @@ module Kettle
6
6
  module Version
7
7
  # The gem version.
8
8
  # @return [String]
9
- VERSION = "1.1.32"
9
+ VERSION = "1.1.33"
10
10
 
11
11
  module_function
12
12
 
data/lib/kettle/dev.rb CHANGED
@@ -62,6 +62,11 @@ module Kettle
62
62
  # Accepts 1, true, y, yes (any case).
63
63
  # @return [Regexp]
64
64
  ENV_TRUE_RE = /\A(1|true|y|yes)\z/i
65
+
66
+ # A case-insensitive regular expression that matches common falsy ENV values.
67
+ # Accepts false, n, no, 0 (any case).
68
+ # @return [Regexp]
69
+ ENV_FALSE_RE = /\A(false|n|no|0)\z/i
65
70
  # Absolute path to the root of the kettle-dev gem (repository root when working from source)
66
71
  # @return [String]
67
72
  GEM_ROOT = File.expand_path("../..", __dir__)
data/sig/kettle/dev.rbs CHANGED
@@ -12,6 +12,7 @@ module Kettle
12
12
  REQUIRE_BENCH: bool
13
13
  RUNNING_AS: String
14
14
  ENV_TRUE_RE: Regexp
15
+ ENV_FALSE_RE: Regexp
15
16
  GEM_ROOT: String
16
17
 
17
18
  # Singleton methods
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kettle-dev
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.32
4
+ version: 1.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -222,8 +222,10 @@ files:
222
222
  - "./.simplecov.example"
223
223
  - "./Appraisals.example"
224
224
  - "./CHANGELOG.md.example"
225
+ - "./FUNDING.md.no-osc.example"
225
226
  - "./Gemfile.example"
226
227
  - "./README.md.example"
228
+ - "./README.md.no-osc.example"
227
229
  - "./Rakefile.example"
228
230
  - "./kettle-dev.gemspec.example"
229
231
  - ".aiignore.example"
@@ -237,6 +239,7 @@ files:
237
239
  - ".git-hooks/prepare-commit-msg.example"
238
240
  - ".github/.codecov.yml.example"
239
241
  - ".github/FUNDING.yml"
242
+ - ".github/FUNDING.yml.no-osc.example"
240
243
  - ".github/dependabot.yml"
241
244
  - ".github/workflows/ancient.yml"
242
245
  - ".github/workflows/ancient.yml.example"
@@ -288,11 +291,13 @@ files:
288
291
  - CODE_OF_CONDUCT.md
289
292
  - CONTRIBUTING.md
290
293
  - FUNDING.md
294
+ - FUNDING.md.no-osc.example
291
295
  - Gemfile
292
296
  - Gemfile.example
293
297
  - LICENSE.txt
294
298
  - README.md
295
299
  - README.md.example
300
+ - README.md.no-osc.example
296
301
  - REEK
297
302
  - RUBOCOP.md
298
303
  - Rakefile.example
@@ -404,10 +409,10 @@ licenses:
404
409
  - MIT
405
410
  metadata:
406
411
  homepage_uri: https://kettle-dev.galtzo.com/
407
- source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.1.32
408
- changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.1.32/CHANGELOG.md
412
+ source_code_uri: https://github.com/kettle-rb/kettle-dev/tree/v1.1.33
413
+ changelog_uri: https://github.com/kettle-rb/kettle-dev/blob/v1.1.33/CHANGELOG.md
409
414
  bug_tracker_uri: https://github.com/kettle-rb/kettle-dev/issues
410
- documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.1.32
415
+ documentation_uri: https://www.rubydoc.info/gems/kettle-dev/1.1.33
411
416
  funding_uri: https://github.com/sponsors/pboling
412
417
  wiki_uri: https://github.com/kettle-rb/kettle-dev/wiki
413
418
  news_uri: https://www.railsbling.com/tags/kettle-dev
metadata.gz.sig CHANGED
Binary file