loader 1.3.2 → 1.4.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/loader/require.rb +34 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbd0401ed15fcae6187c6e8b482cd904589eb41f
|
4
|
+
data.tar.gz: c1a5c63c634fad866d7df0e4330c9bea16706f1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de350d4402e98926200ce65db8ed31ff70122c31774efd68fd5a8290a24b75803333f61ad6da879c8753506f4b10f858f39c1e47d343dea474d6f898b1b22475
|
7
|
+
data.tar.gz: 4ecbd0199e4d74deeba1581682bffdf1c6cb4ffc90a963852fe58fe0227bc45b7f02377ae07728e710d633d8dee192c18b377cb280f076a16f139d6cd9469b69
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.1
|
data/lib/loader/require.rb
CHANGED
@@ -7,13 +7,28 @@ module Loader
|
|
7
7
|
def require_relative_directory *args
|
8
8
|
|
9
9
|
folder= args.select{|e|(e.class <= ::String)}.join(File::Separator)
|
10
|
-
opts= Hash[*args.select{|e|(e.class <= ::Hash)}]
|
11
|
-
args
|
10
|
+
opts= ::Hash[*args.select{|e|(e.class <= ::Hash)}]
|
11
|
+
args.select!{|e|(e.class <= ::Symbol)}
|
12
12
|
|
13
|
-
opts[:recursive]
|
14
|
-
opts[:recursive]
|
13
|
+
opts[:recursive] ||= opts.delete(:r) || opts.delete(:R) || !([:recursive,:r, :R,].select{|e| args.include?(e)}.empty?)
|
14
|
+
opts[:recursive] = !!opts[:recursive]
|
15
15
|
|
16
|
-
|
16
|
+
# inclusion and exclusion
|
17
|
+
[[:exclude,[:ex,:e,:EX,:E]],[:include,[:in,:i,:IN,:I]]].each do |name,aliases|
|
18
|
+
|
19
|
+
aliases.each do |one_alias|
|
20
|
+
opts[name] ||= opts.delete(one_alias)
|
21
|
+
end
|
22
|
+
|
23
|
+
opts[name] ||= []
|
24
|
+
|
25
|
+
# should be REGEXP collection
|
26
|
+
opts[name] = [*opts[name]].map{|e| !(e.class <= ::Regexp) ? Regexp.new(e.to_s) : e }
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
opts[:caller_folder] ||= opts.delete(:f) || opts.delete(:folder) || ::Loader.caller_folder
|
17
32
|
|
18
33
|
unless folder.to_s[0] == File::Separator
|
19
34
|
folder= [opts[:caller_folder],folder]
|
@@ -29,8 +44,20 @@ module Loader
|
|
29
44
|
end
|
30
45
|
|
31
46
|
return Dir.glob(File.join(*path_parts)).sort_by{|e| e.split(File::Separator).size }.map { |one_path|
|
32
|
-
|
33
|
-
|
47
|
+
|
48
|
+
next unless opts[:exclude].select{|regex| one_path =~ regex ? true : false }.empty?
|
49
|
+
|
50
|
+
if opts[:include].empty?
|
51
|
+
require(one_path);one_path
|
52
|
+
else
|
53
|
+
opts[:include].each do |regex|
|
54
|
+
if one_path =~ regex
|
55
|
+
require(one_path);one_path
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
}.compact
|
34
61
|
|
35
62
|
end
|
36
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05
|
11
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: " dsl for gem helper calls such like relative folder calls that independ
|
14
14
|
on the Dir.pwd or File.expand tricks and config loader stuffs, Check out the GIT! "
|