Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions .github/workflows/locked_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
- name: Checkout
uses: actions/checkout@v6

- name: Install tree-sitter library
uses: kettle-rb/ts-grammar-action@main

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Deps Locked' step
Uses Step
uses 'kettle-rb/ts-grammar-action' with ref 'main', not a pinned commit hash
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my own action, so I pin it in my own repos as a canary.


- name: Setup Ruby & RubyGems
uses: ruby/setup-ruby@v1
with:
Expand All @@ -81,19 +84,5 @@
bundler: ${{ matrix.bundler }}
bundler-cache: true

- name: "[Attempt 1] Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal }}"
id: bundleAppraisalAttempt1
if: ${{ !env.ACT }}
run: bundle exec appraisal ${{ matrix.appraisal }} install
# Continue to the next step on failure
continue-on-error: true

# Effectively an automatic retry of the previous step.
- name: "[Attempt 2] Appraisal for ${{ matrix.ruby }}@${{ matrix.appraisal }}"
id: bundleAppraisalAttempt2
# If bundleAppraisalAttempt1 failed, try again here; Otherwise skip.
if: ${{ steps.bundleAppraisalAttempt1.outcome == 'failure' && !env.ACT }}
run: bundle exec appraisal ${{ matrix.appraisal }} install

- name: Checks the kitchen sink via ${{ matrix.exec_cmd }}
run: bundle exec ${{ matrix.exec_cmd }}
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ gem "nomono", "~> 1.0"
gem "logger"

# Templating (env-switched: KETTLE_RB_DEV=true for local paths)
eval_gemfile "gemfiles/modular/templating.gemfile" if ENV.fetch("K_JEM_TEMPLATING", "true").casecmp("true").zero?
eval_gemfile "gemfiles/modular/templating.gemfile" if ENV.fetch("K_JEM_TEMPLATING", "false").casecmp("true").zero?

# Debugging
eval_gemfile "gemfiles/modular/debug.gemfile"
Expand Down
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,18 @@ A gem that needs zero new top-level namespaces from this dependency can load the
namespace. On Ruby 3.1+, use `Kernel.load(path, module)`:

```ruby
auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"] ||
Gem::Specification.find_by_name("auth-sanitizer")
auth_sanitizer_requirement = Gem::Requirement.new("~> 0.1", ">= 0.1.3")
auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"]
unless auth_sanitizer_spec && auth_sanitizer_requirement.satisfied_by?(auth_sanitizer_spec.version)
auth_sanitizer_spec = Gem::Specification.find_by_name("auth-sanitizer", auth_sanitizer_requirement)
end
auth_sanitizer_loader_path = File.join(
auth_sanitizer_spec.full_gem_path,
"lib/auth_sanitizer/loader.rb",
)
unless File.file?(auth_sanitizer_loader_path)
raise LoadError, "auth-sanitizer #{auth_sanitizer_requirement} loader not found at #{auth_sanitizer_loader_path}"
end

auth_sanitizer_loader_namespace = Module.new
Kernel.load(auth_sanitizer_loader_path, auth_sanitizer_loader_namespace)
Expand All @@ -274,12 +280,18 @@ Ruby 2.2 through Ruby 3.0 do not support `Kernel.load(path, module)`. For those
inside an anonymous namespace with `Module#module_eval`:

```ruby
auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"] ||
Gem::Specification.find_by_name("auth-sanitizer")
auth_sanitizer_requirement = Gem::Requirement.new("~> 0.1", ">= 0.1.3")
auth_sanitizer_spec = Gem.loaded_specs["auth-sanitizer"]
unless auth_sanitizer_spec && auth_sanitizer_requirement.satisfied_by?(auth_sanitizer_spec.version)
auth_sanitizer_spec = Gem::Specification.find_by_name("auth-sanitizer", auth_sanitizer_requirement)
end
auth_sanitizer_loader_path = File.join(
auth_sanitizer_spec.full_gem_path,
"lib/auth_sanitizer/loader.rb",
)
unless File.file?(auth_sanitizer_loader_path)
raise LoadError, "auth-sanitizer #{auth_sanitizer_requirement} loader not found at #{auth_sanitizer_loader_path}"
end

auth_sanitizer_loader_namespace = Module.new
auth_sanitizer_loader_namespace.module_eval(
Expand Down
Loading