Permalink
Browse files

Merge branch 'master' into rbx

git-svn-id: http://svn.codehaus.org/jruby/branches/rbx@7981 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information...
1 parent f195c1e commit 3ed431f06cae5a8a65e39c2b31d03b171fea5af7 @headius headius committed Oct 31, 2008
Showing with 1,711 additions and 688 deletions.
  1. +1 −1 bin/_jrubyvmopts.bat
  2. +0 −3 bin/gemlock
  3. +1 −7 bin/jruby
  4. +0 −7 bin/jruby-ng
  5. +1 −4 bin/jruby-ng-server
  6. +0 −2 bin/jruby.rb
  7. BIN build_lib/jcodings.jar
  8. BIN build_lib/jna.jar
  9. BIN build_lib/joni.jar
  10. +23 −13 lib/ruby/site_ruby/1.8/rubygems.rb
  11. +2 −1 lib/ruby/site_ruby/1.8/rubygems/commands/check_command.rb
  12. +1 −1 lib/ruby/site_ruby/1.8/rubygems/commands/unpack_command.rb
  13. +4 −5 lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb
  14. +4 −1 lib/ruby/site_ruby/1.8/rubygems/config_file.rb
  15. +15 −7 lib/ruby/site_ruby/1.8/rubygems/custom_require.rb
  16. +5 −0 lib/ruby/site_ruby/1.8/rubygems/defaults.rb
  17. +1 −1 lib/ruby/site_ruby/1.8/rubygems/installer.rb
  18. +1 −1 lib/ruby/site_ruby/1.8/rubygems/rubygems_version.rb
  19. +1 −2 lib/ruby/site_ruby/1.8/rubygems/source_index.rb
  20. +147 −125 lib/ruby/site_ruby/1.8/rubygems/validator.rb
  21. +2 −2 maven/jruby-complete/pom.xml
  22. +2 −2 maven/jruby/pom.xml
  23. +6 −0 spec/java_integration/fixtures/PackageConstructor.java
  24. +6 −0 spec/java_integration/fixtures/PrivateConstructor.java
  25. +7 −0 spec/java_integration/fixtures/ProtectedConstructor.java
  26. +20 −0 spec/java_integration/types/coercion_spec.rb
  27. +792 −0 spec/java_integration/types/construction_spec.rb
  28. +2 −0 src/jruby/commands.rb
  29. +1 −1 src/org/jruby/IncludedModuleWrapper.java
  30. +9 −1 src/org/jruby/Ruby.java
  31. +3 −3 src/org/jruby/RubyBinding.java
  32. +2 −2 src/org/jruby/RubyClass.java
  33. +12 −4 src/org/jruby/RubyComplex.java
  34. +162 −70 src/org/jruby/RubyEtc.java
  35. +28 −39 src/org/jruby/RubyFile.java
  36. +1 −1 src/org/jruby/RubyMath.java
  37. +11 −20 src/org/jruby/RubyModule.java
  38. +14 −0 src/org/jruby/RubyObject.java
  39. +12 −4 src/org/jruby/RubyRational.java
  40. +1 −1 src/org/jruby/RubyString.java
  41. +2 −0 src/org/jruby/RubyTime.java
  42. +3 −9 src/org/jruby/ast/ConstNode.java
  43. +3 −4 src/org/jruby/ast/executable/AbstractScript.java
  44. +1 −0 src/org/jruby/common/IRubyWarnings.java
  45. +2 −1 src/org/jruby/compiler/CacheCompiler.java
  46. +1 −1 src/org/jruby/compiler/impl/BaseBodyCompiler.java
  47. +0 −270 src/org/jruby/compiler/impl/FieldBasedCacheCompiler.java
  48. +174 −6 src/org/jruby/compiler/impl/InheritedCacheCompiler.java
  49. +5 −1 src/org/jruby/ext/Readline.java
  50. +50 −20 src/org/jruby/java/MiniJava.java
  51. +11 −3 src/org/jruby/javasupport/JavaClass.java
  52. +1 −1 src/org/jruby/javasupport/JavaUtil.java
  53. +12 −5 src/org/jruby/runtime/ThreadContext.java
  54. +5 −0 src/org/jruby/runtime/builtin/InstanceVariables.java
  55. +3 −3 src/org/jruby/runtime/load/JavaCompiledScript.java
  56. +14 −4 src/org/jruby/runtime/marshal/UnmarshalStream.java
  57. +1 −1 src/org/jruby/util/Numeric.java
  58. +5 −1 src/org/jruby/util/ShellLauncher.java
  59. +25 −24 test/org/jruby/util/ShellLauncherTest.java
  60. +19 −1 test/testConstant.rb
  61. +2 −1 test/testEnv.rb
  62. +31 −0 test/testMarshal.rb
  63. +26 −0 test/test_eval.rb
  64. +14 −0 test/test_math.rb
  65. +1 −1 test/test_method_cache.rb
View
@@ -11,7 +11,7 @@ set _STK=%JAVA_STACK%
:stackOptDone
set _VM_OPTS=
-set _RUBY_OPTS=%RUBYOPT%
+set _RUBY_OPTS=
set _DFLT_VM_OPTS=%JAVA_OPTS%
set _JAVA_VM=-client
View
@@ -1,3 +0,0 @@
-#!/usr/bin/env jruby
-
-abort "`gemlock` has been deprecated. Use `gem lock` instead."
View
@@ -55,11 +55,8 @@ JRUBY_HOME=`dirname "$JRUBY_HOME_1"` # the . dir
# JRUBY_HOME='..'
#fi
-# JRUBY_OPTS and RUBYOPT
if [ -z "$JRUBY_OPTS" ] ; then
- JRUBY_OPTS="$RUBYOPT"
-else
- JRUBY_OPTS="$JRUBY_OPTS $RUBYOPT"
+ JRUBY_OPTS=""
fi
if [ -z "$JAVA_HOME" ] ; then
@@ -212,9 +209,6 @@ set -- "${ruby_args[@]}"
JAVA_OPTS="$JAVA_OPTS $JAVA_MEM $JAVA_STACK"
JAVA_OPTS="$JAVA_OPTS -Djna.boot.library.path=$JRUBY_HOME/lib/native/$JNA_PATH"
-if [ `uname -s` = Linux ]; then
- JAVA_OPTS="$JAVA_OPTS -Djna.platform.library.path=:"
-fi
if $cygwin; then
JRUBY_HOME=`cygpath --mixed "$JRUBY_HOME"`
View
@@ -27,13 +27,6 @@ while [ -h "$PRG" ] ; do
fi
done
-# JRUBY_OPTS and RUBYOPT
-if [ -z "$JRUBY_OPTS" ] ; then
- JRUBY_OPTS="$RUBYOPT"
-else
- JRUBY_OPTS="$JRUBY_OPTS $RUBYOPT"
-fi
-
JRUBY_HOME_1=`dirname "$PRG"` # the ./bin dir
JRUBY_HOME_1=`dirname "$JRUBY_HOME_1"` # the . dir
if [ -d "${JRUBY_HOME_1}/lib" ] ; then
View
@@ -41,11 +41,8 @@ if [ -d "${JRUBY_HOME_1}/lib" ] ; then
JRUBY_HOME="${JRUBY_HOME_1}"
fi
-# JRUBY_OPTS and RUBYOPT
if [ -z "$JRUBY_OPTS" ] ; then
- JRUBY_OPTS="$RUBYOPT"
-else
- JRUBY_OPTS="$JRUBY_OPTS $RUBYOPT"
+ JRUBY_OPTS=""
fi
if [ -z "$JAVA_HOME" ] ; then
View
@@ -69,8 +69,6 @@ def to_s
jruby_opts = ENV['JRUBY_OPTS']
if jruby_opts.nil?
jruby_opts = ""
-else
- jruby_opts = "#{jruby_opts} #{ENV['RUBYOPTS'] || ''}"
end
launch = JavaLaunch.new("#{java_home}/bin/java", "org.jruby.Main")
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
@@ -43,12 +43,14 @@ module Kernel
#
# GEM_SKIP=libA:libB ruby -I../libA -I../libB ./mycode.rb
- def gem(gem_name, *version_requirements)
+ def gem(gem_name, *version_requirements) # :doc:
skip_list = (ENV['GEM_SKIP'] || "").split(/:/)
raise Gem::LoadError, "skipping #{gem_name}" if skip_list.include? gem_name
Gem.activate(gem_name, *version_requirements)
end
+ private :gem
+
end
##
@@ -104,10 +106,10 @@ module Gem
@ruby = nil
@sources = []
- @post_install_hooks = []
- @post_uninstall_hooks = []
- @pre_uninstall_hooks = []
- @pre_install_hooks = []
+ @post_install_hooks ||= []
+ @post_uninstall_hooks ||= []
+ @pre_uninstall_hooks ||= []
+ @pre_install_hooks ||= []
##
# Activates an installed gem matching +gem+. The gem must satisfy
@@ -294,6 +296,7 @@ def self.datadir(gem_name)
# A Zlib::Deflate.deflate wrapper
def self.deflate(data)
+ require 'zlib'
Zlib::Deflate.deflate data
end
@@ -302,7 +305,7 @@ def self.deflate(data)
def self.dir
@gem_home ||= nil
- set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
+ set_home(ENV['GEM_HOME'] || Gem.configuration.home || default_dir) unless @gem_home
@gem_home
end
@@ -395,6 +398,8 @@ def self.find_home
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
+ require 'stringio'
+ require 'zlib'
data = StringIO.new data
Zlib::GzipReader.new(data).read
@@ -404,6 +409,8 @@ def self.gunzip(data)
# Zlib::GzipWriter wrapper that zips +data+.
def self.gzip(data)
+ require 'stringio'
+ require 'zlib'
zipped = StringIO.new
Zlib::GzipWriter.wrap zipped do |io| io.write data end
@@ -415,6 +422,7 @@ def self.gzip(data)
# A Zlib::Inflate#inflate wrapper
def self.inflate(data)
+ require 'zlib'
Zlib::Inflate.inflate data
end
@@ -479,13 +487,13 @@ def self.load_path_insert_index
# The file name and line number of the caller of the caller of this method.
def self.location_of_caller
- file, lineno = caller[1].split(':')
- lineno = lineno.to_i
+ caller[1] =~ /(.*?):(\d+)$/i
+ file = $1
+ lineno = $2.to_i
+
[file, lineno]
end
- private_class_method :location_of_caller
-
##
# manage_gems is useless and deprecated. Don't call it anymore.
@@ -709,9 +717,11 @@ def self.set_paths(gpaths)
@gem_path.uniq!
@gem_path.each do |path|
- if 0 == File.expand_path(path).index(Gem.user_home) and
- Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid then
- next # only create by matching user
+ if 0 == File.expand_path(path).index(Gem.user_home)
+ unless win_platform? then
+ # only create by matching user
+ next if Etc.getpwuid.uid != File::Stat.new(Gem.user_home).uid
+ end
end
ensure_gem_subdirectories path
end
@@ -31,7 +31,8 @@ def initialize
def execute
if options[:test]
version = options[:version] || Gem::Requirement.default
- gem_spec = Gem::SourceIndex.from_installed_gems.search(get_one_gem_name, version).first
+ dep = Gem::Dependency.new get_one_gem_name, version
+ gem_spec = Gem::SourceIndex.from_installed_gems.search(dep).first
Gem::Validator.new.unit_test(gem_spec)
end
@@ -43,7 +43,7 @@ def execute
basename = File.basename(path).sub(/\.gem$/, '')
target_dir = File.expand_path File.join(options[:target], basename)
FileUtils.mkdir_p target_dir
- Gem::Installer.new(path).unpack target_dir
+ Gem::Installer.new(path, :unpack => true).unpack target_dir
say "Unpacked gem: '#{target_dir}'"
else
alert_error "Gem '#{gemname}' not installed."
@@ -54,11 +54,10 @@ def execute
fail "No gem names are allowed with the --system option"
end
- spec = Gem::Specification.new
- spec.name = 'rubygems-update'
- spec.version = Gem::Version.new Gem::RubyGemsVersion
- spec.version = Gem::Version.new '1.1.1'
- hig['rubygems-update'] = spec
+ rubygems_update = Gem::Specification.new
+ rubygems_update.name = 'rubygems-update'
+ rubygems_update.version = Gem::Version.new Gem::RubyGemsVersion
+ hig['rubygems-update'] = rubygems_update
options[:user_install] = false
else
@@ -52,6 +52,8 @@ class Gem::ConfigFile
# Where to look for gems
attr_accessor :path
+ attr_accessor :home
+
# True if we print backtraces on errors.
attr_writer :backtrace
@@ -129,7 +131,8 @@ def initialize(arg_list)
Gem.sources = @hash[:sources] if @hash.key? :sources
@verbose = @hash[:verbose] if @hash.key? :verbose
@update_sources = @hash[:update_sources] if @hash.key? :update_sources
- @path = @hash[:gempath]
+ @path = @hash[:gempath] if @hash.key? :gempath
+ @home = @hash[:gemhome] if @hash.key? :gemhome
handle_arguments arg_list
end
@@ -7,11 +7,15 @@
require 'rubygems'
module Kernel
- alias gem_original_require require # :nodoc:
- #
- # We replace Ruby's require with our own, which is capable of
- # loading gems on demand.
+ ##
+ # The Kernel#require from before RubyGems was loaded.
+
+ alias gem_original_require require
+
+ ##
+ # When RubyGems is required, Kernel#require is replaced with our own which
+ # is capable of loading gems on demand.
#
# When you call <tt>require 'x'</tt>, this is what happens:
# * If the file can be loaded from the existing Ruby loadpath, it
@@ -22,8 +26,8 @@ module Kernel
#
# The normal <tt>require</tt> functionality of returning false if
# that file has already been loaded is preserved.
- #
- def require(path) # :nodoc:
+
+ def require(path) # :doc:
gem_original_require path
rescue LoadError => load_error
if load_error.message =~ /#{Regexp.escape path}\z/ and
@@ -34,5 +38,9 @@ def require(path) # :nodoc:
raise load_error
end
end
-end # module Kernel
+
+ private :require
+ private :gem_original_require
+
+end
@@ -1,5 +1,10 @@
module Gem
+ @post_install_hooks ||= []
+ @post_uninstall_hooks ||= []
+ @pre_uninstall_hooks ||= []
+ @pre_install_hooks ||= []
+
##
# An Array of the default sources that come with RubyGems
@@ -137,7 +137,7 @@ def initialize(gem, options={})
options[:user_install] = true
end
- if options[:user_install] then
+ if options[:user_install] and not options[:unpack] then
@gem_home = Gem.user_dir
user_bin_dir = File.join(@gem_home, 'bin')
@@ -2,5 +2,5 @@
# This file is auto-generated by build scripts.
# See: rake update_version
module Gem
- RubyGemsVersion = '1.3.0'
+ RubyGemsVersion = '1.3.1'
end
@@ -257,8 +257,7 @@ def search(gem_pattern, platform_only = false)
# TODO - Remove support and warning for legacy arguments after 2008/11
unless Gem::Dependency === gem_pattern
- warn "Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
- warn "#{caller[0]} is outdated"
+ warn "#{Gem.location_of_caller.join ':'}:Warning: Gem::SourceIndex#search support for #{gem_pattern.class} patterns is deprecated"
end
case gem_pattern
Oops, something went wrong.

0 comments on commit 3ed431f

Please sign in to comment.