require_all 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/CHANGES +2 -2
- data/Gemfile +3 -0
- data/README.textile +1 -1
- data/Rakefile +4 -9
- data/lib/require_all.rb +1 -1
- data/require_all.gemspec +9 -10
- data/spec/autoload_shared.rb +1 -5
- data/spec/autoload_spec.rb +7 -1
- data/spec/load_spec.rb +7 -1
- data/spec/require_spec.rb +7 -1
- data/spec/spec_helper.rb +7 -7
- metadata +98 -49
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e06fe7ba5ebad8808e535a57c68d3493d254b0a4
|
4
|
+
data.tar.gz: af66530c89f609f806f875dec3f630e8a40b4ca9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8a8ed5bda5ed3f5db20d536925de3164c96205dff8734a117702abc6869a567d3fcc86886094953b6d838c9b73f60ce25426179d2b15ec934fa819775ab518da
|
7
|
+
data.tar.gz: d0edb85d06904dbcf63d91d12020c21d9439c70990ba53c327b44c9be5727eaedabb900a1aee16e5927404a5a66346cb960230f12c175a86007ea3d444296dfc
|
data/.gitignore
ADDED
data/CHANGES
CHANGED
data/Gemfile
ADDED
data/README.textile
CHANGED
@@ -37,7 +37,7 @@ Or if you want, just list the files directly as arguments:
|
|
37
37
|
|
38
38
|
<code>require_all 'lib/a.rb', 'lib/b.rb', 'lib/c.rb', 'lib/d.rb'</code>
|
39
39
|
|
40
|
-
Still have the require File.dirname(__FILE__) blues? The require_all gem also
|
40
|
+
Still have the require <code>File.dirname(__FILE__)</code> blues? The require_all gem also
|
41
41
|
provides a require_rel statement which requires files to relative to the
|
42
42
|
current file. So you can replace statements like:
|
43
43
|
|
data/Rakefile
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
require
|
2
|
-
require 'rake/clean'
|
1
|
+
require "bundler/gem_tasks"
|
3
2
|
|
4
|
-
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
6
|
task :default => :spec
|
7
|
-
|
8
|
-
task :clean do
|
9
|
-
%w[pkg coverage].each do |dir|
|
10
|
-
rm_rf dir
|
11
|
-
end
|
12
|
-
end
|
7
|
+
task :release => :spec
|
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 =
|
74
|
+
file = 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
@@ -1,22 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
GEMSPEC = Gem::Specification.new do |s|
|
1
|
+
Gem::Specification.new do |s|
|
4
2
|
s.name = "require_all"
|
5
|
-
s.version = "1.
|
3
|
+
s.version = "1.3.0"
|
6
4
|
s.authors = ["Jarmo Pertman", "Tony Arcieri"]
|
7
5
|
s.email = "jarmo.p@gmail.com"
|
8
|
-
s.date = "2010-09-14"
|
9
6
|
s.summary = "A wonderfully simple way to load your code"
|
10
|
-
s.platform = Gem::Platform::RUBY
|
11
7
|
|
12
|
-
|
13
|
-
s.
|
8
|
+
s.files = `git ls-files`.split($\)
|
9
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
10
|
+
s.require_paths = ["lib"]
|
14
11
|
|
15
|
-
# RubyForge info
|
16
12
|
s.homepage = "http://github.com/jarmo/require_all"
|
17
13
|
|
18
|
-
# RDoc settings
|
19
14
|
s.has_rdoc = true
|
20
15
|
s.rdoc_options = %w(--title require_all --main README.textile --line-numbers)
|
21
16
|
s.extra_rdoc_files = ["LICENSE", "README.textile", "CHANGES"]
|
17
|
+
|
18
|
+
s.add_development_dependency "rake", "~>0.9"
|
19
|
+
s.add_development_dependency "rspec", "~>2.14"
|
20
|
+
s.add_development_dependency "simplecov", "~>0.7"
|
22
21
|
end
|
data/spec/autoload_shared.rb
CHANGED
@@ -1,7 +1,3 @@
|
|
1
|
-
# difference between "#require_all syntactic sugar" is the
|
2
|
-
# need to specify :base_dir if performing autoloading below the top-level
|
3
|
-
# module directory
|
4
|
-
|
5
1
|
shared_examples_for "#autoload_all syntactic sugar" do
|
6
2
|
before :each do
|
7
3
|
@file_list = [
|
@@ -75,4 +71,4 @@ shared_examples_for "#autoload_all syntactic sugar" do
|
|
75
71
|
lambda {send(@method, @base_dir, :base_dir => @base_dir + "/non_existing_dir")}.
|
76
72
|
should raise_exception(LoadError)
|
77
73
|
end
|
78
|
-
end
|
74
|
+
end
|
data/spec/autoload_spec.rb
CHANGED
@@ -2,6 +2,9 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
require File.dirname(__FILE__) + '/autoload_shared.rb'
|
3
3
|
|
4
4
|
describe "autoload_all" do
|
5
|
+
|
6
|
+
subject { self }
|
7
|
+
|
5
8
|
it "provides require_all functionality by using 'autoload' instead of 'require'" do
|
6
9
|
should_not be_loaded("Autoloaded::Module1::A", "Autoloaded::Module2::LongerName", "Autoloaded::Module2::Module3::B")
|
7
10
|
autoload_all File.dirname(__FILE__) + "/fixtures/autoloaded"
|
@@ -33,6 +36,9 @@ describe "autoload_all" do
|
|
33
36
|
end
|
34
37
|
|
35
38
|
describe "autoload_rel" do
|
39
|
+
|
40
|
+
subject { self }
|
41
|
+
|
36
42
|
it "provides autoload_all functionality relative to the current file" do
|
37
43
|
should_not be_loaded("Modules::Module1::First", "Modules::Module2::Second", "Modules::Zero")
|
38
44
|
require File.dirname(__FILE__) + '/fixtures/autoloaded_rel/modules/zero'
|
@@ -56,4 +62,4 @@ describe "autoload_rel" do
|
|
56
62
|
@autoload_base_dir = File.dirname(__FILE__) + "/fixtures/autoloaded"
|
57
63
|
end
|
58
64
|
it_should_behave_like "#autoload_all syntactic sugar"
|
59
|
-
end
|
65
|
+
end
|
data/spec/load_spec.rb
CHANGED
@@ -2,6 +2,9 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
require File.dirname(__FILE__) + '/require_shared.rb'
|
3
3
|
|
4
4
|
describe "load_all" do
|
5
|
+
|
6
|
+
subject { self }
|
7
|
+
|
5
8
|
it "provides require_all functionality but using 'load' instead of 'require'" do
|
6
9
|
require_all File.dirname(__FILE__) + '/fixtures/resolvable'
|
7
10
|
C.new.should be_cool
|
@@ -25,6 +28,9 @@ describe "load_all" do
|
|
25
28
|
end
|
26
29
|
|
27
30
|
describe "load_rel" do
|
31
|
+
|
32
|
+
subject { self }
|
33
|
+
|
28
34
|
it "provides load_all functionality relative to the current file" do
|
29
35
|
require File.dirname(__FILE__) + '/fixtures/relative/d/d'
|
30
36
|
|
@@ -47,4 +53,4 @@ describe "load_rel" do
|
|
47
53
|
@method = :load_rel
|
48
54
|
end
|
49
55
|
it_should_behave_like "#require_all syntactic sugar"
|
50
|
-
end
|
56
|
+
end
|
data/spec/require_spec.rb
CHANGED
@@ -2,6 +2,9 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
2
2
|
require File.dirname(__FILE__) + '/require_shared.rb'
|
3
3
|
|
4
4
|
describe "require_all" do
|
5
|
+
|
6
|
+
subject { self }
|
7
|
+
|
5
8
|
describe "dependency resolution" do
|
6
9
|
it "handles load ordering when dependencies are resolvable" do
|
7
10
|
require_all File.dirname(__FILE__) + '/fixtures/resolvable/*.rb'
|
@@ -24,6 +27,9 @@ describe "require_all" do
|
|
24
27
|
end
|
25
28
|
|
26
29
|
describe "require_rel" do
|
30
|
+
|
31
|
+
subject { self }
|
32
|
+
|
27
33
|
it "provides require_all functionality relative to the current file" do
|
28
34
|
require File.dirname(__FILE__) + '/fixtures/relative/b/b'
|
29
35
|
|
@@ -36,4 +42,4 @@ describe "require_rel" do
|
|
36
42
|
@method = :require_rel
|
37
43
|
end
|
38
44
|
it_should_behave_like "#require_all syntactic sugar"
|
39
|
-
end
|
45
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
add_filter "/spec/"
|
4
|
+
end
|
5
|
+
|
1
6
|
require File.dirname(__FILE__) + '/../lib/require_all.rb'
|
2
7
|
|
3
8
|
module SpecHelper
|
@@ -14,16 +19,11 @@ module SpecHelper
|
|
14
19
|
end
|
15
20
|
end
|
16
21
|
|
17
|
-
|
22
|
+
RSpec.configure do |config|
|
18
23
|
config.include(SpecHelper)
|
24
|
+
config.color = true
|
19
25
|
|
20
26
|
config.before(:each) do
|
21
27
|
unload_all
|
22
28
|
end
|
23
29
|
end
|
24
|
-
|
25
|
-
module Spec
|
26
|
-
class ExampleGroup
|
27
|
-
subject {self}
|
28
|
-
end
|
29
|
-
end
|
metadata
CHANGED
@@ -1,36 +1,75 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: require_all
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 1.2.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Jarmo Pertman
|
14
8
|
- Tony Arcieri
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2013-09-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ~>
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0.9'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ~>
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.9'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rspec
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ~>
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.14'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '2.14'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: simplecov
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.7'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ~>
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0.7'
|
22
56
|
description:
|
23
57
|
email: jarmo.p@gmail.com
|
24
58
|
executables: []
|
25
|
-
|
26
59
|
extensions: []
|
27
|
-
|
28
|
-
extra_rdoc_files:
|
60
|
+
extra_rdoc_files:
|
29
61
|
- LICENSE
|
30
62
|
- README.textile
|
31
63
|
- CHANGES
|
32
|
-
files:
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- CHANGES
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE
|
69
|
+
- README.textile
|
70
|
+
- Rakefile
|
33
71
|
- lib/require_all.rb
|
72
|
+
- require_all.gemspec
|
34
73
|
- spec/autoload_shared.rb
|
35
74
|
- spec/autoload_spec.rb
|
36
75
|
- spec/fixtures/autoloaded/module1/a.rb
|
@@ -56,47 +95,57 @@ files:
|
|
56
95
|
- spec/require_shared.rb
|
57
96
|
- spec/require_spec.rb
|
58
97
|
- spec/spec_helper.rb
|
59
|
-
- Rakefile
|
60
|
-
- require_all.gemspec
|
61
|
-
- LICENSE
|
62
|
-
- README.textile
|
63
|
-
- CHANGES
|
64
98
|
homepage: http://github.com/jarmo/require_all
|
65
99
|
licenses: []
|
66
|
-
|
100
|
+
metadata: {}
|
67
101
|
post_install_message:
|
68
|
-
rdoc_options:
|
102
|
+
rdoc_options:
|
69
103
|
- --title
|
70
104
|
- require_all
|
71
105
|
- --main
|
72
106
|
- README.textile
|
73
107
|
- --line-numbers
|
74
|
-
require_paths:
|
108
|
+
require_paths:
|
75
109
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
none: false
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
94
120
|
requirements: []
|
95
|
-
|
96
121
|
rubyforge_project:
|
97
|
-
rubygems_version:
|
122
|
+
rubygems_version: 2.0.7
|
98
123
|
signing_key:
|
99
|
-
specification_version:
|
124
|
+
specification_version: 4
|
100
125
|
summary: A wonderfully simple way to load your code
|
101
|
-
test_files:
|
102
|
-
|
126
|
+
test_files:
|
127
|
+
- spec/autoload_shared.rb
|
128
|
+
- spec/autoload_spec.rb
|
129
|
+
- spec/fixtures/autoloaded/module1/a.rb
|
130
|
+
- spec/fixtures/autoloaded/module2/longer_name.rb
|
131
|
+
- spec/fixtures/autoloaded/module2/module3/b.rb
|
132
|
+
- spec/fixtures/autoloaded/with_wrong_module.rb
|
133
|
+
- spec/fixtures/autoloaded_rel/modules/module1/first.rb
|
134
|
+
- spec/fixtures/autoloaded_rel/modules/module2/second.rb
|
135
|
+
- spec/fixtures/autoloaded_rel/modules/zero.rb
|
136
|
+
- spec/fixtures/relative/a.rb
|
137
|
+
- spec/fixtures/relative/b/b.rb
|
138
|
+
- spec/fixtures/relative/c/c.rb
|
139
|
+
- spec/fixtures/relative/d/d.rb
|
140
|
+
- spec/fixtures/resolvable/a.rb
|
141
|
+
- spec/fixtures/resolvable/b.rb
|
142
|
+
- spec/fixtures/resolvable/c.rb
|
143
|
+
- spec/fixtures/resolvable/d.rb
|
144
|
+
- spec/fixtures/unresolvable/a.rb
|
145
|
+
- spec/fixtures/unresolvable/b.rb
|
146
|
+
- spec/fixtures/unresolvable/c.rb
|
147
|
+
- spec/fixtures/unresolvable/d.rb
|
148
|
+
- spec/load_spec.rb
|
149
|
+
- spec/require_shared.rb
|
150
|
+
- spec/require_spec.rb
|
151
|
+
- spec/spec_helper.rb
|