diff --git a/depend b/depend index 735afd8cc948c3..ea2486e9e8da1d 100644 --- a/depend +++ b/depend @@ -14598,7 +14598,6 @@ ruby.$(OBJEXT): $(top_srcdir)/prism/util/pm_newline_list.h ruby.$(OBJEXT): $(top_srcdir)/prism/util/pm_string.h ruby.$(OBJEXT): $(top_srcdir)/prism/util/pm_strncasecmp.h ruby.$(OBJEXT): $(top_srcdir)/prism/util/pm_strpbrk.h -ruby.$(OBJEXT): $(top_srcdir)/version.h ruby.$(OBJEXT): {$(VPATH)}assert.h ruby.$(OBJEXT): {$(VPATH)}atomic.h ruby.$(OBJEXT): {$(VPATH)}backward/2/assume.h @@ -14782,7 +14781,6 @@ ruby.$(OBJEXT): {$(VPATH)}prism/ast.h ruby.$(OBJEXT): {$(VPATH)}prism/diagnostic.h ruby.$(OBJEXT): {$(VPATH)}prism/version.h ruby.$(OBJEXT): {$(VPATH)}prism_compile.h -ruby.$(OBJEXT): {$(VPATH)}revision.h ruby.$(OBJEXT): {$(VPATH)}ruby.c ruby.$(OBJEXT): {$(VPATH)}ruby_assert.h ruby.$(OBJEXT): {$(VPATH)}ruby_atomic.h diff --git a/doc/ruby/options.md b/doc/ruby/options.md index 3ed36bf7ea6d7c..943b5f967bf86e 100644 --- a/doc/ruby/options.md +++ b/doc/ruby/options.md @@ -302,7 +302,7 @@ $ ruby -n -e 'p $_' desiderata.txt "be on good terms with all persons.\n" ``` -With option `-l' (chopped): +With option `-l` (chopped): ```console $ ruby -ln -e 'p $_' desiderata.txt diff --git a/gems/bundled_gems b/gems/bundled_gems index 4c59614011428c..4fed6a994d8766 100644 --- a/gems/bundled_gems +++ b/gems/bundled_gems @@ -39,7 +39,7 @@ ostruct 0.6.3 https://github.com/ruby/ostruct pstore 0.2.0 https://github.com/ruby/pstore benchmark 0.4.1 https://github.com/ruby/benchmark logger 1.7.0 https://github.com/ruby/logger -rdoc 6.14.2 https://github.com/ruby/rdoc f4a90c6010b2346cb5426d4496f5a37a136a82fb # for markdown +rdoc 6.14.2 https://github.com/ruby/rdoc win32ole 1.9.2 https://github.com/ruby/win32ole irb 1.15.2 https://github.com/ruby/irb 331c4e851296b115db766c291e8cf54a2492fb36 reline 0.6.2 https://github.com/ruby/reline diff --git a/lib/resolv.rb b/lib/resolv.rb index e2255b7d11a70f..73410f1324b7b1 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -4,6 +4,7 @@ require 'timeout' require 'io/wait' require 'securerandom' +require 'rbconfig' # Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can # handle multiple DNS requests concurrently without blocking the entire Ruby diff --git a/ruby.c b/ruby.c index 134ac5ae3bf0bd..f400a3d53140b3 100644 --- a/ruby.c +++ b/ruby.c @@ -61,7 +61,6 @@ #include "ruby/util.h" #include "ruby/version.h" #include "ruby/internal/error.h" -#include "version.h" #define singlebit_only_p(x) !((x) & ((x)-1)) STATIC_ASSERT(Qnil_1bit_from_Qfalse, singlebit_only_p(Qnil^Qfalse)); @@ -302,6 +301,8 @@ ruby_show_usage_line(const char *name, const char *secondary, const char *descri description, help, highlight, width, columns); } +RUBY_EXTERN const char ruby_api_version_name[]; + static void usage(const char *name, int help, int highlight, int columns) { @@ -404,9 +405,9 @@ usage(const char *name, int help, int highlight, int columns) unsigned int w = (columns > 80 ? (columns - 79) / 2 : 0) + 16; #define SHOW(m) show_usage_line(&(m), help, highlight, w, columns) - printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n\n", sb, se, name); - printf("Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n", - RUBY_PATCHLEVEL == -1 ? "master" : STRINGIZE(RUBY_VERSION_MAJOR) "." STRINGIZE(RUBY_VERSION_MINOR)); + printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n", sb, se, name); + printf("\n""Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n", + ruby_api_version_name); for (i = 0; i < num; ++i) SHOW(usage_msg[i]); diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 4144191ec767c6..fe6ffde07c0cae 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -47,26 +47,27 @@ def test_source_file assert_in_out_err([], "", [], []) end + version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}" + OPTIONS_LINK = "https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html" + def test_usage assert_in_out_err(%w(-h)) do |r, e| - assert_operator(r.size, :<=, 26) - longer = r[3..-1].select {|x| x.size >= 80} + _, _, link, *r = r + assert_include(link, OPTIONS_LINK) + assert_operator(r.size, :<=, 24) + longer = r.select {|x| x.size >= 80} assert_equal([], longer) assert_equal([], e) - - version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}" - assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html") end end def test_usage_long assert_in_out_err(%w(--help)) do |r, e| - longer = r[3..-1].select {|x| x.size > 80} + _, _, link, *r = r + assert_include(link, OPTIONS_LINK) + longer = r.select {|x| x.size > 80} assert_equal([], longer) assert_equal([], e) - - version = RUBY_PATCHLEVEL == -1 ? "master" : "#{RUBY_VERSION_MAJOR}.#{RUBY_VERSION_MINOR}" - assert_include(r, "Details and examples at https://docs.ruby-lang.org/en/#{version}/ruby/options_md.html") end end diff --git a/tool/test-bundled-gems.rb b/tool/test-bundled-gems.rb index 027ed647f10683..221779b130dab3 100644 --- a/tool/test-bundled-gems.rb +++ b/tool/test-bundled-gems.rb @@ -8,11 +8,15 @@ github_actions = ENV["GITHUB_ACTIONS"] == "true" +DEFAULT_ALLOWED_FAILURES = RUBY_PLATFORM =~ /mswin|mingw/ ? [ + 'rbs', + 'debug', + 'irb', + 'power_assert', + 'net-imap', +] : [] allowed_failures = ENV['TEST_BUNDLED_GEMS_ALLOW_FAILURES'] || '' -if RUBY_PLATFORM =~ /mswin|mingw/ - allowed_failures = [allowed_failures, "rbs,debug,irb,power_assert"].join(',') -end -allowed_failures = allowed_failures.split(',').uniq.reject(&:empty?) +allowed_failures = allowed_failures.split(',').concat(DEFAULT_ALLOWED_FAILURES).uniq.reject(&:empty?) # make test-bundled-gems BUNDLED_GEMS=gem1,gem2,gem3 bundled_gems = ARGV.first || '' @@ -113,7 +117,7 @@ "with exit code #{$?.exitstatus}") puts colorize.decorate(mesg, "fail") if allowed_failures.include?(gem) - mesg = "Ignoring test failures for #{gem} due to \$TEST_BUNDLED_GEMS_ALLOW_FAILURES" + mesg = "Ignoring test failures for #{gem} due to \$TEST_BUNDLED_GEMS_ALLOW_FAILURES or DEFAULT_ALLOWED_FAILURES" puts colorize.decorate(mesg, "skip") else failed << gem diff --git a/version.c b/version.c index bb6c15fb7a66a2..243f00b38c0e74 100644 --- a/version.c +++ b/version.c @@ -24,11 +24,13 @@ #ifdef RUBY_REVISION # if RUBY_PATCHLEVEL == -1 +# define RUBY_API_VERSION_NAME "master" # ifndef RUBY_BRANCH_NAME -# define RUBY_BRANCH_NAME "master" +# define RUBY_BRANCH_NAME RUBY_API_VERSION_NAME # endif # define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION # else +# define RUBY_API_VERSION_NAME RUBY_API_VERSION_STR # define RUBY_REVISION_STR " revision "RUBY_REVISION # endif #else @@ -44,6 +46,10 @@ #define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1)) #define MKINT(name) INT2FIX(ruby_##name) +#define RUBY_API_VERSION_STR \ + STRINGIZE(RUBY_API_VERSION_MAJOR) "." \ + STRINGIZE(RUBY_API_VERSION_MINOR) "." \ + "" const int ruby_api_version[] = { RUBY_API_VERSION_MAJOR, RUBY_API_VERSION_MINOR, @@ -81,6 +87,7 @@ const char ruby_revision[] = RUBY_FULL_REVISION; const char ruby_release_date[] = RUBY_RELEASE_DATE; const char ruby_platform[] = RUBY_PLATFORM; const int ruby_patchlevel = RUBY_PATCHLEVEL; +const char ruby_api_version_name[] = RUBY_API_VERSION_NAME; const char ruby_description[] = "ruby " RUBY_VERSION RUBY_PATCHLEVEL_STR " " "(" RUBY_RELEASE_DATETIME RUBY_REVISION_STR ") "