awesome_loader 1.3.0 → 1.4.0
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/lib/awesome_loader/autoloader.rb +4 -6
- data/lib/awesome_loader/module_builder.rb +2 -1
- data/lib/awesome_loader/version.rb +1 -1
- 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: 919667aabf3f1cb9d99ea7d797efb9037be63809
|
4
|
+
data.tar.gz: 9fc479c1d118c60da58e29be0b5fcc8d4ca2c5c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88da0edf50dc24d44121f84b1d5ec2b622c474f4a93ae5f624835885c016432cd09135b40936379f434c52948cf7d589d047649fa1f847ce6f3e68ca4214d9c7
|
7
|
+
data.tar.gz: cbaca37c893d68f59a1b2fe7c9804a4881d3d0bc9c01dcf1468a86c9ac9525f18010abe5dcca4ec49c5a27133aa456b1f1eacb01ffa68c68ad3da29ef6e0b54d
|
@@ -9,9 +9,8 @@ module AwesomeLoader
|
|
9
9
|
# Set up an AwesomeLoader::Autoloader instance.
|
10
10
|
#
|
11
11
|
# AwesomeLoader.autoload root_depth: 2 do
|
12
|
-
# paths %w(app models ** *.rb)
|
13
|
-
# paths %w(app helpers ** *.rb)
|
14
12
|
# paths %w(app routes ** *.rb), root_depth: 1
|
13
|
+
# paths %w(app ** *.rb)
|
15
14
|
# end
|
16
15
|
#
|
17
16
|
# @param root_depth [Integer] Tells AwesomeLoader to start creating Modules for dirs *after* this level (default 2)
|
@@ -33,9 +32,8 @@ module AwesomeLoader
|
|
33
32
|
# The autoloader. Normally it's used indirectly through `AwesomeLoader.autoload`, but you can use it directly if you like:
|
34
33
|
#
|
35
34
|
# AwesomeLoader::Autoloader.new(root_depth: 2).
|
36
|
-
# paths(
|
37
|
-
# paths(
|
38
|
-
# paths(%w(app routes ** *.rb), root_depth: 1).
|
35
|
+
# paths(['app', 'routes', '**', '*.rb'], root_depth: 1).
|
36
|
+
# paths(['app', '**', '*.rb']).
|
39
37
|
# finalize!
|
40
38
|
#
|
41
39
|
class Autoloader
|
@@ -82,7 +80,7 @@ module AwesomeLoader
|
|
82
80
|
builder = ModuleBuilder.new(root_depth: root_depth, root_module: root_module)
|
83
81
|
Dir.glob(File.join root_path.to_s, *glob).each do |full_path|
|
84
82
|
next if all_files.include? full_path
|
85
|
-
all_files << full_path
|
83
|
+
all_files << full_path
|
86
84
|
|
87
85
|
rel_path = full_path.sub root_path.to_s, ''
|
88
86
|
dir_path, file_name = File.split rel_path
|
@@ -21,7 +21,8 @@ module AwesomeLoader
|
|
21
21
|
|
22
22
|
#
|
23
23
|
# Returns (recursively creating if necessary) the Module represented by the dir path. The path should be relative
|
24
|
-
# to your application root/working directory.
|
24
|
+
# to your application root/working directory. Directories are expected to use snake case, and the Modules will
|
25
|
+
# use camel case.
|
25
26
|
#
|
26
27
|
# # Since root_depth is 2, the first 2 dirs in any path will be ignored
|
27
28
|
# builder = ModuleBuilder.new(root_depth: 2)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awesome_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Hollinger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: An awesome wrapper for Ruby's built-in autoload
|
14
14
|
email: jordan.hollinger@gmail.com
|