sane 0.23.1 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.23.1
1
+ 0.23.2
@@ -2,6 +2,8 @@ unless Kernel.respond_to?(:require_relative, true)
2
2
 
3
3
  module Kernel
4
4
  module_function
5
+ OriginalDir = File.expand_path(Dir.pwd) # try to accomodate for later Directory changes...
6
+
5
7
  def require_relative(relative_feature)
6
8
  c = caller.first
7
9
  # could be spec.sane.rb:127
@@ -11,8 +13,15 @@ module Kernel
11
13
  if /\A\((.*)\)/ =~ file # eval, etc.
12
14
  raise LoadError, "require_relative is called in #{$1}"
13
15
  end
16
+ p 'relative is', relative_feature, File.dirname(file), OriginalDir
14
17
  absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature))
15
- require absolute_feature
18
+ begin
19
+ require absolute_feature
20
+ rescue LoadError => e
21
+ # hacky kludge in case they've changed dirs...
22
+ require File.expand_path(File.join(OriginalDir,File.dirname(file), relative_feature))
23
+ end
24
+
16
25
  end
17
26
  end
18
27
 
@@ -0,0 +1 @@
1
+ $was_in_rr_1 = 1
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'backports'
3
+ Dir.chdir File.dirname(__FILE__)
4
+ #subdir2
5
+ #require_relative2.rb
6
+ require_relative '../subdir2/require_relative2'
7
+ raise unless $was_in_rr_1 == 1
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require '../lib/sane'
3
+ Dir.chdir File.dirname(__FILE__)
4
+ require_relative '../subdir2/require_relative2'
5
+ raise unless $was_in_rr_1 == 1
@@ -163,6 +163,12 @@ describe Sane do
163
163
  require_relative 'subdir/go.rb'
164
164
  end
165
165
 
166
+ it "should require_relative after changing dirs" do
167
+ require 'ruby-debug'
168
+ debugger
169
+ assert system(OS.ruby_bin + " req_rel_bug/recreate.rb")
170
+ end
171
+
166
172
  it "should have a File.home method" do
167
173
  assert File.home == File.expand_path('~')
168
174
  end
@@ -0,0 +1,2 @@
1
+ p 'in good file'
2
+ $was_in_rr_1 = 1
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sane
3
3
  version: !ruby/object:Gem::Version
4
- hash: 65
4
+ hash: 71
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 23
9
- - 1
10
- version: 0.23.1
9
+ - 2
10
+ version: 0.23.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roger Pack
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-22 00:00:00 -06:00
18
+ date: 2010-10-09 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -91,10 +91,14 @@ files:
91
91
  - spec/files/pp_before_hand.rb
92
92
  - spec/files/test.rb
93
93
  - spec/go2.rb
94
+ - spec/req_rel_bug/recreate.rb
94
95
  - spec/spec.sane.rb
95
96
  - spec/subdir/go.rb
97
+ - spec/subdir2/require_relative2.rb
96
98
  - todo
97
99
  - TODO
100
+ - spec/extrapolate/subdir2/require_relative2.rb
101
+ - spec/extrapolate/temp/recreate.rb
98
102
  has_rdoc: true
99
103
  homepage: http://github.com/rogerdpack/sane_ruby
100
104
  licenses: []
@@ -130,9 +134,13 @@ signing_key:
130
134
  specification_version: 3
131
135
  summary: Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there
132
136
  test_files:
137
+ - spec/extrapolate/subdir2/require_relative2.rb
138
+ - spec/extrapolate/temp/recreate.rb
133
139
  - spec/files/pp_after.rb
134
140
  - spec/files/pp_before_hand.rb
135
141
  - spec/files/test.rb
136
142
  - spec/go2.rb
143
+ - spec/req_rel_bug/recreate.rb
137
144
  - spec/spec.sane.rb
138
145
  - spec/subdir/go.rb
146
+ - spec/subdir2/require_relative2.rb