Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v 2.6.1: Fix issue when directory '.' is not readable (#58)

  • Loading branch information...
commit c9aa05c8c2900e70a5d07b6df8bd1a0ffe723024 1 parent 735d3c9
@marcandre authored
Showing with 18 additions and 9 deletions.
  1. +1 −1  VERSION.yml
  2. +2 −2 backports.gemspec
  3. +15 −6 lib/backports/1.8.7/dir.rb
View
2  VERSION.yml
@@ -1,5 +1,5 @@
---
:major: 2
:minor: 6
-:patch: 0
+:patch: 1
:build:
View
4 backports.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = "backports"
- s.version = "2.6.0"
+ s.version = "2.6.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Marc-Andr\u{e9} Lafortune"]
- s.date = "2012-05-30"
+ s.date = "2012-05-31"
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"
s.email = "github@marc-andre.ca"
s.extra_rdoc_files = [
View
21 lib/backports/1.8.7/dir.rb
@@ -1,11 +1,20 @@
class Dir
- Backports.make_block_optional self, :each, :test_on => Dir.new(".")
+ begin
+ Backports.make_block_optional self, :each, :test_on => Dir.new('.')
+ rescue # We may not be able to read the current directory, issue #58
+ Backports.make_block_optional self, :each, :force => true if RUBY_VERSION < '1.8.7'
+ end
+
class << self
- Backports.make_block_optional self, :foreach, :test_on => Dir, :arg => "."
-
+ begin
+ Backports.make_block_optional self, :foreach, :test_on => Dir, :arg => '.'
+ rescue # We may not be able to read the current directory, issue #58
+ Backports.make_block_optional self, :foreach, :force => true if RUBY_VERSION < '1.8.7'
+ end
+
def mktmpdir(prefix_suffix=nil, tmpdir=nil)
raise NoMethodError, "undefined method `mktmpdir' for Dir:Class; you must require 'tmpdir'" unless respond_to? :tmpdir
-
+
case prefix_suffix
when nil
prefix = "d"
@@ -43,7 +52,7 @@ def mktmpdir(prefix_suffix=nil, tmpdir=nil)
path
end
end unless method_defined? :mktmpdir
-
+
end
end
-
+
Please sign in to comment.
Something went wrong with that request. Please try again.