mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.c (usage, enable_option, disable_option, process_options): new
option `--disable_did_you_mean`. * gem_prelude.rb: now requires did_you_mean gem by default if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
abd5b8e1db
commit
40f304e025
3 changed files with 21 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Sep 9 16:55:45 2015 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* ruby.c (usage, enable_option, disable_option, process_options): new
|
||||
option `--disable_did_you_mean`.
|
||||
|
||||
* gem_prelude.rb: now requires did_you_mean gem by default if available.
|
||||
|
||||
Wed Sep 9 13:38:56 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* tool/extlibs.rb (do_patch): let "patch" command change the
|
||||
|
|
|
@ -1 +1,7 @@
|
|||
require 'rubygems.rb' if defined?(Gem)
|
||||
if defined?(Gem)
|
||||
require 'rubygems.rb'
|
||||
begin
|
||||
require 'did_you_mean'
|
||||
rescue LoadError
|
||||
end if defined?(DidYouMean)
|
||||
end
|
||||
|
|
7
ruby.c
7
ruby.c
|
@ -62,6 +62,7 @@ char *getenv();
|
|||
#define DISABLE_BIT(bit) (1U << disable_##bit)
|
||||
enum disable_flag_bits {
|
||||
disable_gems,
|
||||
disable_did_you_mean,
|
||||
disable_rubyopt,
|
||||
disable_flag_count
|
||||
};
|
||||
|
@ -192,6 +193,7 @@ usage(const char *name, int help)
|
|||
};
|
||||
static const struct message features[] = {
|
||||
M("gems", "", "rubygems (default: "DEFAULT_RUBYGEMS_ENABLED")"),
|
||||
M("did_you_mean", "", "did_you_mean (default: "DEFAULT_RUBYGEMS_ENABLED")"),
|
||||
M("rubyopt", "", "RUBYOPT environment variable (default: enabled)"),
|
||||
};
|
||||
int i;
|
||||
|
@ -710,6 +712,7 @@ enable_option(const char *str, int len, void *arg)
|
|||
{
|
||||
#define UNSET_WHEN_DISABLE(bit) UNSET_WHEN(#bit, DISABLE_BIT(bit), str, len)
|
||||
UNSET_WHEN_DISABLE(gems);
|
||||
UNSET_WHEN_DISABLE(did_you_mean);
|
||||
UNSET_WHEN_DISABLE(rubyopt);
|
||||
if (NAME_MATCH_P("all", str, len)) {
|
||||
*(unsigned int *)arg = 0U;
|
||||
|
@ -723,6 +726,7 @@ disable_option(const char *str, int len, void *arg)
|
|||
{
|
||||
#define SET_WHEN_DISABLE(bit) SET_WHEN(#bit, DISABLE_BIT(bit), str, len)
|
||||
SET_WHEN_DISABLE(gems);
|
||||
SET_WHEN_DISABLE(did_you_mean);
|
||||
SET_WHEN_DISABLE(rubyopt);
|
||||
if (NAME_MATCH_P("all", str, len)) {
|
||||
*(unsigned int *)arg = ~0U;
|
||||
|
@ -1435,6 +1439,9 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
|
|||
if (!(opt->disable & DISABLE_BIT(gems))) {
|
||||
rb_define_module("Gem");
|
||||
}
|
||||
if (!(opt->disable & DISABLE_BIT(did_you_mean))) {
|
||||
rb_define_module("DidYouMean");
|
||||
}
|
||||
ruby_init_prelude();
|
||||
#if UTF8_PATH
|
||||
opt->script_name = str_conv_enc(opt->script_name, rb_utf8_encoding(), lenc);
|
||||
|
|
Loading…
Reference in a new issue