backports 2.6.4 → 2.6.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ *.sw?
2
+ *.rbc
3
+ .DS_Store
4
+ coverage
5
+ rdoc
6
+ pkg
7
+ assets
8
+ rs
data/Rakefile CHANGED
@@ -1,28 +1,4 @@
1
- # encoding: utf-8
2
- require 'rubygems'
3
- require 'rake'
4
-
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- gem.name = "backports"
9
- gem.summary = "Backports of Ruby 1.8.7+ for older ruby."
10
- gem.email = "github@marc-andre.ca"
11
- gem.homepage = "http://github.com/marcandre/backports"
12
- gem.authors = ["Marc-André Lafortune"]
13
- gem.description = <<-EOS
14
- Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
15
- EOS
16
- gem.has_rdoc = true
17
- gem.rdoc_options << '--title' << 'Backports library' <<
18
- '--main' << 'README.rdoc' <<
19
- '--line-numbers' << '--inline-source'
20
- gem.rubyforge_project = "backports"
21
- end
22
- Jeweler::GemcutterTasks.new
23
- rescue LoadError
24
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
25
- end
1
+ require "bundler/gem_tasks"
26
2
 
27
3
  require 'rake/testtask'
28
4
  Rake::TestTask.new(:test) do |test|
@@ -30,35 +6,3 @@ Rake::TestTask.new(:test) do |test|
30
6
  test.pattern = 'test/**/*_test.rb'
31
7
  test.verbose = false
32
8
  end
33
-
34
- begin
35
- require 'rcov/rcovtask'
36
- Rcov::RcovTask.new do |test|
37
- test.libs << 'test'
38
- test.pattern = 'test/**/*_test.rb'
39
- test.verbose = true
40
- end
41
- rescue LoadError
42
- task :rcov do
43
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
- end
45
- end
46
-
47
-
48
- task :default => :test
49
-
50
- require 'rake/rdoctask'
51
- Rake::RDocTask.new do |rdoc|
52
- require 'yaml'
53
- if File.exist?('VERSION.yml')
54
- config = YAML.load(File.read('VERSION.yml'))
55
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
56
- else
57
- version = ""
58
- end
59
-
60
- rdoc.rdoc_dir = 'rdoc'
61
- rdoc.title = "backports #{version}"
62
- rdoc.rdoc_files.include('README*')
63
- rdoc.rdoc_files.include('lib/**/*.rb')
64
- end
@@ -1,134 +1,19 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'backports/version'
5
5
 
