From fcbf63e62c627deae76c1b8cb8c0876c536ed811 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Mon, 16 Mar 2020 18:49:26 +0900 Subject: Fresh start --- jni/ruby/bin/erb | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ jni/ruby/bin/gem | 25 ++++++++ jni/ruby/bin/irb | 11 ++++ jni/ruby/bin/rake | 33 +++++++++++ jni/ruby/bin/rdoc | 44 ++++++++++++++ jni/ruby/bin/ri | 12 ++++ 6 files changed, 296 insertions(+) create mode 100755 jni/ruby/bin/erb create mode 100755 jni/ruby/bin/gem create mode 100755 jni/ruby/bin/irb create mode 100755 jni/ruby/bin/rake create mode 100755 jni/ruby/bin/rdoc create mode 100755 jni/ruby/bin/ri (limited to 'jni/ruby/bin') diff --git a/jni/ruby/bin/erb b/jni/ruby/bin/erb new file mode 100755 index 0000000..1ba49c9 --- /dev/null +++ b/jni/ruby/bin/erb @@ -0,0 +1,171 @@ +#!/usr/bin/env ruby +# Tiny eRuby --- ERB2 +# Copyright (c) 1999-2000,2002 Masatoshi SEKI +# You can redistribute it and/or modify it under the same terms as Ruby. + +require 'erb' + +class ERB + module Main + def ARGV.switch + return nil if self.empty? + arg = self.shift + return nil if arg == '--' + case arg + when /\A-(.)(.*)/ + if $1 == '-' + arg, @maybe_arg = arg.split(/=/, 2) + return arg + end + raise 'unknown switch "-"' if $2[0] == ?- and $1 != 'T' + if $2.size > 0 + self.unshift "-#{$2}" + @maybe_arg = $2 + else + @maybe_arg = nil + end + "-#{$1}" + when /\A(\w+)=/ + arg + else + self.unshift arg + nil + end + end + + def ARGV.req_arg + (@maybe_arg || self.shift || raise('missing argument')).tap { + @maybe_arg = nil + } + end + + def trim_mode_opt(trim_mode, disable_percent) + return trim_mode if disable_percent + case trim_mode + when 0 + return '%' + when 1 + return '%>' + when 2 + return '%<>' + when '-' + return '%-' + end + end + module_function :trim_mode_opt + + def run(factory=ERB) + trim_mode = 0 + disable_percent = false + variables = {} + begin + while switch = ARGV.switch + case switch + when '-x' # ruby source + output = true + when '-n' # line number + number = true + when '-v' # verbose + $VERBOSE = true + when '--version' # version + STDERR.puts factory.version + exit + when '-d', '--debug' # debug + $DEBUG = true + when '-r' # require + require ARGV.req_arg + when '-S' # security level + arg = ARGV.req_arg + raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-3]\z/ + safe_level = arg.to_i + when '-T' # trim mode + arg = ARGV.req_arg + if arg == '-' + trim_mode = arg + next + end + raise "invalid trim mode #{arg.dump}" unless arg =~ /\A[0-2]\z/ + trim_mode = arg.to_i + when '-E', '--encoding' + arg = ARGV.req_arg + set_encoding(*arg.split(/:/, 2)) + when '-U' + set_encoding(Encoding::UTF_8, Encoding::UTF_8) + when '-P' + disable_percent = true + when '--help' + raise "print this help" + when /\A-/ + raise "unknown switch #{switch.dump}" + else + var, val = *switch.split('=', 2) + (variables ||= {})[var] = val + end + end + rescue # usage + STDERR.puts $!.to_s + STDERR.puts File.basename($0) + + " [switches] [var=value...] [inputfile]" + STDERR.puts <= 1.8.7" + +unless required_version.satisfied_by? Gem.ruby_version then + abort "Expected Ruby Version #{required_version}, is #{Gem.ruby_version}" +end + +args = ARGV.clone + +begin + Gem::GemRunner.new.run args +rescue Gem::SystemExitException => e + exit e.exit_code +end + diff --git a/jni/ruby/bin/irb b/jni/ruby/bin/irb new file mode 100755 index 0000000..1718d07 --- /dev/null +++ b/jni/ruby/bin/irb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +# +# irb.rb - interactive ruby +# $Release Version: 0.9.6 $ +# $Revision: 40560 $ +# by Keiju ISHITSUKA(keiju@ruby-lang.org) +# + +require "irb" + +IRB.start(__FILE__) diff --git a/jni/ruby/bin/rake b/jni/ruby/bin/rake new file mode 100755 index 0000000..4e0bbb7 --- /dev/null +++ b/jni/ruby/bin/rake @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +#-- +# Copyright (c) 2003, 2004, 2005, 2006, 2007 Jim Weirich +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +#++ + +begin + require 'rubygems' + gem 'rake' +rescue LoadError +end + +require 'rake' + +Rake.application.run diff --git a/jni/ruby/bin/rdoc b/jni/ruby/bin/rdoc new file mode 100755 index 0000000..aaa2329 --- /dev/null +++ b/jni/ruby/bin/rdoc @@ -0,0 +1,44 @@ +#!/usr/bin/env ruby +# +# RDoc: Documentation tool for source code +# (see lib/rdoc/rdoc.rb for more information) +# +# Copyright (c) 2003 Dave Thomas +# Released under the same terms as Ruby + +begin + gem 'rdoc' +rescue NameError => e # --disable-gems + raise unless e.name == :gem +rescue Gem::LoadError +end + +require 'rdoc/rdoc' + +begin + r = RDoc::RDoc.new + r.document ARGV +rescue Errno::ENOSPC + $stderr.puts 'Ran out of space creating documentation' + $stderr.puts + $stderr.puts 'Please free up some space and try again' +rescue SystemExit + raise +rescue Exception => e + if $DEBUG_RDOC then + $stderr.puts e.message + $stderr.puts "#{e.backtrace.join "\n\t"}" + $stderr.puts + elsif Interrupt === e then + $stderr.puts + $stderr.puts 'Interrupted' + else + $stderr.puts "uh-oh! RDoc had a problem:" + $stderr.puts e.message + $stderr.puts + $stderr.puts "run with --debug for full backtrace" + end + + exit 1 +end + diff --git a/jni/ruby/bin/ri b/jni/ruby/bin/ri new file mode 100755 index 0000000..7fbed0c --- /dev/null +++ b/jni/ruby/bin/ri @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +begin + gem 'rdoc' +rescue NameError => e # --disable-gems + raise unless e.name == :gem +rescue Gem::LoadError +end + +require 'rdoc/ri/driver' + +RDoc::RI::Driver.run ARGV -- cgit v1.2.3