summaryrefslogtreecommitdiff
path: root/runruby.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-09 08:48:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-02-09 08:48:55 +0000
commitff9c34b3f410bb41c78d9220c738be86fe8474a7 (patch)
tree10f195e2dd3061fbbf71adde43cd34b934e0d2e6 /runruby.rb
parent77c6657723608f373247eff78e04f36b2b4ed59b (diff)
* Makefile.in, bcc32/Makefile.sub, win32/Makefile.sub, configure.in,
runruby.rb: run rdoc, test and so on with compiled extension libraries. [ruby-dev:22688] * ext/extmk.rb, lib/mkmf.rb: make extension libraries in separated directory, similar to the actual directory structure. * lib/fileutils.rb (FileUtils.copy_file): use the mode of the original file to create new file. * lib/rdoc/ri/ri_paths.rb (RI::Paths::SYSDIR): get rid of unexpected influence by envirionment variable. * bcc32/configure.bat, win32/configure.bat: add install-doc options. * win32/win32.c, win32/win32.h (rb_w32_fstat): fix Borland C runtime bug which returns wrong mode. [ruby-dev:22846] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'runruby.rb')
-rwxr-xr-xrunruby.rb50
1 files changed, 50 insertions, 0 deletions
diff --git a/runruby.rb b/runruby.rb
new file mode 100755
index 0000000000..4eaa133224
--- /dev/null
+++ b/runruby.rb
@@ -0,0 +1,50 @@
+#!./miniruby
+
+while arg = ARGV[0]
+ break ARGV.shift if arg == '--'
+ /\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
+ arg, value = $1, $2
+ re = Regexp.new('\A'+arg.gsub(/\w+\b/, '\&\\w*')+'\z', "i")
+ case
+ when re =~ "srcdir"
+ srcdir = value
+ when re =~ "archdir"
+ archdir = value
+ when re =~ "extout"
+ extout = value
+ else
+ break
+ end
+ ARGV.shift
+end
+
+require 'rbconfig'
+config = Config::CONFIG
+
+srcdir ||= File.dirname(__FILE__)
+archdir ||= '.'
+
+ruby = File.join(archdir, config["RUBY_INSTALL_NAME"]+config['EXEEXT'])
+unless File.exist?(ruby)
+ abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
+end
+
+abs_archdir = File.expand_path(archdir)
+libs = [abs_archdir, File.expand_path("lib", srcdir)]
+if extout
+ abs_extout = File.expand_path(extout)
+ libs << abs_extout << File.expand_path(RUBY_PLATFORM, abs_extout)
+end
+config["bindir"] = abs_archdir
+
+if e = ENV["RUBYLIB"]
+ libs |= e.split(File::PATH_SEPARATOR)
+end
+ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
+
+if File.file?(File.join(archdir, config['LIBRUBY_SO'])) and
+ e = config['LIBPATHENV'] and !e.empty?
+ ENV[e] = [abs_archdir, ENV[e]].compact.join(File::PATH_SEPARATOR)
+end
+
+exec ruby, *ARGV