diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-10 09:22:59 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-10 09:22:59 +0000 |
commit | 040ffb5d792d932215b7b6fbce9ee9752d76e285 (patch) | |
tree | 2d8bfa467abc38cbeccfb504836dfe712784c190 /ruby.c | |
parent | 66c127bc6f95761f967efc5109cd229973fbc50f (diff) | |
download | ruby-040ffb5d792d932215b7b6fbce9ee9752d76e285.tar.gz |
* gem_prelude.rb: new file for gem libraries. currently empty.
* common.mk: generate ext_prelude.c by prelude.rb and gem_prelude.rb.
ruby (not miniruby) is linked with ext_prelude.o instead of prelude.o.
* inits.c (rb_call_inits): don't call Init_prelude.
* ruby.c: support --disable-gems option.
(ruby_init_gems): new function to define Gem::Enable and
invoke Init_prelude.
(process_options): call ruby_init_gems just after
ruby_init_loadpath.
* tool/compile_prelude.rb: support multiple files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -75,6 +75,7 @@ struct cmdline_options { int usage; int version; int copyright; + int disable_gems; int verbose; int yydebug; char *script; @@ -121,6 +122,7 @@ usage(const char *name) "-w turn warnings on for your script", "-W[level] set warning level; 0=silence, 1=medium, 2=verbose (default)", "-x[directory] strip off text before #!ruby line and perhaps cd to directory", + "--disable_gems disable gem libraries", "--copyright print the copyright", "--version print the version", NULL @@ -813,6 +815,8 @@ proc_options(int argc, char **argv, struct cmdline_options *opt) ruby_debug = Qtrue; ruby_verbose = Qtrue; } + else if (strcmp("disable-gems", s) == 0) + opt->disable_gems = 1; else if (strcmp("encoding", s) == 0) { if (!--argc || !(s = *++argv)) { noencoding: @@ -873,6 +877,17 @@ proc_options(int argc, char **argv, struct cmdline_options *opt) return argc0 - argc; } +void Init_prelude(void); + +static void +ruby_init_gems(struct cmdline_options *opt) +{ + VALUE gem; + gem = rb_define_module("Gem"); + rb_const_set(gem, rb_intern("Enable"), opt->disable_gems ? Qfalse : Qtrue); + Init_prelude(); +} + static VALUE process_options(VALUE arg) { @@ -976,6 +991,7 @@ process_options(VALUE arg) process_sflag(opt); ruby_init_loadpath(); + ruby_init_gems(opt); parser = rb_parser_new(); if (opt->e_script) { if (opt->enc_index >= 0) |