autoloaded 2.0.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 925ea1aba0f2ef88679610b9991b59b47d1624bb
4
- data.tar.gz: 9a76651fade295cb47f3aa0bb13d4a1d38da1bb6
3
+ metadata.gz: ce4e11f3e21833a7a07926a9a973543eeef9c3c0
4
+ data.tar.gz: b2904d86323289f9880426b8d8017446453fd59e
5
5
  SHA512:
6
- metadata.gz: ff3a0b9a5ad7f85e1302b6e3d9b1757e13e2dda0c85feeb8f06184b461773503acb41d5dadb487e4219e4c9a485bfebbf0bc7055c1c9e240a84d00d638fba0de
7
- data.tar.gz: 2f438027039fa6e9fc1b23c5b2669864fe5dff3b5ed2a7576495d33f0552a14d8f063b67c8a0295b173001c12ff307ad1fda82f2ff498d10c87cfab47dd902fa
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.0.0"></a>v2.0.0, Sat 12/27/2013
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/2013
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/2013
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/2013
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/2013
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', '~> 1'
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', '~> 1'
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] the source code context in which autoloading is to occur.
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.fetch :deprecated_usage do
40
- raise ::ArgumentError, 'missing keyword: deprecated_usage'
41
- end
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
@@ -1,8 +1,8 @@
1
1
  module Autoloaded; end
2
2
 
3
3
  # Translates source filenames into constants.
4
- #
5
- # @since 1.3
4
+ #
5
+ # @since 1.3
6
6
  #
7
7
  # @api private
8
8
  module Autoloaded::Inflection
@@ -8,26 +8,32 @@ module Autoloaded; end
8
8
  class Autoloaded::Specifications
9
9
 
10
10
  # @!method except
11
- # Specifications for excluding source files from being autoloaded.
11
+ # _Specifications_ for excluding source files from being autoloaded.
12
12
  #
13
- # @return [Array of Specification] a list of specifications
13
+ # @return [Array of Specification]
14
+ #
15
+ # @see Specification
14
16
  #
15
17
  # @api private
16
18
  #
17
19
  # @!method only
18
- # Specifications for narrowing the set of source files being autoloaded as
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] a list of specifications
24
+ # @return [Array of Specification]
25
+ #
26
+ # @see Specification
23
27
  #
24
28
  # @api private
25
29
  #
26
30
  # @!method with
27
- # Specifications for renaming and/or reorganizing the constants corresponding
31
+ # _Specifications_ for renaming and/or reorganizing the constants corresponding
28
32
  # to source files being autoloaded.
29
33
  #
30
- # @return [Array of Specification] a list of specifications
34
+ # @return [Array of Specification]
35
+ #
36
+ # @see Specification
31
37
  #
32
38
  # @api private
33
39
  [:except, :only, :with].each do |attribute_name|
@@ -3,6 +3,6 @@ module Autoloaded
3
3
  # The current version of the _Autoloaded_ project.
4
4
  #
5
5
  # @since 0.0.1
6
- VERSION = '2.0.0'
6
+ VERSION = '2.1.1'
7
7
 
8
8
  end
@@ -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 = keywords.fetch :constant_name do
42
- raise ::ArgumentError, 'missing keyword: constant_name'
43
- end
44
- old_source_filename = keywords.fetch :old_source_filename do
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 = keywords.fetch :constant_name do
114
- raise ::ArgumentError, 'missing keyword: constant_name'
115
- end
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.0.0
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: 2014-12-27 00:00:00.000000000 Z
11
+ date: 2015-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler