Commit fb3f1820 authored by David Suárez's avatar David Suárez

Merge tag 'upstream/3.3.5'

Upstream version 3.3.5
parents b22b105a 87641732
[submodule "rubyspec"]
path = rubyspec
[submodule "spec/rubyspec"]
path = spec/rubyspec
url = git://github.com/rubyspec/rubyspec.git
......@@ -12,7 +12,6 @@ rvm:
matrix:
allow_failures:
- rvm: "2.0.0" # Must wait for 2.0.0p0...
- rvm: jruby-18mode
- rvm: jruby-19mode
- rvm: rbx-18mode
......
= Backports --- History
== Version 3.3.0 - April 3rd, 2013
* Moved `Proc#yield` & `Hash#key` from 1.8.7 to 1.9.1
== Version 3.2.0 - April 2nd, 2013
* Moved `Dir.mktmpdir` to the stdlib 'tmpdir' for Ruby 1.8.7
* Removed `returning` as it is no longer part of Rails.
== Version 3.1.0 - March 5th, 2013
* Backports can now be loaded separately!
......
......@@ -9,6 +9,7 @@ gemspec
group :test do
gem "rake"
gem 'mspec', :git => 'git://github.com/rubyspec/mspec.git'
gem 'activesupport'
end
# Declare any dependencies that are still in development here instead of in
......
......@@ -7,18 +7,24 @@ GIT
PATH
remote: .
specs:
backports (3.1.1)
backports (3.3.4)
GEM
remote: http://rubygems.org/
specs:
rake (10.0.3)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
i18n (0.6.1)
multi_json (1.7.2)
rake (10.1.0)
PLATFORMS
java
ruby
DEPENDENCIES
activesupport
backports!
mspec!
rake
= Backports Library {<img src="https://travis-ci.org/marcandre/backports.png?branch=master">}[https://travis-ci.org/marcandre/backports]
= Backports Library {<img src="https://travis-ci.org/marcandre/backports.png?branch=master">}[https://travis-ci.org/marcandre/backports] {<img src="https://badge.fury.io/rb/backports.png" alt="Gem Version" />}[http://badge.fury.io/rb/backports] {<img alt='Click here to lend your support to: Ruby Backports and make a donation at www.pledgie.com !' src='http://www.pledgie.com/campaigns/19510.png?skin_name=chrome' border='0'}[http://www.pledgie.com/campaigns/19510]
* Yearning to use some of the new cool features in Ruby 2.0.0 while using 1.8.6?
* One of your client is stuck with Ruby 1.8.6 but you want to use a gem using some features of 1.8.7?
......@@ -61,7 +61,7 @@ Note: about a dozen of backports have a dependency that will be also loaded. For
With bundler, add to your Gemfile:
gem 'backports', :load => false
gem 'backports', :require => false
Run <tt>bundle install</tt> and require the desired backports.
......@@ -109,6 +109,7 @@ Additionally, the following Ruby 1.9 features have been backported:
* Hash
* +assoc+, +rassoc+
* +key+
* +try_convert+
* <tt>default_proc=</tt>
......@@ -255,7 +256,6 @@ Some generic methods from Rails methods have been copied:
* Object
* +try+
* +returning+
* String
* +camelize+, +underscore+
......
......@@ -11,6 +11,7 @@ Rake::TestTask.new(:test) do |test|
test.verbose = false
end
desc "Run specs, where path can be '*/*' (default), 'class/*' or 'class/method'."
task :spec, :path, :action do |t, args|
args.with_defaults(:path => '*/*', :action => 'ci')
stats = [[0] * 5]
......@@ -60,7 +61,7 @@ DEPENDENCIES = Hash.new([]).merge!(
'1.8.7/enumerable/entries' => ['backports/1.8.7/enumerable/each_with_index', 'backports/1.8.7/enumerable/to_a'],
'1.8.7/enumerator/rewind' => 'backports/1.8.7/enumerator/next',
'1.8.7/hash/reject' => 'backports/1.8.7/integer/even',
'1.9.1/hash/rassoc' => 'backports/1.8.7/hash/key',
'1.9.1/hash/rassoc' => 'backports/1.9.1/hash/key',
'1.9.1/proc/lambda' => 'backports/1.9.1/proc/curry',
'1.9.2/complex/to_r' => 'complex',
'1.9.2/array/select' => 'backports/1.8.7/array/select',
......@@ -99,6 +100,7 @@ def mspec_cmds(pattern, action='ci')
-r ./set_version/#{version}
#{deps}
-r backports/#{version_path}
-C spec
rubyspec/core/#{path}_spec.rb
].join(' '), path
end
......
require 'backports/tools'
Backports.require_relative_dir
Backports::StdLib.extend_relative
unless Dir.method_defined? :mktmpdir
class Dir
unless Dir.respond_to? :mktmpdir
class << Dir
def mktmpdir(prefix_suffix=nil, tmpdir=nil)
raise NoMethodError, "undefined method `mktmpdir' for Dir:Class; you must require 'tmpdir'" unless respond_to? :tmpdir
......
unless (Math.log(2, 2) rescue false)
# Standard in Ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Math.html]
class << Math
require 'backports/tools'
require 'backports/tools'
class << Math
# Standard in Ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Math.html]
def log_with_optional_base(numeric, base = Backports::Undefined)
if base.equal?(Backports::Undefined)
# Math.log(n) in 1.9.1 no longer accepts string arguments as it
......@@ -16,7 +16,5 @@ unless (Math.log(2, 2) rescue false)
end
end
Backports.alias_method_chain self, :log, :optional_base
# Standard in Ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Math.html]
end
end
......@@ -6,7 +6,8 @@ unless [1,2].uniq{}.size == 1
return uniq_without_block unless block_given?
h = {}
each do |elem|
h[yield(elem)] ||= elem
key = yield(elem)
h[key] = elem unless h.has_key?(key)
end
h.values
end
......
......@@ -16,7 +16,7 @@ unless Enumerable.method_defined? :chunk
previous = nil
case key
when nil, :_separator
when :_singleton
when :_alone
yielder.yield [key, [val]]
else
raise RuntimeError, "symbol beginning with an underscore are reserved"
......
......@@ -12,7 +12,7 @@
# (they will only be undefined whenever a subclass of BasicObject is created)
# Because of all the fineprint, BasicObject must be required explicitely
unless Kernel.const_defined? :BasicObject
unless Object.const_defined? :BasicObject
class BasicObject
KEEP = %w[== equal? ! != instance_eval instance_exec __send__]
......
......@@ -2,12 +2,12 @@ class Hash
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
def reverse_merge(other_hash)
other_hash.merge(self)
end
end unless method_defined? :reverse_merge
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
def reverse_merge!(other_hash)
replace(reverse_merge(other_hash))
end
end unless method_defined? :reverse_merge!
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Hash/Keys.html]
def symbolize_keys
......
module Kernel
class Object
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/Object.html]
def try(method_id, *args, &block)
send(method_id, *args, &block) unless self.nil?
end unless method_defined? :try
# Standard in rails. See official documentation[http://api.rubyonrails.org/classes/Object.html]
def returning(obj)
yield obj
obj
end unless method_defined? :returning
end
class Module
# Standard in rails... See official documentation[http://api.rubyonrails.org/classes/ActiveSupport/CoreExtensions/Module.html]
def alias_method_chain(target, feature)
Backports.alias_method_chain(self, target, feature)
def alias_method_chain(target, feature, &block)
Backports.alias_method_chain(self, target, feature, &block)
end unless method_defined? :alias_method_chain
end
......@@ -256,8 +256,8 @@ module Backports
# Safe alias_method that will only alias if the source exists and destination doesn't
def self.alias_method(mod, new_name, old_name)
mod.instance_eval do
alias_method new_name, old_name if method_defined?(old_name) and not method_defined?(new_name)
end
alias_method new_name, old_name
end if mod.method_defined?(old_name) && !mod.method_defined?(new_name)
end
# Used internally to combine {IO|File} options hash into mode (String or Integer)
......
module Backports
VERSION = "3.1.1" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
VERSION = "3.3.5" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
end
This diff is collapsed.
fails:Array#keep_if on frozen objects with truthy block raises a RuntimeError
fails:Array#keep_if on frozen objects with falsy block raises a RuntimeError
fails:Array#select! on frozen objects with truthy block raises a RuntimeError
fails:Array#select! on frozen objects with falsy block raises a RuntimeError
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment