require_relative 1.0.0 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -35,3 +35,15 @@ Please fork the project, make your commits, push them to GitHub, and
35
35
  make a pull request. Patches should have documentation and/or tests.
36
36
  Don't be afraid to make a pull request without them, if you don't know
37
37
  how to test something we can work on it in the comments. :)
38
+
39
+ To run the tests, simply "rake test."
40
+
41
+ To install your development version of the gem, simply "rake install".
42
+
43
+ To generate the documentation, "rake read," and it'll open in your
44
+ browser.
45
+
46
+ ## License
47
+
48
+ require\_relative is licensed under one of three licenses: WTFPL, BSD,
49
+ or the same license as Ruby. Your choice.
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ begin
28
28
  end
29
29
 
30
30
  file 'docs/require_relative/version.html' => 'lib/require_relative/version.rb' do |f|
31
- mkdir "docs/require_relative"
31
+ mkdir_p "docs/require_relative"
32
32
  cp "docs/lib/require_relative/version.html", "docs/require_relative/version.html"
33
33
  end
34
34
 
@@ -39,6 +39,27 @@ begin
39
39
  # Alias for docs task
40
40
  task :doc => :docs
41
41
 
42
+ desc 'Update gh-pages branch'
43
+ task :pages => ['docs/.git', :docs] do
44
+ rev = `git rev-parse --short HEAD`.strip
45
+ Dir.chdir 'docs' do
46
+ sh "git add *.html"
47
+ sh "git add require_relative/*.html"
48
+ sh "git commit -m 'rebuild pages from #{rev}'" do |ok,res|
49
+ if ok
50
+ verbose { puts "gh-pages updated" }
51
+ sh "git push -q o HEAD:gh-pages"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ file 'docs/.git' => ['docs/', '.git/refs/heads/gh-pages'] do |f|
58
+ sh "cd docs && git init -q && git remote add o ../.git" if !File.exist?(f.name)
59
+ sh "cd docs && git fetch -q o && git reset -q --hard o/gh-pages && touch ."
60
+ end
61
+ CLOBBER.include 'docs/.git'
62
+
42
63
  rescue LoadError
43
64
  warn "#$! -- rocco tasks not loaded."
44
65
  end
@@ -1,5 +1,5 @@
1
1
  # This is simply the version number. Splitting it off into a different
2
2
  # file is generally considered to be good practice. :)
3
3
  module RequireRelative
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.3"
5
5
  end
@@ -6,21 +6,25 @@
6
6
  # for more information on how to build your own copy of the gem, as well as
7
7
  # contribute fixes.
8
8
 
9
- # Yep, you're looking at it! This gem is pretty small, and for good reason.
10
- # There's not much to do! We use split to find the filename that we're
11
- # looking to require, raise a LoadError if it's called in a context (like eval)
12
- # that it shouldn't be, and then require it via regular old require.
13
- #
14
- # Now, in 1.9, "." is totally removed from the $LOAD_PATH. We don't do that
15
- # here, because that would break a lot of other code! You're still vulnerable
16
- # to the security hole that caused this change to happen in the first place.
17
- # You will be able to use this gem to transition the code you write over to
18
- # the 1.9 syntax, though.
19
- def require_relative(relative_feature)
9
+ # require\_relative has no effect on Ruby 1.9 (or other versions that provide Kernel#require_relative
10
+ # out of the box)
11
+ unless Object.new.respond_to?(:require_relative, true)
12
+ # Yep, you're looking at it! This gem is pretty small, and for good reason.
13
+ # There's not much to do! We use split to find the filename that we're
14
+ # looking to require, raise a LoadError if it's called in a context (like eval)
15
+ # that it shouldn't be, and then require it via regular old require.
16
+ #
17
+ # Now, in 1.9, "." is totally removed from the $LOAD_PATH. We don't do that
18
+ # here, because that would break a lot of other code! You're still vulnerable
19
+ # to the security hole that caused this change to happen in the first place.
20
+ # You will be able to use this gem to transition the code you write over to
21
+ # the 1.9 syntax, though.
22
+ def require_relative(relative_feature)
20
23
 
21
- file = caller.first.split(/:\d/,2).first
24
+ file = caller.first.split(/:\d/,2).first
22
25
 
23
- raise LoadError, "require_relative is called in #{$1}" if /\A\((.*)\)/ =~ file
26
+ raise LoadError, "require_relative is called in #{$1}" if /\A\((.*)\)/ =~ file
24
27
 
25
- require File.expand_path(relative_feature, File.dirname(file))
28
+ require File.expand_path(relative_feature, File.dirname(file))
29
+ end
26
30
  end
@@ -6,9 +6,9 @@ Gem::Specification.new do |s|
6
6
  s.name = "require_relative"
7
7
  s.version = RequireRelative::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.authors = ["Steve Klabnik <steve@steveklabnik.com>", "Brendan Taylor <whateley@gmail.com>"]
10
- s.email = ["steve@steveklabnik.com"]
11
- s.homepage = "https://steveklabnik.github.com/require_relative"
9
+ s.authors = ["Steve Klabnik", "Brendan Taylor"]
10
+ s.email = ["steve@steveklabnik.com", "whateley@gmail.com"]
11
+ s.homepage = "http://steveklabnik.github.com/require_relative"
12
12
  s.summary = %q{This backports require_relative to Ruby 1.8.}
13
13
  s.description = %q{In Ruby 1.9.2, "." was removed from $:. This is a good idea, for security reasons. This gem backports this to Ruby 1.8.}
14
14
 
metadata CHANGED
@@ -1,23 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_relative
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
- - Steve Klabnik <steve@steveklabnik.com>
14
- - Brendan Taylor <whateley@gmail.com>
13
+ - Steve Klabnik
14
+ - Brendan Taylor
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-05-10 00:00:00 -04:00
20
- default_executable:
19
+ date: 2011-10-22 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: minitest
@@ -50,6 +49,7 @@ dependencies:
50
49
  description: In Ruby 1.9.2, "." was removed from $:. This is a good idea, for security reasons. This gem backports this to Ruby 1.8.
51
50
  email:
52
51
  - steve@steveklabnik.com
52
+ - whateley@gmail.com
53
53
  executables: []
54
54
 
55
55
  extensions: []
@@ -68,8 +68,7 @@ files:
68
68
  - test/foo.rb
69
69
  - test/require_relative_test.rb
70
70
  - test/subdir/bar.rb
71
- has_rdoc: true
72
- homepage: https://steveklabnik.github.com/require_relative
71
+ homepage: http://steveklabnik.github.com/require_relative
73
72
  licenses: []
74
73
 
75
74
  post_install_message:
@@ -98,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
97
  requirements: []
99
98
 
100
99
  rubyforge_project:
101
- rubygems_version: 1.6.2
100
+ rubygems_version: 1.8.10
102
101
  signing_key:
103
102
  specification_version: 3
104
103
  summary: This backports require_relative to Ruby 1.8.