Skip to content

Commit

Permalink
Add RUBYLIB to load fake etc.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 29, 2023
1 parent 717062d commit f9e6e65
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ jobs:
ruby-version: ${{ matrix.ruby }}
rubygems: ${{ matrix.ruby < '2.7' && '3.4.22' || '' }}
bundler-cache: true
- name: Add RUBYLIB to load fake etc.rb
run:
echo RUBYLIB=%CD:\=/%/lib >> $GITHUB_ENV
- name: Run test
run: bundle exec rake compile test
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "bundler/gem_tasks"
require "rake/testtask"
require "rdoc/task"
require "etc"

name = "etc"

Expand Down
9 changes: 9 additions & 0 deletions lib/etc.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dir = __dir__
$:.delete(dir)
if libs = ENV.delete("RUBYLIB")
libs = libs.split(File::PATH_SEPARATOR).select do |d|
!File.identical?(d, dir)
end
ENV["RUBYLIB"] = libs.join(File::PATH_SEPARATOR) unless libs.empty?
end
raise LoadError, "etc"

0 comments on commit f9e6e65

Please sign in to comment.