Skip to content

Support to become bundled gems #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 10, 2025
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
6 changes: 5 additions & 1 deletion logger.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/ruby/logger"
spec.licenses = ["Ruby", "BSD-2-Clause"]

spec.files = Dir.glob("lib/**/*.rb") + ["logger.gemspec", "BSDL", "COPYING"]
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
`git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.5.0"
Expand Down
22 changes: 12 additions & 10 deletions test/logger/test_logdevice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def stat
end

def setup
@top_dir = File.expand_path('../../lib', __dir__)
@tempfile = Tempfile.new("logger")
@tempfile.close
@filename = @tempfile.path
Expand Down Expand Up @@ -456,7 +457,7 @@ def test_shifting_size_not_rotate_too_much

def test_shifting_midnight
Dir.mktmpdir do |tmpdir|
assert_in_out_err([*%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([*%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -498,7 +499,7 @@ class << Time

def test_shifting_weekly
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -543,7 +544,7 @@ class << Time

def test_shifting_monthly
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -588,7 +589,7 @@ class << Time

def test_shifting_dst_change
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"Europe/London"}, *%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"Europe/London"}, *%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -627,7 +628,7 @@ class << Time

def test_shifting_weekly_dst_change
Dir.mktmpdir do |tmpdir|
assert_separately([{"TZ"=>"Europe/London"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_separately([{"TZ"=>"Europe/London"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -658,7 +659,7 @@ class << Time

def test_shifting_monthly_dst_change
Dir.mktmpdir do |tmpdir|
assert_separately([{"TZ"=>"Europe/London"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_separately([{"TZ"=>"Europe/London"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -707,7 +708,7 @@ class << Time

def test_shifting_midnight_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([*%W"--disable=gems -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([*%W"--disable=gems -I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -751,7 +752,7 @@ class << Time

def test_shifting_weekly_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -798,7 +799,7 @@ class << Time

def test_shifting_monthly_exist_file
Dir.mktmpdir do |tmpdir|
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
assert_in_out_err([{"TZ"=>"UTC"}, *%W"-I#{@top_dir} -rlogger -C#{tmpdir} -"], "#{<<-"begin;"}\n#{<<-'end;'}")
begin;
begin
module FakeTime
Expand Down Expand Up @@ -848,7 +849,8 @@ class << Time
def run_children(n, args, src)
r, w = IO.pipe
[w, *(1..n).map do
f = IO.popen([EnvUtil.rubybin, *%w[--disable=gems -rlogger -], *args], "w", err: w)
f = IO.popen([EnvUtil.rubybin, *%w[--disable=gems -], *args], "w", err: w)
src = "$LOAD_PATH.unshift('#{@top_dir}'); require 'logger';#{src}"
f.puts(src)
f
end].each(&:close)
Expand Down
Loading