autoloaded 2.0.0 → 2.1.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/History.md +9 -5
- data/README.md +2 -2
- data/lib/autoloaded/autoloader.rb +6 -1
- data/lib/autoloaded/deprecation.rb +11 -9
- data/lib/autoloaded/inflection.rb +2 -2
- data/lib/autoloaded/specifications.rb +12 -6
- data/lib/autoloaded/version.rb +1 -1
- data/lib/autoloaded/warning.rb +13 -21
- 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: ce4e11f3e21833a7a07926a9a973543eeef9c3c0
|
4
|
+
data.tar.gz: b2904d86323289f9880426b8d8017446453fd59e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6eaa374b835840d80a1bf88ce5caee2f53592064f8df8c77a493bc6a2a6feb003b37c36e20f35789b5132db2ddf2ed9264d2218d9ef0bef3490b7d742326deab
|
7
|
+
data.tar.gz: ab0c372b54d4f5949c9cf68737c728ce83f92476958b3228d83d8bdf8a2367efab07bf8109de8bb8e371ad95df2378cb19f6086ddc59eca8165f63f9ed3849ce
|
data/History.md
CHANGED
@@ -1,19 +1,23 @@
|
|
1
1
|
# Version history for the _Autoloaded_ project
|
2
2
|
|
3
|
-
## <a name="v2.
|
3
|
+
## <a name="v2.1.1"></a>v2.1.1 and <a name="v1.4.1"></a>v1.4.1, Sat 1/24/2015
|
4
|
+
|
5
|
+
* Don’t warn about a _VERSION_ constant presumably loaded by a _.gemspec_
|
6
|
+
|
7
|
+
## <a name="v2.0.0"></a>v2.0.0, Sat 12/27/2014
|
4
8
|
|
5
9
|
* Add support for Ruby v1.9.x
|
6
10
|
* Remove deprecated API
|
7
11
|
|
8
|
-
## <a name="v1.3.0"></a>v1.3.0, Fri 12/26/
|
12
|
+
## <a name="v1.3.0"></a>v1.3.0, Fri 12/26/2014
|
9
13
|
|
10
14
|
* Add support for relative class references with a new API
|
11
15
|
|
12
|
-
## <a name="v1.2.0"></a>v1.2.0, Fri 11/28/
|
16
|
+
## <a name="v1.2.0"></a>v1.2.0, Fri 11/28/2014
|
13
17
|
|
14
18
|
* Add support for [JRuby][JRuby] (Ruby v2.x-compatible versions)
|
15
19
|
|
16
|
-
## <a name="v1.1.0"></a>v1.1.0, Tue 11/04/
|
20
|
+
## <a name="v1.1.0"></a>v1.1.0, Tue 11/04/2014
|
17
21
|
|
18
22
|
* Correct/improve autoload behavior
|
19
23
|
* Instead of returning the source **directory** path from
|
@@ -24,7 +28,7 @@
|
|
24
28
|
[_Module#constants_][Ruby-Core-Module-constants] in the [readme][readme] and
|
25
29
|
in [inline documentation][inline-documentation]
|
26
30
|
|
27
|
-
## <a name="v1.0.0"></a>v1.0.0, Wed 10/29/
|
31
|
+
## <a name="v1.0.0"></a>v1.0.0, Wed 10/29/2014
|
28
32
|
|
29
33
|
* Add support for Ruby v2.0
|
30
34
|
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Use _Autoloaded_ in your RubyGem project by making it a runtime dependency.
|
|
34
34
|
|
35
35
|
Gem::Specification.new do |spec|
|
36
36
|
# ...
|
37
|
-
spec.add_dependency 'autoloaded', '~>
|
37
|
+
spec.add_dependency 'autoloaded', '~> 2'
|
38
38
|
# ...
|
39
39
|
end
|
40
40
|
```
|
@@ -47,7 +47,7 @@ Or you may want to make _Autoloaded_ a dependency of your project by using
|
|
47
47
|
|
48
48
|
source 'http://rubygems.org'
|
49
49
|
|
50
|
-
gem 'autoloaded', '~>
|
50
|
+
gem 'autoloaded', '~> 2'
|
51
51
|
```
|
52
52
|
|
53
53
|
## Usage
|
@@ -7,7 +7,7 @@ module Autoloaded
|
|
7
7
|
|
8
8
|
# The source code context in which autoloading is to occur.
|
9
9
|
#
|
10
|
-
# @return [Binding]
|
10
|
+
# @return [Binding]
|
11
11
|
#
|
12
12
|
# @see #autoload!
|
13
13
|
#
|
@@ -79,6 +79,11 @@ module Autoloaded
|
|
79
79
|
constant_names.each do |const|
|
80
80
|
next unless existing_constant?(const)
|
81
81
|
|
82
|
+
# Don't warn about an existing MyAwesomeGem::VERSION constant since
|
83
|
+
# probably it was loaded by a `require 'my_awesome_gem/version'`
|
84
|
+
# statement in 'my_awesome_gem.gemspec'.
|
85
|
+
next if (const == :VERSION)
|
86
|
+
|
82
87
|
Warning.existing_constant constant_name: constant_full_name(const),
|
83
88
|
source_filename: source_filename,
|
84
89
|
host_source_location: host_source_location
|
@@ -36,15 +36,9 @@ module Autoloaded::Deprecation
|
|
36
36
|
#
|
37
37
|
# @raise [ArgumentError] one or more keywords are missing
|
38
38
|
def deprecate(keywords)
|
39
|
-
deprecated_usage = keywords
|
40
|
-
|
41
|
-
|
42
|
-
sanctioned_usage = keywords.fetch :sanctioned_usage do
|
43
|
-
raise ::ArgumentError, 'missing keyword: sanctioned_usage'
|
44
|
-
end
|
45
|
-
source_filename = keywords.fetch :source_filename do
|
46
|
-
raise ::ArgumentError, 'missing keyword: source_filename'
|
47
|
-
end
|
39
|
+
deprecated_usage = fetch(keywords, :deprecated_usage)
|
40
|
+
sanctioned_usage = fetch(keywords, :sanctioned_usage)
|
41
|
+
source_filename = fetch(keywords, :source_filename)
|
48
42
|
|
49
43
|
deprecation = "\e[33m*** \e[7m DEPRECATED \e[0m " +
|
50
44
|
"\e[4m#{deprecated_usage}\e[0m -- use " +
|
@@ -54,6 +48,14 @@ module Autoloaded::Deprecation
|
|
54
48
|
self
|
55
49
|
end
|
56
50
|
|
51
|
+
private
|
52
|
+
|
53
|
+
def fetch(keywords, keyword)
|
54
|
+
keywords.fetch keyword do
|
55
|
+
raise ::ArgumentError, "missing keyword: #{keyword}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
57
59
|
end
|
58
60
|
|
59
61
|
end
|
@@ -8,26 +8,32 @@ module Autoloaded; end
|
|
8
8
|
class Autoloaded::Specifications
|
9
9
|
|
10
10
|
# @!method except
|
11
|
-
#
|
11
|
+
# _Specifications_ for excluding source files from being autoloaded.
|
12
12
|
#
|
13
|
-
# @return [Array of Specification]
|
13
|
+
# @return [Array of Specification]
|
14
|
+
#
|
15
|
+
# @see Specification
|
14
16
|
#
|
15
17
|
# @api private
|
16
18
|
#
|
17
19
|
# @!method only
|
18
|
-
#
|
20
|
+
# _Specifications_ for narrowing the set of source files being autoloaded as
|
19
21
|
# well as optionally renaming and/or reorganizing their corresponding
|
20
22
|
# constants.
|
21
23
|
#
|
22
|
-
# @return [Array of Specification]
|
24
|
+
# @return [Array of Specification]
|
25
|
+
#
|
26
|
+
# @see Specification
|
23
27
|
#
|
24
28
|
# @api private
|
25
29
|
#
|
26
30
|
# @!method with
|
27
|
-
#
|
31
|
+
# _Specifications_ for renaming and/or reorganizing the constants corresponding
|
28
32
|
# to source files being autoloaded.
|
29
33
|
#
|
30
|
-
# @return [Array of Specification]
|
34
|
+
# @return [Array of Specification]
|
35
|
+
#
|
36
|
+
# @see Specification
|
31
37
|
#
|
32
38
|
# @api private
|
33
39
|
[:except, :only, :with].each do |attribute_name|
|
data/lib/autoloaded/version.rb
CHANGED
data/lib/autoloaded/warning.rb
CHANGED
@@ -38,18 +38,10 @@ module Autoloaded::Warning
|
|
38
38
|
#
|
39
39
|
# @raise [ArgumentError] one or more keywords are missing
|
40
40
|
def changing_autoload(keywords)
|
41
|
-
constant_name
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
raise ::ArgumentError, 'missing keyword: old_source_filename'
|
46
|
-
end
|
47
|
-
new_source_filename = keywords.fetch :new_source_filename do
|
48
|
-
raise ::ArgumentError, 'missing keyword: new_source_filename'
|
49
|
-
end
|
50
|
-
host_source_location = keywords.fetch :host_source_location do
|
51
|
-
raise ::ArgumentError, 'missing keyword: host_source_location'
|
52
|
-
end
|
41
|
+
constant_name = fetch(keywords, :constant_name)
|
42
|
+
old_source_filename = fetch(keywords, :old_source_filename)
|
43
|
+
new_source_filename = fetch(keywords, :new_source_filename)
|
44
|
+
host_source_location = fetch(keywords, :host_source_location)
|
53
45
|
|
54
46
|
message = "Existing autoload of \e[4m#{constant_name}\e[0m from " +
|
55
47
|
"#{old_source_filename.inspect} is being overridden to " +
|
@@ -110,15 +102,9 @@ module Autoloaded::Warning
|
|
110
102
|
#
|
111
103
|
# @raise [ArgumentError] one or more keywords are missing
|
112
104
|
def existing_constant(keywords)
|
113
|
-
constant_name
|
114
|
-
|
115
|
-
|
116
|
-
source_filename = keywords.fetch :source_filename do
|
117
|
-
raise ::ArgumentError, 'missing keyword: source_filename'
|
118
|
-
end
|
119
|
-
host_source_location = keywords.fetch :host_source_location do
|
120
|
-
raise ::ArgumentError, 'missing keyword: host_source_location'
|
121
|
-
end
|
105
|
+
constant_name = fetch(keywords, :constant_name)
|
106
|
+
source_filename = fetch(keywords, :source_filename)
|
107
|
+
host_source_location = fetch(keywords, :host_source_location)
|
122
108
|
|
123
109
|
message = "Existing definition of \e[4m#{constant_name}\e[0m obviates " +
|
124
110
|
"autoloading from #{source_filename.inspect} -- avoid this " +
|
@@ -129,6 +115,12 @@ module Autoloaded::Warning
|
|
129
115
|
|
130
116
|
private
|
131
117
|
|
118
|
+
def fetch(keywords, keyword)
|
119
|
+
keywords.fetch keyword do
|
120
|
+
raise ::ArgumentError, "missing keyword: #{keyword}"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
132
124
|
def not!(value)
|
133
125
|
value.nil? || (value == false)
|
134
126
|
end
|
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: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nils Jonsson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|