diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ad99ac..c716ab8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/Rakefile b/Rakefile index 18a7e4e..bead40b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,7 @@ require "bundler/gem_tasks" require "rake/testtask" require "rdoc/task" +require "etc" name = "etc" diff --git a/lib/etc.rb b/lib/etc.rb new file mode 100644 index 0000000..74d81f9 --- /dev/null +++ b/lib/etc.rb @@ -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"