6
- Gem::Specification.new do |s|
7
- s.name = "backports"
8
- s.version = "2.6.4"
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "backports"
8
+ gem.version = Backports::VERSION
9
+ gem.authors = ["Marc-André Lafortune"]
10
+ gem.email = ["github@marc-andre.ca"]
11
+ gem.description = %q{Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.}
12
+ gem.summary = %q{Backports of Ruby features for older ruby.}
13
+ gem.homepage = "http://github.com/marcandre/backports"
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Marc-Andr\u{e9} Lafortune"]
12
- s.date = "2012-08-23"
13
- s.description = " Essential backports that enable some of the really nice features of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.\n"
14
- s.email = "github@marc-andre.ca"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".irbrc",
22
- "CHANGELOG.rdoc",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION.yml",
27
- "backports.gemspec",
28
- "lib/backports.rb",
29
- "lib/backports/1.8.7.rb",
30
- "lib/backports/1.8.7/argf.rb",
31
- "lib/backports/1.8.7/array.rb",
32
- "lib/backports/1.8.7/binding.rb",
33
- "lib/backports/1.8.7/dir.rb",
34
- "lib/backports/1.8.7/enumerable.rb",
35
- "lib/backports/1.8.7/enumerator.rb",
36
- "lib/backports/1.8.7/env.rb",
37
- "lib/backports/1.8.7/fixnum.rb",
38
- "lib/backports/1.8.7/float.rb",
39
- "lib/backports/1.8.7/gc.rb",
40
- "lib/backports/1.8.7/hash.rb",
41
- "lib/backports/1.8.7/integer.rb",
42
- "lib/backports/1.8.7/io.rb",
43
- "lib/backports/1.8.7/kernel.rb",
44
- "lib/backports/1.8.7/method.rb",
45
- "lib/backports/1.8.7/module.rb",
46
- "lib/backports/1.8.7/numeric.rb",
47
- "lib/backports/1.8.7/object_space.rb",
48
- "lib/backports/1.8.7/proc.rb",
49
- "lib/backports/1.8.7/process.rb",
50
- "lib/backports/1.8.7/range.rb",
51
- "lib/backports/1.8.7/regexp.rb",
52
- "lib/backports/1.8.7/string.rb",
53
- "lib/backports/1.8.7/struct.rb",
54
- "lib/backports/1.8.7/symbol.rb",
55
- "lib/backports/1.8.8.rb",
56
- "lib/backports/1.8.rb",
57
- "lib/backports/1.9.1.rb",
58
- "lib/backports/1.9.1/array.rb",
59
- "lib/backports/1.9.1/dir.rb",
60
- "lib/backports/1.9.1/enumerable.rb",
61
- "lib/backports/1.9.1/enumerator.rb",
62
- "lib/backports/1.9.1/env.rb",
63
- "lib/backports/1.9.1/file.rb",
64
- "lib/backports/1.9.1/float.rb",
65
- "lib/backports/1.9.1/hash.rb",
66
- "lib/backports/1.9.1/integer.rb",
67
- "lib/backports/1.9.1/io.rb",
68
- "lib/backports/1.9.1/kernel.rb",
69
- "lib/backports/1.9.1/math.rb",
70
- "lib/backports/1.9.1/numeric.rb",
71
- "lib/backports/1.9.1/proc.rb",
72
- "lib/backports/1.9.1/range.rb",
73
- "lib/backports/1.9.1/regexp.rb",
74
- "lib/backports/1.9.1/stdlib.rb",
75
- "lib/backports/1.9.1/stdlib/prime.rb",
76
- "lib/backports/1.9.1/string.rb",
77
- "lib/backports/1.9.1/symbol.rb",
78
- "lib/backports/1.9.2.rb",
79
- "lib/backports/1.9.2/array.rb",
80
- "lib/backports/1.9.2/complex.rb",
81
- "lib/backports/1.9.2/dir.rb",
82
- "lib/backports/1.9.2/enumerable.rb",
83
- "lib/backports/1.9.2/float.rb",
84
- "lib/backports/1.9.2/hash.rb",
85
- "lib/backports/1.9.2/kernel.rb",
86
- "lib/backports/1.9.2/match_data.rb",
87
- "lib/backports/1.9.2/random.rb",
88
- "lib/backports/1.9.2/random/MT19937.rb",
89
- "lib/backports/1.9.2/random/bits_and_bytes.rb",
90
- "lib/backports/1.9.2/random/implementation.rb",
91
- "lib/backports/1.9.2/random/load.rb",
92
- "lib/backports/1.9.2/stdlib.rb",
93
- "lib/backports/1.9.2/stdlib/matrix.rb",
94
- "lib/backports/1.9.2/stdlib/matrix/eigenvalue_decomposition.rb",
95
- "lib/backports/1.9.2/stdlib/matrix/lup_decomposition.rb",
96
- "lib/backports/1.9.2/stdlib/set.rb",
97
- "lib/backports/1.9.3.rb",
98
- "lib/backports/1.9.3/file.rb",
99
- "lib/backports/1.9.3/io.rb",
100
- "lib/backports/1.9.3/string.rb",
101
- "lib/backports/1.9.rb",
102
- "lib/backports/basic_object.rb",
103
- "lib/backports/force/array_map.rb",
104
- "lib/backports/force/enumerable_map.rb",
105
- "lib/backports/force/hash_select.rb",
106
- "lib/backports/force/string_length.rb",
107
- "lib/backports/force/string_size.rb",
108
- "lib/backports/rails.rb",
109
- "lib/backports/rails/array.rb",
110
- "lib/backports/rails/enumerable.rb",
111
- "lib/backports/rails/hash.rb",
112
- "lib/backports/rails/kernel.rb",
113
- "lib/backports/rails/module.rb",
114
- "lib/backports/rails/string.rb",
115
- "lib/backports/tools.rb",
116
- "test/README"
117
- ]
118
- s.homepage = "http://github.com/marcandre/backports"
119
- s.rdoc_options = ["--title", "Backports library", "--main", "README.rdoc", "--line-numbers", "--inline-source"]
120
- s.require_paths = ["lib"]
121
- s.rubyforge_project = "backports"
122
- s.rubygems_version = "1.8.24"
123
- s.summary = "Backports of Ruby 1.8.7+ for older ruby."
124
-
125
- if s.respond_to? :specification_version then
126
- s.specification_version = 3
127
-
128
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
129
- else
130
- end
131
- else
132
- end
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
133
19
  end
134
-
@@ -1,3 +1,4 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + "/backports/tools")
2
+ Backports.require_relative "backports/version"
2
3
  Backports.require_relative "backports/1.9"
3
4
  Backports.require_relative "backports/rails"
@@ -81,6 +81,7 @@ end
81
81
  # it is suitable for factorizing an integer which is not large but
82
82
  # has many prime factors. e.g. for Prime#prime? .
83
83
  class Prime
84
+ unless Prime.const_defined? :OldCompatibility
84
85
  include Enumerable
85
86
  @the_instance = Prime.new
86
87
 
@@ -493,3 +494,4 @@ class Prime
493
494
  end
494
495
  end
495
496
  end
