awesome_loader 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/awesome_loader/autoloader.rb +4 -4
- 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: 6bc3be857b0f9f1f450ae231e058fb261e5f2088
|
4
|
+
data.tar.gz: 2ce33e6b318ed0addccfdd9a265f743362f89b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13e0c675a6526f9336e62c2ef807c665baafd59ef9170a37996c0e5dda61c6be6d1fd6b0253f46529248348386423490cca4b9aabbcae2ff8e3e1bdadfff816d
|
7
|
+
data.tar.gz: 8bc4960d07cbda286eba91eec07eadd1d13c434fa7361e6a553d6050e3e1c6dd5200a903f399ac3781bee9aeb69554218ed401eccd3da3c64de0d049c8e31c59
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# awesome_loader
|
1
|
+
# awesome_loader [![Build Status](https://travis-ci.org/jhollinger/awesome_loader.svg?branch=master)](https://travis-ci.org/jhollinger/awesome_loader)
|
2
2
|
|
3
3
|
So you've created your bespoke Ruby application without Rails. Then you thought, "Bollocks, I have to manually require all my application files, and in a certain order! And I have to explicitly define all my submodules - they don't magically appear based on the directory structure like they did in Rails. There has to be a better way!" Well now there is.
|
4
4
|
|
@@ -39,7 +39,6 @@ module AwesomeLoader
|
|
39
39
|
class Autoloader
|
40
40
|
# The default root_dept for new instances
|
41
41
|
DEFAULT_ROOT_DEPTH = 2
|
42
|
-
RB_EXT = /\.rb$/
|
43
42
|
|
44
43
|
# @return [Integer] root depth used for all paths unless otherwise specified
|
45
44
|
attr_reader :default_root_depth
|
@@ -78,13 +77,14 @@ module AwesomeLoader
|
|
78
77
|
#
|
79
78
|
def paths(glob, root_depth: default_root_depth)
|
80
79
|
builder = ModuleBuilder.new(root_depth: root_depth, root_module: root_module)
|
80
|
+
blank_str = ''
|
81
81
|
Dir.glob(File.join root_path.to_s, *glob).each do |full_path|
|
82
82
|
next if all_files.include? full_path
|
83
83
|
all_files << full_path
|
84
84
|
|
85
|
-
rel_path = full_path.sub root_path.to_s,
|
85
|
+
rel_path = full_path.sub root_path.to_s, blank_str
|
86
86
|
dir_path, file_name = File.split rel_path
|
87
|
-
const_name = Utils.camelize file_name.
|
87
|
+
const_name = Utils.camelize file_name[0, file_name.size - 3]
|
88
88
|
builder.module(dir_path).autoload const_name, full_path
|
89
89
|
end
|
90
90
|
self
|
@@ -99,7 +99,7 @@ module AwesomeLoader
|
|
99
99
|
#
|
100
100
|
def require(glob)
|
101
101
|
Dir.glob(File.join root_path.to_s, *glob).each do |file|
|
102
|
-
|
102
|
+
Kernel.require file
|
103
103
|
end
|
104
104
|
self
|
105
105
|
end
|
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.5.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-05
|
11
|
+
date: 2017-11-05 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
|