autoloaded 1.6.0 → 1.7.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/.travis.yml +1 -0
- data/History.md +16 -7
- data/License.md +1 -1
- data/README.md +23 -23
- data/autoloaded.gemspec +1 -1
- data/lib/autoloaded/version.rb +1 -1
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0736db59154581469d671b352eed15faaa35a23d962de033d9106fd69bb56887
|
4
|
+
data.tar.gz: 58857610f89eda2d2e933767e81cb2e2901b78b4b7cc25ebbde7ff94acab75b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a1ca3c1af68c99bb541d136fcc38e3679f59bc77da1270f6a4f9e8b225cf4ded70c4678a25312ccb1bda6a7a5ce9a6634f2c13a16bd3df9c2f0550b2f91e7c5
|
7
|
+
data.tar.gz: 97751b780b02f4d838bf0702bbae78c152ce3bcd41107369ded24f91319ed55d6388fe026cd2da9da9f642659a04096142f08d5bbef4715ad974869b1433e318
|
data/.travis.yml
CHANGED
data/History.md
CHANGED
@@ -1,9 +1,14 @@
|
|
1
|
-
# Version history for the
|
1
|
+
# Version history for the *Autoloaded* project
|
2
|
+
|
3
|
+
## <a name="v1.7.0"></a>v1.7.0, Sat 9/19/2021
|
4
|
+
|
5
|
+
* Add support for Ruby v3 (thanks to [@krimsonkla][GitHub-user-krimsonkla])
|
2
6
|
|
3
7
|
## <a name="v1.6.0"></a>v1.6.0, Sun 4/05/2020
|
4
8
|
|
5
9
|
* Eliminate Ruby warnings about
|
6
|
-
[
|
10
|
+
[*Binding#source_location*][Ruby-Core-Binding-source_location] (thanks to
|
11
|
+
[@guss77][GitHub-user-guss77])
|
7
12
|
|
8
13
|
## <a name="v1.5.1"></a>v1.5.1, Wed 10/18/2017
|
9
14
|
|
@@ -12,11 +17,12 @@
|
|
12
17
|
## <a name="v1.5.0"></a>v1.5.0, Wed 2/22/2017
|
13
18
|
|
14
19
|
* Add support for Ruby load paths (`$:`) that contain one or more
|
15
|
-
[
|
20
|
+
[*Pathname*][Ruby-Stdlib-Pathname] objects (thanks to
|
21
|
+
[@ekampp][GitHub-user-ekampp])
|
16
22
|
|
17
23
|
## <a name="v1.4.1"></a>v1.4.1, Sat 1/24/2015
|
18
24
|
|
19
|
-
* Don’t warn about a
|
25
|
+
* Don’t warn about a *VERSION* constant presumably loaded by a *.gemspec*
|
20
26
|
|
21
27
|
## <a name="v1.3.0"></a>v1.3.0, Fri 12/26/2014
|
22
28
|
|
@@ -30,11 +36,11 @@
|
|
30
36
|
|
31
37
|
* Correct/improve autoload behavior
|
32
38
|
* Instead of returning the source **directory** path from
|
33
|
-
[
|
39
|
+
[*Module#autoload?*][Ruby-Core-Module-autoload], return one or more matching
|
34
40
|
source **file** path(s)
|
35
41
|
* Use Ruby load path (`$:`) to handle relative source file paths
|
36
|
-
* Explain
|
37
|
-
[
|
42
|
+
* Explain *Module#autoload?* and
|
43
|
+
[*Module#constants*][Ruby-Core-Module-constants] in the [readme][readme] and
|
38
44
|
in [inline documentation][inline-documentation]
|
39
45
|
|
40
46
|
## <a name="v1.0.0"></a>v1.0.0, Wed 10/29/2014
|
@@ -45,6 +51,9 @@
|
|
45
51
|
|
46
52
|
(First release)
|
47
53
|
|
54
|
+
[GitHub-user-krimsonkla]: https://github.com/krimsonkla "GitHub user @krimsonkla"
|
55
|
+
[GitHub-user-ekampp]: https://github.com/ekampp "GitHub user @ekampp"
|
56
|
+
[GitHub-user-guss77]: https://github.com/guss77 "GitHub user @guss77"
|
48
57
|
[JRuby]: https://www.jruby.org/
|
49
58
|
[Ruby-Core-Binding-source_location]: https://ruby-doc.org/core/Binding.html#method-i-source_location "‘Binding#source_location’ method in the Ruby Core Library"
|
50
59
|
[Ruby-Core-Module-autoload]: https://ruby-doc.org/core/Module.html#method-i-autoload-3F "‘Module#autoload’ method in the Ruby Core Library"
|
data/License.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The MIT License
|
2
2
|
|
3
|
-
Source code for
|
3
|
+
Source code for *Autoloaded* is Copyright © 2014 [Nils Jonsson][mail] and
|
4
4
|
[contributors][contributors].
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
data/README.md
CHANGED
@@ -9,14 +9,14 @@
|
|
9
9
|
[![Inch CI build status] ][Inch-CI-build-status]
|
10
10
|
[![RubyGems release] ][RubyGems-release]
|
11
11
|
|
12
|
-
If you like the [
|
13
|
-
Ruby Core library, you may have wished for
|
12
|
+
If you like the [*Module#autoload*][Ruby-Core-Module-autoload] feature of the
|
13
|
+
Ruby Core library, you may have wished for *Autoloaded*. It eliminates the
|
14
14
|
drudgery of handcrafting an `autoload` statement for each Ruby source code file
|
15
15
|
in your project. It also avoids the limitations of rigid convention-driven
|
16
16
|
facilities such as those provided by the [ActiveSupport][ActiveSupport-Autoload]
|
17
17
|
RubyGem.
|
18
18
|
|
19
|
-
|
19
|
+
*Autoloaded* assumes, but does not enforce, `CamelCase`-to-`snake_case`
|
20
20
|
correspondence between the names of constants and source files. You can combine
|
21
21
|
conventions, even putting multiple autoloaded constants in a single source file.
|
22
22
|
|
@@ -26,7 +26,7 @@ Install [the RubyGem][RubyGems-release].
|
|
26
26
|
|
27
27
|
$ gem install autoloaded
|
28
28
|
|
29
|
-
Use
|
29
|
+
Use *Autoloaded* in your RubyGem project by making it a runtime dependency.
|
30
30
|
|
31
31
|
```ruby
|
32
32
|
# my_awesome_gem.gemspec
|
@@ -38,7 +38,7 @@ Gem::Specification.new do |spec|
|
|
38
38
|
end
|
39
39
|
```
|
40
40
|
|
41
|
-
Or you may want to make
|
41
|
+
Or you may want to make *Autoloaded* a dependency of your project by using
|
42
42
|
[Bundler][Bundler].
|
43
43
|
|
44
44
|
```ruby
|
@@ -65,15 +65,15 @@ Suppose you have the following source files.
|
|
65
65
|
│ └─ version.rb
|
66
66
|
└─ my_awesome_gem.rb
|
67
67
|
|
68
|
-
### The
|
68
|
+
### The *Autoloaded.module* or *Autoloaded.class* method
|
69
69
|
|
70
|
-
The
|
71
|
-
[
|
70
|
+
The *Autoloaded.module* and *Autoloaded.class* method calls below invoke
|
71
|
+
[*Module#autoload*][Ruby-Core-Module-autoload] for each source file in the
|
72
72
|
calling module’s corresponding directory. Note that these methods must receive a
|
73
73
|
block, even if it’s an empty block.
|
74
74
|
|
75
75
|
The file paths used are abbreviated, if possible, using a directory of the Ruby
|
76
|
-
load path (`$:`). They are also rendered without their
|
76
|
+
load path (`$:`). They are also rendered without their *.rb* extension.
|
77
77
|
|
78
78
|
```ruby
|
79
79
|
# lib/my_awesome_gem.rb
|
@@ -151,7 +151,7 @@ MyAwesomeGem::DB::Mysql # Raises NameError because
|
|
151
151
|
|
152
152
|
### The `with` specification
|
153
153
|
|
154
|
-
|
154
|
+
*Autoloaded* needs hints from you concerning unpredictable spellings,
|
155
155
|
stylization, and organization of constant names and/or source file names. You can
|
156
156
|
specify `with` as:
|
157
157
|
|
@@ -339,9 +339,9 @@ cumulative.
|
|
339
339
|
|
340
340
|
### The `from` specification
|
341
341
|
|
342
|
-
It’s recommended that you call
|
342
|
+
It’s recommended that you call *Autoloaded.module* or *Autoloaded.class* from
|
343
343
|
within the source file where your module or class is defined. This practice
|
344
|
-
allows
|
344
|
+
allows *Autoloaded* to assume that the source files to be autoloaded are in a
|
345
345
|
directory of the same name (and in the same location) as the module’s defining
|
346
346
|
source file.
|
347
347
|
|
@@ -370,18 +370,18 @@ end
|
|
370
370
|
A path provided to `from` cannot be relative; it must start with the filesystem
|
371
371
|
root.
|
372
372
|
|
373
|
-
If you specify `from` multiple times in an
|
373
|
+
If you specify `from` multiple times in an *Autoloaded* block, only the last one
|
374
374
|
takes effect.
|
375
375
|
|
376
|
-
### The
|
376
|
+
### The *Autoloaded.warn* method
|
377
377
|
|
378
|
-
There are two circumstances under which
|
378
|
+
There are two circumstances under which *Autoloaded* by default will write
|
379
379
|
warnings to stderr:
|
380
380
|
|
381
381
|
* Overriding an established autoload
|
382
382
|
* Establishing an autoload for a defined constant
|
383
383
|
|
384
|
-
You can silence these warnings by passing `false` to
|
384
|
+
You can silence these warnings by passing `false` to *Autoloaded.warn*. (Passing
|
385
385
|
`true` turns warnings on if they are off.)
|
386
386
|
|
387
387
|
```ruby
|
@@ -437,7 +437,7 @@ end
|
|
437
437
|
|
438
438
|
### How to debug autoloading
|
439
439
|
|
440
|
-
The
|
440
|
+
The *Autoloaded.module* or *Autoloaded.class* method returns an ordered list of
|
441
441
|
arguments it has passed to `autoload`.
|
442
442
|
|
443
443
|
```ruby
|
@@ -464,20 +464,20 @@ end
|
|
464
464
|
# [:PostgreSQL, 'my_awesome_gem/db/postgre_sql']]
|
465
465
|
```
|
466
466
|
|
467
|
-
You can also hook [
|
468
|
-
[
|
467
|
+
You can also hook [*Module#autoload*][Ruby-Core-Module-autoload] and
|
468
|
+
[*Kernel#autoload*][Ruby-Core-Kernel-autoload] via monkeypatching or other means
|
469
469
|
in order to see what’s happening.
|
470
470
|
|
471
471
|
### Source filenames are relative to the `from` specification
|
472
472
|
|
473
473
|
You may have noticed that source filenames in the above examples are not
|
474
|
-
absolute. They are relative to the
|
474
|
+
absolute. They are relative to the *Autoloaded* block’s `from` specification
|
475
475
|
(which I recommend that you allow to be computed for you —
|
476
476
|
[see above](#the-from-specification)).
|
477
477
|
|
478
478
|
### Recursive autoloading not supported
|
479
479
|
|
480
|
-
|
480
|
+
*Autoloaded* does not perform deep autoloading of nested namespaces and
|
481
481
|
directories. This is by design.
|
482
482
|
|
483
483
|
## Contributing
|
@@ -496,9 +496,9 @@ run the tests. You can also `bin/console` to get an interactive prompt that will
|
|
496
496
|
allow you to experiment.
|
497
497
|
|
498
498
|
To install this gem onto your local machine, `bundle exec rake install`. To
|
499
|
-
release a new version, update the version number in
|
499
|
+
release a new version, update the version number in *lib/autoloaded/version.rb*,
|
500
500
|
and then `bundle exec rake release`, which will create a Git tag for the version,
|
501
|
-
push Git commits and tags, and push the
|
501
|
+
push Git commits and tags, and push the *.gem* file to
|
502
502
|
[RubyGems.org](RubyGems-release).
|
503
503
|
|
504
504
|
## License
|
data/autoloaded.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.homepage = 'https://njonsson.github.io/autoloaded'
|
32
32
|
spec.license = 'MIT'
|
33
33
|
|
34
|
-
spec.required_ruby_version = '
|
34
|
+
spec.required_ruby_version = '>= 2', '< 4'
|
35
35
|
|
36
36
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
|
37
37
|
if RUBY_VERSION < '2.2'
|
data/lib/autoloaded/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoloaded
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nils Jonsson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codeclimate-test-reporter
|
@@ -101,23 +101,26 @@ homepage: https://njonsson.github.io/autoloaded
|
|
101
101
|
licenses:
|
102
102
|
- MIT
|
103
103
|
metadata: {}
|
104
|
-
post_install_message:
|
104
|
+
post_install_message:
|
105
105
|
rdoc_options: []
|
106
106
|
require_paths:
|
107
107
|
- lib
|
108
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - "
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '2'
|
113
|
+
- - "<"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '4'
|
113
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
117
|
requirements:
|
115
118
|
- - ">="
|
116
119
|
- !ruby/object:Gem::Version
|
117
120
|
version: '0'
|
118
121
|
requirements: []
|
119
|
-
rubygems_version: 3.
|
120
|
-
signing_key:
|
122
|
+
rubygems_version: 3.2.20
|
123
|
+
signing_key:
|
121
124
|
specification_version: 4
|
122
125
|
summary: Eliminates the drudgery of handcrafting a Ruby Core library `autoload` statement
|
123
126
|
for each Ruby source code file in your project. It also avoids the limitations of
|