require_all 1.2.0 → 1.2.1

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/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ 1.2.1:
2
+
3
+ * Use File.expand_path for all loading to avoid loading more than once
4
+
1
5
  1.2.0:
2
6
 
3
7
  * Add load_all, and load_rel which behave similarly to require_all/require_rel except that Kernel#load is used
data/README.textile CHANGED
@@ -52,6 +52,17 @@ use require_rel to load entire directories of code too. If "foobar" is a
52
52
  directory this will load all the .rb files found under that directory with
53
53
  automagic dependency handling.
54
54
 
55
+ The difference between <code>require_all</code> and <code>require_rel</code> is that the former loads from the
56
+ working directory and latter from the directory relative to the <code>__FILE__</code>.
57
+ So, if your working directory is let's say /home, and there is /lib/a/b.rb and /lib/c.rb, then
58
+
59
+ <code>require_all "lib/"</code> loads every ruby file from the lib directory in the working directory (pwd)
60
+
61
+ and in /lib/c.rb <code>require_rel "a/"</code> loads every ruby file from the a/ directory not paying any attention
62
+ to the working directory itself.
63
+
64
+ It's recommended to use require_rel since it is not affected by the working directory.
65
+
55
66
  Also load_all and load_rel methods exist to use Kernel#load instead of Kernel#require!
56
67
 
57
68
  It's just that easy! Code loading shouldn't be hard.
@@ -98,7 +109,7 @@ Of course there's also an autoload_rel method:
98
109
  If having some problems with autoload_all or autoload_rel then set $DEBUG to true to see how files
99
110
  are mapped to their respective modules and classes.
100
111
 
101
- h2. Methodology
112
+ h2. Methodology (except for autoload_{all|rel})
102
113
 
103
114
  I didn't invent the approach this gem uses. It was shamelessly stolen from
104
115
  Merb (which apparently stole it from elsewhere). Here's how it works:
data/lib/require_all.rb CHANGED
@@ -71,7 +71,7 @@ module RequireAll
71
71
 
72
72
  # Maybe it's an .rb file and the .rb was omitted
73
73
  if File.file?(arg + '.rb')
74
- file = arg + '.rb'
74
+ file = File.expand_path(arg + '.rb')
75
75
  options[:method] != :autoload ? Kernel.send(options[:method], file) : __autoload(file, file, options)
76
76
  return true
77
77
  end
data/require_all.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  GEMSPEC = Gem::Specification.new do |s|
4
4
  s.name = "require_all"
5
- s.version = "1.2.0"
5
+ s.version = "1.2.1"
6
6
  s.authors = ["Jarmo Pertman", "Tony Arcieri"]
7
7
  s.email = "jarmo.p@gmail.com"
8
8
  s.date = "2010-09-14"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: require_all
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease: false
4
+ hash: 29
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jarmo Pertman
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-14 00:00:00 +03:00
20
- default_executable:
19
+ date: 2010-09-14 00:00:00 Z
21
20
  dependencies: []
22
21
 
23
22
  description:
@@ -62,7 +61,6 @@ files:
62
61
  - LICENSE
63
62
  - README.textile
64
63
  - CHANGES
65
- has_rdoc: true
66
64
  homepage: http://github.com/jarmo/require_all
67
65
  licenses: []
68
66
 
@@ -96,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
94
  requirements: []
97
95
 
98
96
  rubyforge_project:
99
- rubygems_version: 1.3.7
97
+ rubygems_version: 1.8.4
100
98
  signing_key:
101
99
  specification_version: 3
102
100
  summary: A wonderfully simple way to load your code