autoloaded 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -8
- data/.rspec +1 -1
- data/.travis.yml +15 -0
- data/Gemfile +12 -9
- data/Gemfile_ci_mri_19 +7 -0
- data/Guardfile +21 -22
- data/History.md +10 -4
- data/README.md +47 -30
- data/Rakefile +4 -0
- data/autoloaded.gemspec +37 -36
- data/bin/console +10 -0
- data/bin/setup +8 -0
- data/lib/autoloaded/autoloader.rb +6 -0
- data/lib/autoloaded/deprecation.rb +0 -2
- data/lib/autoloaded/inflection.rb +0 -2
- data/lib/autoloaded/load_pathed_directory.rb +1 -3
- data/lib/autoloaded/specification.rb +2 -0
- data/lib/autoloaded/specifications.rb +0 -2
- data/lib/autoloaded/version.rb +1 -1
- data/lib/autoloaded/warning.rb +0 -2
- data/lib/tasks/lib_each.rake +15 -3
- data/lib/tasks/spec.rake +3 -6
- metadata +24 -74
- data/spec/autoloaded/autoloader_spec.rb +0 -469
- data/spec/autoloaded/inflection_spec.rb +0 -30
- data/spec/autoloaded/load_pathed_directory_spec.rb +0 -120
- data/spec/autoloaded/specification_spec.rb +0 -98
- data/spec/autoloaded/specifications_spec.rb +0 -191
- data/spec/autoloaded/version_spec.rb +0 -3
- data/spec/autoloaded/warning_spec.rb +0 -115
- data/spec/autoloaded_macro_sharedspec.rb +0 -24
- data/spec/autoloaded_spec.rb +0 -173
- data/spec/fixtures/autoloaded_with_conventional_filename.rb +0 -12
- data/spec/fixtures/autoloaded_with_conventional_filename/N-est-ed.rb +0 -1
- data/spec/fixtures/autoloaded_with_conventional_filename/nest_ed.rb +0 -1
- data/spec/fixtures/autoloaded_with_conventional_filename/nested.rb +0 -16
- data/spec/fixtures/autoloaded_with_conventional_filename/nested/doubly_nested.rb +0 -9
- data/spec/fixtures/autoloaded_with_conventional_filename/old_school_autoload.rb +0 -5
- data/spec/fixtures/autoloaded_with_unconventional_filename.rb +0 -12
- data/spec/fixtures/autoloaded_with_unconventional_filename/N-est-ed.rb +0 -7
- data/spec/fixtures/autoloaded_with_unconventional_filename/nest_ed.rb +0 -1
- data/spec/fixtures/autoloaded_with_unconventional_filename/old_school_autoload.rb +0 -5
- data/spec/fixtures/filenames/AFilename.rb +0 -0
- data/spec/fixtures/filenames/a-file-name.rb +0 -0
- data/spec/fixtures/filenames/a-filename.rb +0 -0
- data/spec/fixtures/filenames/a_file_name.rb +0 -0
- data/spec/fixtures/filenames/a_filename.rb +0 -0
- data/spec/fixtures/filenames/afile-name.rb +0 -0
- data/spec/fixtures/filenames/afile_name.rb +0 -0
- data/spec/fixtures/not_autoloaded.rb +0 -5
- data/spec/fixtures/not_autoloaded/nested.rb +0 -1
- data/spec/fixtures/not_autoloaded/old_school_autoload.rb +0 -5
- data/spec/matchers.rb +0 -85
- data/spec/spec_helper.rb +0 -91
- data/spec/support/util.rb +0 -42
- data/spec/support/without_side_effects.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b0bcd64a5dc57c864b540c419b314adc30956c8
|
4
|
+
data.tar.gz: 123e9bfd7e9ce087f6567255ce58c7b0f7fd979a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59e0246f3a164323ae7c379861488d77d943b72968ddbaee57ee9bc6f8142580ba05bddc36f330622d549eb8d863e0d73f1b9611e20a87020623dc7821ce351e
|
7
|
+
data.tar.gz: 6906ecfd5c252b431422dd2d98a446ff9b1ad60a673fb0f0359b9853638e0a5ecd0503521b86c47e2d6f1c21c54feb1379b8733b69ac3a4ee5727e9e02d22e9b
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/.travis.yml
CHANGED
@@ -1,13 +1,28 @@
|
|
1
1
|
language: ruby
|
2
|
+
before_install: gem install bundler
|
2
3
|
bundler_args: --without debug doc tooling
|
3
4
|
rvm:
|
4
5
|
- 1.9
|
5
6
|
- 2.0
|
6
7
|
- 2.1
|
8
|
+
- 2.2
|
9
|
+
- 2.3
|
7
10
|
- ruby-head
|
8
11
|
- jruby-head
|
12
|
+
- rbx
|
13
|
+
- rbx-2
|
9
14
|
script: "bundle exec rake test"
|
10
15
|
matrix:
|
11
16
|
allow_failures:
|
12
17
|
- rvm: ruby-head
|
13
18
|
- rvm: jruby-head
|
19
|
+
- rvm: rbx
|
20
|
+
- rvm: rbx-2
|
21
|
+
exclude:
|
22
|
+
- rvm: 1.9
|
23
|
+
include:
|
24
|
+
- rvm: 1.9
|
25
|
+
gemfile: Gemfile_ci_mri_19
|
26
|
+
branches:
|
27
|
+
except:
|
28
|
+
- /^gh-pages.*$/
|
data/Gemfile
CHANGED
@@ -3,22 +3,25 @@ source 'https://rubygems.org'
|
|
3
3
|
gemspec
|
4
4
|
|
5
5
|
group :debug do
|
6
|
-
gem 'pry-byebug',
|
7
|
-
|
6
|
+
gem 'pry-byebug', '~> 3', platforms: [:mri_20,
|
7
|
+
:mri_21,
|
8
|
+
:mri_22,
|
9
|
+
:mri_23]
|
10
|
+
gem 'pry-debugger', '~> 0', platforms: :mri_19
|
8
11
|
end
|
9
12
|
|
10
|
-
group :
|
11
|
-
gem '
|
12
|
-
gem 'rdiscount', '~> 2', require: false, platforms: :mri
|
13
|
+
group :development do
|
14
|
+
gem 'json', '~> 2', require: false
|
13
15
|
end
|
14
16
|
|
15
|
-
group :
|
16
|
-
gem '
|
17
|
+
group :doc do
|
18
|
+
gem 'yard', '~> 0', require: false
|
19
|
+
gem 'rdiscount', '~> 2', require: false
|
17
20
|
end
|
18
21
|
|
19
22
|
group :tooling do
|
20
|
-
gem 'guard-rspec',
|
23
|
+
gem 'guard-rspec', '~> 4', require: false
|
21
24
|
if RUBY_PLATFORM =~ /darwin/i
|
22
|
-
gem 'rb-fsevent',
|
25
|
+
gem 'rb-fsevent', '~> 0', require: false
|
23
26
|
end
|
24
27
|
end
|
data/Gemfile_ci_mri_19
ADDED
data/Guardfile
CHANGED
@@ -1,38 +1,37 @@
|
|
1
|
-
|
1
|
+
require 'guard/rspec/dsl'
|
2
2
|
|
3
3
|
debugger_gem = %w(pry-byebug pry-debugger).detect do |gem|
|
4
4
|
`bundle show #{gem} 2>&1 >/dev/null`
|
5
5
|
$?.success?
|
6
6
|
end
|
7
7
|
debugger_require = debugger_gem ? " --require #{debugger_gem}" : nil
|
8
|
-
guard :rspec, all_after_pass: true,
|
9
|
-
all_on_start: true,
|
10
|
-
cmd: "bundle exec rspec#{debugger_require} --format progress" do
|
11
|
-
# Run the corresponding spec (or all specs) when code changes.
|
12
|
-
watch( %r{^lib/(.+)\.rb$} ) do |match|
|
13
|
-
Dir["spec/#{match[1]}_spec.rb"].first || 'spec'
|
14
|
-
end
|
15
8
|
|
16
|
-
|
17
|
-
|
9
|
+
guard :rspec, all_on_start: true,
|
10
|
+
all_after_pass: true,
|
11
|
+
cmd: "bundle exec rspec --format progress#{debugger_require}" do
|
12
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
13
|
+
rspec, ruby = dsl.rspec, dsl.ruby
|
18
14
|
|
19
|
-
#
|
20
|
-
watch(
|
15
|
+
# RSpec files
|
16
|
+
watch('.rspec') { rspec.spec_dir }
|
17
|
+
watch rspec.spec_helper { rspec.spec_dir }
|
18
|
+
watch rspec.spec_support { rspec.spec_dir }
|
19
|
+
watch(%r{^spec/support}) { rspec.spec_dir } # This should not be necessary.
|
20
|
+
watch rspec.spec_files
|
21
21
|
|
22
22
|
# Run all specs when a matcher changes.
|
23
|
-
watch(
|
23
|
+
watch('spec/matchers.rb') { 'spec' }
|
24
24
|
|
25
|
-
# Run all specs when a
|
26
|
-
watch(
|
25
|
+
# Run all specs when a shared spec changes.
|
26
|
+
watch(%r{^spec/.+_sharedspec\.rb$}) { rspec.spec_dir }
|
27
27
|
|
28
28
|
# Run all specs when a fixture changes.
|
29
|
-
watch(
|
30
|
-
|
31
|
-
# Run all specs when the RSpec configuration changes.
|
32
|
-
watch( '.rspec' ) { 'spec' }
|
33
|
-
watch( 'spec/spec_helper.rb' ) { 'spec' }
|
29
|
+
watch(%r{^spec/fixtures}) { rspec.spec_dir }
|
34
30
|
|
35
31
|
# Run all specs when the bundle changes.
|
36
|
-
watch(
|
37
|
-
watch(
|
32
|
+
watch('Gemfile.lock') { rspec.spec_dir }
|
33
|
+
watch(%r{^(.+)\.gemspec$}) { rspec.spec_dir }
|
34
|
+
|
35
|
+
# Ruby files
|
36
|
+
dsl.watch_spec_files_for ruby.lib_files
|
38
37
|
end
|
data/History.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Version history for the _Autoloaded_ project
|
2
2
|
|
3
|
+
## <a name="v2.2.0"></a>v2.2.0 and <a name="v1.5.0"></a>v1.5.0, Wed 2/22/2017
|
4
|
+
|
5
|
+
* Add support for Ruby load paths (`$:`) that contain one or more
|
6
|
+
[_Pathname_][Ruby-Stdlib-Pathname] objects
|
7
|
+
|
3
8
|
## <a name="v2.1.1"></a>v2.1.1 and <a name="v1.4.1"></a>v1.4.1, Sat 1/24/2015
|
4
9
|
|
5
10
|
* Don’t warn about a _VERSION_ constant presumably loaded by a _.gemspec_
|
@@ -37,7 +42,8 @@
|
|
37
42
|
(First release)
|
38
43
|
|
39
44
|
[JRuby]: http://jruby.org
|
40
|
-
[Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload-3F
|
41
|
-
[Ruby-Core-Module-constants]: http://ruby-doc.org/core/Module.html#method-i-constants
|
42
|
-
[
|
43
|
-
[
|
45
|
+
[Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload-3F "‘Module#autoload’ method in the Ruby Core Library"
|
46
|
+
[Ruby-Core-Module-constants]: http://ruby-doc.org/core/Module.html#method-i-constants "‘Module#constants’ method in the Ruby Core Library"
|
47
|
+
[Ruby-Stdlib-Pathname]: http://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html "‘Pathname’ class in the Ruby Standard Library"
|
48
|
+
[readme]: http://github.com/njonsson/autoloaded/blob/master/README.md "Autoloaded readme"
|
49
|
+
[inline-documentation]: http://www.rubydoc.info/github/njonsson/autoloaded "Autoloaded inline documentation"
|
data/README.md
CHANGED
@@ -173,21 +173,21 @@ You can specify `with` multiple times, and its effects are cumulative.
|
|
173
173
|
# lib/my_awesome_gem.rb
|
174
174
|
module MyAwesomeGem
|
175
175
|
|
176
|
-
Autoloaded.module do |
|
177
|
-
|
176
|
+
Autoloaded.module do |autoloading|
|
177
|
+
autoloading.with :DB, :VERSION
|
178
178
|
# Or:
|
179
|
-
#
|
180
|
-
#
|
179
|
+
# autoloading.with :DB
|
180
|
+
# autoloading.with :VERSION
|
181
181
|
# Or:
|
182
|
-
#
|
182
|
+
# autoloading.with DB: 'db', VERSION: 'version'
|
183
183
|
# Or:
|
184
|
-
#
|
185
|
-
#
|
184
|
+
# autoloading.with DB: 'db'
|
185
|
+
# autoloading.with VERSION: 'version'
|
186
186
|
# Or:
|
187
|
-
#
|
187
|
+
# autoloading.with 'db' => :DB, 'version' => :VERSION
|
188
188
|
# Or:
|
189
|
-
#
|
190
|
-
#
|
189
|
+
# autoloading.with 'db' => :DB
|
190
|
+
# autoloading.with 'version' => :VERSION
|
191
191
|
end
|
192
192
|
|
193
193
|
# The above is the equivalent of:
|
@@ -202,20 +202,22 @@ module MyAwesomeGem
|
|
202
202
|
|
203
203
|
class DB
|
204
204
|
|
205
|
-
Autoloaded.class do |
|
206
|
-
|
205
|
+
Autoloaded.class do |autoloading|
|
206
|
+
autoloading.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
|
207
207
|
# Or:
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
208
|
+
# autoloading.with :MySQL,
|
209
|
+
# :PostgreSQL,
|
210
|
+
# Access: 'MicroSoft',
|
211
|
+
# SQLServer: 'MicroSoft'
|
212
212
|
# Or:
|
213
|
-
#
|
213
|
+
# autoloading.with :MySQL,
|
214
|
+
# :PostgreSQL,
|
215
|
+
# 'MicroSoft' => [:Access, :SQLServer]
|
214
216
|
# Or:
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
#
|
217
|
+
# autoloading.with :MySQL,
|
218
|
+
# :PostgreSQL,
|
219
|
+
# 'MicroSoft' => :Access,
|
220
|
+
# 'MicroSoft' => :SQLServer
|
219
221
|
# Or ...
|
220
222
|
end
|
221
223
|
|
@@ -283,12 +285,12 @@ module MyAwesomeGem
|
|
283
285
|
|
284
286
|
class DB
|
285
287
|
|
286
|
-
Autoloaded.class do |
|
287
|
-
|
288
|
+
Autoloaded.class do |autoloading|
|
289
|
+
autoloading.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
|
288
290
|
|
289
|
-
|
291
|
+
autoloading.except 'SELF-DESTRUCT!'
|
290
292
|
# Or:
|
291
|
-
#
|
293
|
+
# autoloading.except :SELF_DESTRUCT_
|
292
294
|
# Or ...
|
293
295
|
end
|
294
296
|
|
@@ -357,12 +359,12 @@ which source files should be autoloaded.
|
|
357
359
|
|
358
360
|
module MyAwesomeGem
|
359
361
|
|
360
|
-
Autoloaded.module do |
|
362
|
+
Autoloaded.module do |autoloading|
|
361
363
|
# The following code is not actually very useful since the installed location
|
362
364
|
# of a RubyGem varies with the operating system and user preferences. How to
|
363
365
|
# compute the path properly is outside the scope of this readme and is left
|
364
366
|
# as an exercise for the reader.
|
365
|
-
|
367
|
+
autoloading.from '/absolute/path/to/my_awesome_gem'
|
366
368
|
end
|
367
369
|
|
368
370
|
end
|
@@ -448,9 +450,11 @@ module MyAwesomeGem
|
|
448
450
|
|
449
451
|
class DB
|
450
452
|
|
451
|
-
results = Autoloaded.class do |
|
452
|
-
|
453
|
-
|
453
|
+
results = Autoloaded.class do |autoloading|
|
454
|
+
autoloading.with :MySQL,
|
455
|
+
:PostgreSQL,
|
456
|
+
[:Access, :SQLServer] => 'MicroSoft'
|
457
|
+
autoloading.except 'SELF-DESTRUCT!'
|
454
458
|
end
|
455
459
|
STDOUT.puts results.inspect # See output below.
|
456
460
|
|
@@ -489,6 +493,19 @@ directories. This is by design.
|
|
489
493
|
4. Push to the branch: `git push origin my-new-feature`.
|
490
494
|
5. [Create][compare-Autoloaded-branches] a new pull request.
|
491
495
|
|
496
|
+
Development
|
497
|
+
-----------
|
498
|
+
|
499
|
+
After cloning the repository, `bin/setup` to install dependencies. Then `rake` to
|
500
|
+
run the tests. You can also `bin/console` to get an interactive prompt that will
|
501
|
+
allow you to experiment.
|
502
|
+
|
503
|
+
To install this gem onto your local machine, `bundle exec rake install`. To
|
504
|
+
release a new version, update the version number in _lib/autoloaded/version.rb_,
|
505
|
+
and then `bundle exec rake release`, which will create a Git tag for the version,
|
506
|
+
push Git commits and tags, and push the _.gem_ file to
|
507
|
+
[RubyGems.org](RubyGems-release).
|
508
|
+
|
492
509
|
## License
|
493
510
|
|
494
511
|
Released under the [MIT License][MIT-License].
|
data/Rakefile
CHANGED
data/autoloaded.gemspec
CHANGED
@@ -1,46 +1,47 @@
|
|
1
1
|
# coding: utf-8
|
2
|
-
|
3
2
|
lib = File.expand_path('../lib', __FILE__)
|
4
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
|
6
|
-
require 'autoloaded'
|
4
|
+
require 'autoloaded/version'
|
7
5
|
|
8
6
|
Gem::Specification.new do |spec|
|
9
|
-
spec.name
|
10
|
-
spec.version
|
11
|
-
spec.authors
|
12
|
-
spec.email
|
13
|
-
spec.summary = <<-end_summary.chomp.gsub(/^\s+/, '').gsub("\n", ' ')
|
14
|
-
Eliminates the drudgery of handcrafting a Ruby Core
|
15
|
-
library `autoload` statement for each Ruby source code
|
16
|
-
file in your project. It also avoids the limitations of
|
17
|
-
rigid convention-driven facilities such as those
|
18
|
-
provided by the ActiveSupport RubyGem.
|
19
|
-
end_summary
|
20
|
-
spec.description = <<-end_description.chomp.gsub(/^\s+/, '').gsub("\n", ' ')
|
21
|
-
If you like the ‘Module#autoload’ feature of the Ruby
|
22
|
-
Core library, you may have wished for Autoloaded. It
|
23
|
-
eliminates the drudgery of handcrafting an `autoload`
|
24
|
-
statement for each Ruby source code file in your
|
25
|
-
project. It also avoids the limitations of rigid
|
26
|
-
convention-driven facilities such as those provided by
|
27
|
-
the ActiveSupport RubyGem. Autoloaded assumes, but does
|
28
|
-
not enforce, `CamelCase`-to-`snake_case` correspondence
|
29
|
-
between the names of constants and source files. You can
|
30
|
-
combine conventions, even putting multiple autoloaded
|
31
|
-
constants in a single source file.
|
32
|
-
end_description
|
33
|
-
spec.homepage = 'http://njonsson.github.io/autoloaded'
|
34
|
-
spec.license = 'MIT'
|
7
|
+
spec.name = 'autoloaded'
|
8
|
+
spec.version = Autoloaded::VERSION
|
9
|
+
spec.authors = ['Nils Jonsson']
|
10
|
+
spec.email = ['autoloaded@nilsjonsson.com']
|
35
11
|
|
36
|
-
spec.
|
37
|
-
|
38
|
-
|
39
|
-
|
12
|
+
spec.summary = <<-end_summary.chomp.gsub(/^\s+/, '').gsub("\n", ' ')
|
13
|
+
Eliminates the drudgery of handcrafting a Ruby Core
|
14
|
+
library `autoload` statement for each Ruby source code
|
15
|
+
file in your project. It also avoids the limitations of
|
16
|
+
rigid convention-driven facilities such as those provided
|
17
|
+
by the ActiveSupport RubyGem.
|
18
|
+
end_summary
|
19
|
+
spec.description = <<-end_description.chomp.gsub(/^\s+/, '').gsub("\n", ' ')
|
20
|
+
If you like the ‘Module#autoload’ feature of the Ruby Core
|
21
|
+
library, you may have wished for Autoloaded. It eliminates
|
22
|
+
the drudgery of handcrafting an `autoload` statement for
|
23
|
+
each Ruby source code file in your project. It also avoids
|
24
|
+
the limitations of rigid convention-driven facilities such
|
25
|
+
as those provided by the ActiveSupport RubyGem. Autoloaded
|
26
|
+
assumes, but does not enforce, `CamelCase`-to-`snake_case`
|
27
|
+
correspondence between the names of constants and source
|
28
|
+
files. You can combine conventions, even putting multiple
|
29
|
+
autoloaded constants in a single source file.
|
30
|
+
end_description
|
31
|
+
spec.homepage = 'http://njonsson.github.io/autoloaded'
|
32
|
+
spec.license = 'MIT'
|
40
33
|
|
41
34
|
spec.required_ruby_version = '>= 1.9', '< 3'
|
42
35
|
|
43
|
-
spec.add_development_dependency 'bundler',
|
44
|
-
spec.add_development_dependency '
|
45
|
-
spec.add_development_dependency '
|
36
|
+
spec.add_development_dependency 'bundler', '~> 1'
|
37
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10'
|
39
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
40
|
+
|
41
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
42
|
+
f.match(%r{^(test|spec|features)/})
|
43
|
+
end
|
44
|
+
spec.bindir = 'exe'
|
45
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
|
46
|
+
spec.require_paths = %w(lib)
|
46
47
|
end
|
data/bin/console
ADDED
data/bin/setup
ADDED