Skip to content

Commit 29ffc5d

Browse files
committed
Reapply "Extract ruby_api_version_name"
This reverts commit ba2f697. Box already used ruby_api_version_name.
1 parent 285e22e commit 29ffc5d

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

ruby.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ ruby_show_usage_line(const char *name, const char *secondary, const char *descri
305305
description, help, highlight, width, columns);
306306
}
307307

308+
RUBY_EXTERN const char ruby_api_version_name[];
309+
308310
static void
309311
usage(const char *name, int help, int highlight, int columns)
310312
{
@@ -408,6 +410,9 @@ usage(const char *name, int help, int highlight, int columns)
408410
#define SHOW(m) show_usage_line(&(m), help, highlight, w, columns)
409411

410412
printf("%sUsage:%s %s [options] [--] [filepath] [arguments]\n", sb, se, name);
413+
printf("\n""Details and examples at https://docs.ruby-lang.org/en/%s/ruby/options_md.html\n",
414+
ruby_api_version_name);
415+
411416
for (i = 0; i < num; ++i)
412417
SHOW(usage_msg[i]);
413418

version.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525

2626
#ifdef RUBY_REVISION
2727
# if RUBY_PATCHLEVEL == -1
28+
# define RUBY_API_VERSION_NAME "master"
2829
# ifndef RUBY_BRANCH_NAME
29-
# define RUBY_BRANCH_NAME "master"
30+
# define RUBY_BRANCH_NAME RUBY_API_VERSION_NAME
3031
# endif
3132
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION
3233
# else
@@ -36,6 +37,9 @@
3637
# define RUBY_REVISION "HEAD"
3738
# define RUBY_REVISION_STR ""
3839
#endif
40+
#ifndef RUBY_API_VERSION_NAME
41+
# define RUBY_API_VERSION_NAME RUBY_API_VERSION_STR
42+
#endif
3943
#if !defined RUBY_RELEASE_DATETIME || RUBY_PATCHLEVEL != -1
4044
# undef RUBY_RELEASE_DATETIME
4145
# define RUBY_RELEASE_DATETIME RUBY_RELEASE_DATE
@@ -45,6 +49,9 @@
4549
#define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1))
4650
#define MKINT(name) INT2FIX(ruby_##name)
4751

52+
#define RUBY_API_VERSION_STR \
53+
STRINGIZE(RUBY_API_VERSION_MAJOR) "." \
54+
STRINGIZE(RUBY_API_VERSION_MINOR)
4855
const int ruby_api_version[] = {
4956
RUBY_API_VERSION_MAJOR,
5057
RUBY_API_VERSION_MINOR,
@@ -77,6 +84,7 @@ const char ruby_revision[] = RUBY_FULL_REVISION;
7784
const char ruby_release_date[] = RUBY_RELEASE_DATE;
7885
const char ruby_platform[] = RUBY_PLATFORM;
7986
const int ruby_patchlevel = RUBY_PATCHLEVEL;
87+
const char ruby_api_version_name[] = RUBY_API_VERSION_NAME;
8088
const char ruby_description[] =
8189
"ruby " RUBY_VERSION RUBY_PATCHLEVEL_STR " "
8290
"(" RUBY_RELEASE_DATETIME RUBY_REVISION_STR ") "

0 commit comments

Comments
 (0)