497
+ end
@@ -0,0 +1,3 @@
1
+ module Backports
2
+ VERSION = "2.6.5"
3
+ end
@@ -0,0 +1,57 @@
1
+ $bogus = []
2
+
3
+ module Kernel
4
+ def require_with_bogus_extension(lib)
5
+ $bogus << lib
6
+ require_without_bogus_extension(lib)
7
+ end
8
+ alias_method :require_without_bogus_extension, :require
9
+ alias_method :require, :require_with_bogus_extension
10
+
11
+ if defined? BasicObject and BasicObject.superclass
12
+ BasicObject.send :undef_method, :require
13
+ BasicObject.send :undef_method, :require_with_bogus_extension
14
+ end
15
+ end
16
+
17
+ require 'matrix'
18
+ require File.expand_path(File.dirname(__FILE__) + "/test_helper")
19
+
20
+ class StdLibLoadingTest < Test::Unit::TestCase
21
+ def test_load_correctly_after_requiring_backports
22
+ path = File.expand_path("../../lib/backports/1.9.2/stdlib/set.rb", __FILE__)
23
+ assert_equal false, $LOADED_FEATURES.include?(path)
24
+ assert_equal true, require('set')
25
+ assert_equal true, $bogus.include?("set")
26
+ assert_equal true, $LOADED_FEATURES.include?(path)
27
+ assert_equal false, require('set')
28
+ end
29
+
30
+ def test_load_correctly_before_requiring_backports_test
31
+ assert_equal true, $bogus.include?("matrix")
32
+ path = File.expand_path("../../lib/backports/1.9.2/stdlib/matrix.rb", __FILE__)
33
+ assert_equal true, $LOADED_FEATURES.include?(path)
34
+ assert_equal false, require('matrix')
35
+ end
36
+
37
+ def test_not_interfere_for_libraries_without_backports_test
38
+ assert_equal true, require('dl')
39
+ assert_equal false, require('dl')
40
+ end
41
+
42
+ if RUBY_VERSION >= "1.9"
43
+ def test_not_load_new_libraries_when_they_already_exist_test
44
+ path = File.expand_path("../../lib/backports/1.9.1/stdlib_new/prime.rb", __FILE__)
45
+ assert_equal true, require('prime')
46
+ assert_equal false, require('prime')
47
+ assert_equal false, $LOADED_FEATURES.include?(path)
48
+ end
49
+ else
50
+ def test_load_correctly_new_libraries_test
51
+ assert_equal false, $LOADED_FEATURES.include?("prime.rb")
52
+ assert_equal true, require('prime')
53
+ assert_equal true, $LOADED_FEATURES.include?("prime.rb")
54
+ assert_equal false, require('prime')
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,5 @@
1
+ require 'test/unit'
2
+ require File.expand_path(File.dirname(__FILE__) + "/../lib/backports")
3
+
4
+ # class Test::Unit::TestCase
5
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.4
4
+ version: 2.6.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,26 +9,23 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-23 00:00:00.000000000 Z
12
+ date: 2012-11-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: ! ' Essential backports that enable some of the really nice features
15
- of ruby 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
16
-
17
- '
18
- email: github@marc-andre.ca
14
+ description: Essential backports that enable some of the really nice features of ruby
15
+ 1.8.7, ruby 1.9 and rails from ruby 1.8.6 and earlier.
16
+ email:
17
+ - github@marc-andre.ca
19
18
  executables: []
20
19
  extensions: []
21
- extra_rdoc_files:
22
- - LICENSE.txt
23
- - README.rdoc
20
+ extra_rdoc_files: []
24
21
  files:
25
22
  - .document
23
+ - .gitignore
26
24
  - .irbrc
27
25
  - CHANGELOG.rdoc
28
26
  - LICENSE.txt
29
27
  - README.rdoc
30
28
  - Rakefile
31
- - VERSION.yml
32
29
  - backports.gemspec
33
30
  - lib/backports.rb
34
31
  - lib/backports/1.8.7.rb
@@ -118,17 +115,14 @@ files:
118
115
  - lib/backports/rails/module.rb
119
116
  - lib/backports/rails/string.rb
120
117
  - lib/backports/tools.rb
118
+ - lib/backports/version.rb
121
119
  - test/README
120
+ - test/std_lib_loading_test.rb
121
+ - test/test_helper.rb
122
122
  homepage: http://github.com/marcandre/backports
123
123
  licenses: []
124
124
  post_install_message:
125
- rdoc_options:
126
- - --title
127
- - Backports library
128
- - --main
129
- - README.rdoc
130
- - --line-numbers
131
- - --inline-source
125
+ rdoc_options: []
132
126
  require_paths:
133
127
  - lib
134
128
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -144,9 +138,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
138
  - !ruby/object:Gem::Version
145
139
  version: '0'
146
140
  requirements: []
147
- rubyforge_project: backports
141
+ rubyforge_project:
148
142
  rubygems_version: 1.8.24
149
143
  signing_key:
150
144
  specification_version: 3
151
- summary: Backports of Ruby 1.8.7+ for older ruby.
152
- test_files: []
145
+ summary: Backports of Ruby features for older ruby.
146
+ test_files:
147
+ - test/README
148
+ - test/std_lib_loading_test.rb
149
+ - test/test_helper.rb
150
+ has_rdoc:
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 2
3
- :minor: 6
4
- :patch: 4
5
- :build: