autoloaded 1.4.1 → 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.
Files changed (76) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -8
  3. data/.rspec +1 -1
  4. data/.travis.yml +15 -0
  5. data/Gemfile +11 -10
  6. data/Guardfile +21 -22
  7. data/History.md +35 -10
  8. data/License.md +1 -1
  9. data/README.md +78 -68
  10. data/Rakefile +4 -0
  11. data/autoloaded.gemspec +41 -37
  12. data/bin/console +10 -0
  13. data/bin/setup +8 -0
  14. data/lib/autoloaded/autoloader.rb +24 -6
  15. data/lib/autoloaded/constant.rb +1 -0
  16. data/lib/autoloaded/deprecation.rb +0 -2
  17. data/lib/autoloaded/inflection.rb +0 -2
  18. data/lib/autoloaded/load_pathed_directory.rb +2 -4
  19. data/lib/autoloaded/specification.rb +2 -0
  20. data/lib/autoloaded/specifications.rb +3 -3
  21. data/lib/autoloaded/version.rb +1 -1
  22. data/lib/autoloaded/warning.rb +1 -3
  23. data/lib/tasks/lib_each.rake +15 -3
  24. data/lib/tasks/spec.rake +3 -6
  25. metadata +22 -121
  26. data/spec/autoloaded/autoloader_spec.rb +0 -469
  27. data/spec/autoloaded/constant_spec.rb +0 -53
  28. data/spec/autoloaded/deprecation_spec.rb +0 -23
  29. data/spec/autoloaded/inflection_spec.rb +0 -30
  30. data/spec/autoloaded/load_pathed_directory_spec.rb +0 -120
  31. data/spec/autoloaded/refine/string/to_source_filename_spec.rb +0 -19
  32. data/spec/autoloaded/specification_spec.rb +0 -98
  33. data/spec/autoloaded/specifications_spec.rb +0 -191
  34. data/spec/autoloaded/version_spec.rb +0 -3
  35. data/spec/autoloaded/warning_spec.rb +0 -115
  36. data/spec/autoloaded_macro_sharedspec.rb +0 -24
  37. data/spec/autoloaded_spec.rb +0 -321
  38. data/spec/fixtures/autoloaded_with_conventional_filename/N-est-ed.rb +0 -1
  39. data/spec/fixtures/autoloaded_with_conventional_filename/nest_ed.rb +0 -1
  40. data/spec/fixtures/autoloaded_with_conventional_filename/nested/doubly_nested.rb +0 -9
  41. data/spec/fixtures/autoloaded_with_conventional_filename/nested.rb +0 -16
  42. data/spec/fixtures/autoloaded_with_conventional_filename/old_school_autoload.rb +0 -5
  43. data/spec/fixtures/autoloaded_with_conventional_filename.rb +0 -12
  44. data/spec/fixtures/autoloaded_with_unconventional_filename/N-est-ed.rb +0 -7
  45. data/spec/fixtures/autoloaded_with_unconventional_filename/nest_ed.rb +0 -1
  46. data/spec/fixtures/autoloaded_with_unconventional_filename/old_school_autoload.rb +0 -5
  47. data/spec/fixtures/autoloaded_with_unconventional_filename.rb +0 -12
  48. data/spec/fixtures/filenames/AFilename.rb +0 -0
  49. data/spec/fixtures/filenames/a-file-name.rb +0 -0
  50. data/spec/fixtures/filenames/a-filename.rb +0 -0
  51. data/spec/fixtures/filenames/a_file_name.rb +0 -0
  52. data/spec/fixtures/filenames/a_filename.rb +0 -0
  53. data/spec/fixtures/filenames/afile-name.rb +0 -0
  54. data/spec/fixtures/filenames/afile_name.rb +0 -0
  55. data/spec/fixtures/not_autoloaded/nested.rb +0 -1
  56. data/spec/fixtures/not_autoloaded/old_school_autoload.rb +0 -5
  57. data/spec/fixtures/not_autoloaded.rb +0 -5
  58. data/spec/fixtures/old_api/autoloaded_with_conventional_filename/N-est-ed.rb +0 -1
  59. data/spec/fixtures/old_api/autoloaded_with_conventional_filename/nest_ed.rb +0 -1
  60. data/spec/fixtures/old_api/autoloaded_with_conventional_filename/nested.rb +0 -5
  61. data/spec/fixtures/old_api/autoloaded_with_conventional_filename/old_school_autoload.rb +0 -5
  62. data/spec/fixtures/old_api/autoloaded_with_conventional_filename.rb +0 -10
  63. data/spec/fixtures/old_api/autoloaded_with_conventional_filename_only/nested.rb +0 -5
  64. data/spec/fixtures/old_api/autoloaded_with_conventional_filename_only/old_school_autoload.rb +0 -5
  65. data/spec/fixtures/old_api/autoloaded_with_conventional_filename_only.rb +0 -10
  66. data/spec/fixtures/old_api/autoloaded_with_unconventional_filenames/N-est-ed.rb +0 -5
  67. data/spec/fixtures/old_api/autoloaded_with_unconventional_filenames/nest_ed.rb +0 -0
  68. data/spec/fixtures/old_api/autoloaded_with_unconventional_filenames/old_school_autoload.rb +0 -5
  69. data/spec/fixtures/old_api/autoloaded_with_unconventional_filenames.rb +0 -10
  70. data/spec/fixtures/old_api/not_autoloaded/nested.rb +0 -1
  71. data/spec/fixtures/old_api/not_autoloaded/old_school_autoload.rb +0 -5
  72. data/spec/fixtures/old_api/not_autoloaded.rb +0 -6
  73. data/spec/matchers.rb +0 -85
  74. data/spec/spec_helper.rb +0 -91
  75. data/spec/support/util.rb +0 -43
  76. data/spec/support/without_side_effects.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 002e4e92fb2d2dde6fc2e0f00ece6e13df188b1e
4
- data.tar.gz: 0806960319493b98a01a0d8be789a32e519c2050
2
+ SHA256:
3
+ metadata.gz: 0736db59154581469d671b352eed15faaa35a23d962de033d9106fd69bb56887
4
+ data.tar.gz: 58857610f89eda2d2e933767e81cb2e2901b78b4b7cc25ebbde7ff94acab75b9
5
5
  SHA512:
6
- metadata.gz: b4e6409a4cea035bc9e7d2102de99a97e0202106715b6873aad6ca1fd68f06e9850063037f03fe9c7c8bd569321729aa4d7092ac0fa56b8a67c00a7ea8b865dd
7
- data.tar.gz: 2a0e5ba02e1a4ac86269c64bb5b788e3c5a29819284fef0ff258a73cabcb7a2ec01dec351d1395c8c1e223d9c2a8e42ebc359e5d5deb25a19d0cd68ab63261cb
6
+ metadata.gz: 9a1ca3c1af68c99bb541d136fcc38e3679f59bc77da1270f6a4f9e8b225cf4ded70c4678a25312ccb1bda6a7a5ce9a6634f2c13a16bd3df9c2f0550b2f91e7c5
7
+ data.tar.gz: 97751b780b02f4d838bf0702bbae78c152ce3bcd41107369ded24f91319ed55d6388fe026cd2da9da9f642659a04096142f08d5bbef4715ad974869b1433e318
data/.gitignore CHANGED
@@ -1,16 +1,12 @@
1
1
  /.bundle/
2
- /.yardoc
2
+ /.rbx
3
+ /.ruby-*
4
+ /.yardoc/
3
5
  /Gemfile.lock
4
6
  /_yardoc/
5
7
  /coverage/
6
8
  /doc/
7
9
  /pkg/
10
+ /spec/examples.txt
8
11
  /spec/reports/
9
12
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- .ruby-gemset
15
- .ruby-version
16
- mkmf.log
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
1
  --color
2
- --format doc
2
+ --format documentation
3
3
  --require spec_helper
data/.travis.yml CHANGED
@@ -3,10 +3,25 @@ bundler_args: --without debug doc tooling
3
3
  rvm:
4
4
  - 2.0
5
5
  - 2.1
6
+ - 2.2
7
+ - 2.3
8
+ - 2.4
9
+ - 2.5
10
+ - 2.6
11
+ - 2.7
12
+ - 3.0
6
13
  - ruby-head
7
14
  - jruby-head
15
+ - rbx
16
+ - rbx-2
8
17
  script: "bundle exec rake test"
9
18
  matrix:
10
19
  allow_failures:
20
+ - rvm: 1.9
11
21
  - rvm: ruby-head
12
22
  - rvm: jruby-head
23
+ - rvm: rbx
24
+ - rvm: rbx-2
25
+ branches:
26
+ except:
27
+ - /^gh-pages.*$/
data/Gemfile CHANGED
@@ -3,22 +3,23 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :debug do
6
- gem 'pry-byebug', '~> 2', platforms: [:mri_20, :mri_21]
7
- gem 'pry-debugger', '~> 0', platforms: :mri_19
6
+ gem 'pry-byebug', '~> 3', platforms: [:mri_20,
7
+ :mri_21,
8
+ :mri_22,
9
+ :mri_23,
10
+ :mri_24,
11
+ :mri_25]
12
+ gem 'pry-debugger', '~> 0', platforms: :mri_19
8
13
  end
9
14
 
10
15
  group :doc do
11
- gem 'yard', '~> 0', require: false
12
- gem 'rdiscount', '~> 2', require: false, platforms: :mri
13
- end
14
-
15
- group :test do
16
- gem 'codeclimate-test-reporter', '~> 0', require: false
16
+ gem 'yard', '>= 0.9.11', '< 1', require: false
17
+ gem 'rdiscount', '~> 2', require: false
17
18
  end
18
19
 
19
20
  group :tooling do
20
- gem 'guard-rspec', '~> 4', require: false
21
+ gem 'guard-rspec', '~> 4', require: false
21
22
  if RUBY_PLATFORM =~ /darwin/i
22
- gem 'rb-fsevent', '~> 0', require: false
23
+ gem 'rb-fsevent', '~> 0', require: false
23
24
  end
24
25
  end
data/Guardfile CHANGED
@@ -1,38 +1,37 @@
1
- interactor :off
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
- # Run a spec when it changes.
17
- watch %r{^spec/.+_spec\.rb$}
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
- # Run all specs when a shared spec changes.
20
- watch( %r{^spec/.+_sharedspec\.rb$} ) { 'spec' }
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( 'spec/matchers.rb' ) { 'spec' }
23
+ watch('spec/matchers.rb') { 'spec' }
24
24
 
25
- # Run all specs when a support file changes.
26
- watch( %r{^spec/support} ) { 'spec' }
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( %r{^spec/fixtures} ) { 'spec' }
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( 'Gemfile.lock' ) { 'spec' }
37
- watch( %r{^(.+)\.gemspec$} ) { 'spec' }
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,8 +1,28 @@
1
- # Version history for the _Autoloaded_ project
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])
6
+
7
+ ## <a name="v1.6.0"></a>v1.6.0, Sun 4/05/2020
8
+
9
+ * Eliminate Ruby warnings about
10
+ [*Binding#source_location*][Ruby-Core-Binding-source_location] (thanks to
11
+ [@guss77][GitHub-user-guss77])
12
+
13
+ ## <a name="v1.5.1"></a>v1.5.1, Wed 10/18/2017
14
+
15
+ * Eliminate Ruby warnings about undefined instance variables
16
+
17
+ ## <a name="v1.5.0"></a>v1.5.0, Wed 2/22/2017
18
+
19
+ * Add support for Ruby load paths (`$:`) that contain one or more
20
+ [*Pathname*][Ruby-Stdlib-Pathname] objects (thanks to
21
+ [@ekampp][GitHub-user-ekampp])
2
22
 
3
23
  ## <a name="v1.4.1"></a>v1.4.1, Sat 1/24/2015
4
24
 
5
- * Don’t warn about a _VERSION_ constant presumably loaded by a _.gemspec_
25
+ * Don’t warn about a *VERSION* constant presumably loaded by a *.gemspec*
6
26
 
7
27
  ## <a name="v1.3.0"></a>v1.3.0, Fri 12/26/2014
8
28
 
@@ -16,11 +36,11 @@
16
36
 
17
37
  * Correct/improve autoload behavior
18
38
  * Instead of returning the source **directory** path from
19
- [_Module#autoload?_][Ruby-Core-Module-autoload], return one or more matching
39
+ [*Module#autoload?*][Ruby-Core-Module-autoload], return one or more matching
20
40
  source **file** path(s)
21
41
  * Use Ruby load path (`$:`) to handle relative source file paths
22
- * Explain _Module#autoload?_ and
23
- [_Module#constants_][Ruby-Core-Module-constants] in the [readme][readme] and
42
+ * Explain *Module#autoload?* and
43
+ [*Module#constants*][Ruby-Core-Module-constants] in the [readme][readme] and
24
44
  in [inline documentation][inline-documentation]
25
45
 
26
46
  ## <a name="v1.0.0"></a>v1.0.0, Wed 10/29/2014
@@ -31,8 +51,13 @@
31
51
 
32
52
  (First release)
33
53
 
34
- [JRuby]: http://jruby.org
35
- [Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload-3F "‘Module#autoload’ method in the Ruby Core Library"
36
- [Ruby-Core-Module-constants]: http://ruby-doc.org/core/Module.html#method-i-constants "‘Module#constants’ method in the Ruby Core Library"
37
- [readme]: http://github.com/njonsson/autoloaded/blob/master/README.md "Autoloaded readme"
38
- [inline-documentation]: http://www.rubydoc.info/github/njonsson/autoloaded "Autoloaded inline documentation"
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"
57
+ [JRuby]: https://www.jruby.org/
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"
59
+ [Ruby-Core-Module-autoload]: https://ruby-doc.org/core/Module.html#method-i-autoload-3F "‘Module#autoload’ method in the Ruby Core Library"
60
+ [Ruby-Core-Module-constants]: https://ruby-doc.org/core/Module.html#method-i-constants "‘Module#constants’ method in the Ruby Core Library"
61
+ [Ruby-Stdlib-Pathname]: https://ruby-doc.org/stdlib/libdoc/pathname/rdoc/Pathname.html "‘Pathname’ class in the Ruby Standard Library"
62
+ [readme]: https://github.com/njonsson/autoloaded/blob/master/README.md "Autoloaded readme"
63
+ [inline-documentation]: https://www.rubydoc.info/github/njonsson/autoloaded "Autoloaded inline documentation"
data/License.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The MIT License
2
2
 
3
- Source code for _Autoloaded_ is Copyright © 2014 [Nils Jonsson][mail] and
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
@@ -6,18 +6,17 @@
6
6
  [![Code Climate quality report] ][Code-Climate-report]
7
7
  [![Code Climate coverage report]][Code-Climate-report]
8
8
 
9
- [![Gemnasium build status] ][Gemnasium-build-status]
10
9
  [![Inch CI build status] ][Inch-CI-build-status]
11
10
  [![RubyGems release] ][RubyGems-release]
12
11
 
13
- If you like the [_Module#autoload_][Ruby-Core-Module-autoload] feature of the
14
- Ruby Core library, you may have wished for _Autoloaded_. It eliminates the
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
15
14
  drudgery of handcrafting an `autoload` statement for each Ruby source code file
16
15
  in your project. It also avoids the limitations of rigid convention-driven
17
16
  facilities such as those provided by the [ActiveSupport][ActiveSupport-Autoload]
18
17
  RubyGem.
19
18
 
20
- _Autoloaded_ assumes, but does not enforce, `CamelCase`-to-`snake_case`
19
+ *Autoloaded* assumes, but does not enforce, `CamelCase`-to-`snake_case`
21
20
  correspondence between the names of constants and source files. You can combine
22
21
  conventions, even putting multiple autoloaded constants in a single source file.
23
22
 
@@ -27,7 +26,7 @@ Install [the RubyGem][RubyGems-release].
27
26
 
28
27
  $ gem install autoloaded
29
28
 
30
- Use _Autoloaded_ in your RubyGem project by making it a runtime dependency.
29
+ Use *Autoloaded* in your RubyGem project by making it a runtime dependency.
31
30
 
32
31
  ```ruby
33
32
  # my_awesome_gem.gemspec
@@ -39,13 +38,13 @@ Gem::Specification.new do |spec|
39
38
  end
40
39
  ```
41
40
 
42
- Or you may want to make _Autoloaded_ a dependency of your project by using
41
+ Or you may want to make *Autoloaded* a dependency of your project by using
43
42
  [Bundler][Bundler].
44
43
 
45
44
  ```ruby
46
45
  # Gemfile
47
46
 
48
- source 'http://rubygems.org'
47
+ source 'https://rubygems.org'
49
48
 
50
49
  gem 'autoloaded', '~> 1'
51
50
  ```
@@ -66,15 +65,15 @@ Suppose you have the following source files.
66
65
  │  └─ version.rb
67
66
  └─ my_awesome_gem.rb
68
67
 
69
- ### The _Autoloaded.module_ or _Autoloaded.class_ method
68
+ ### The *Autoloaded.module* or *Autoloaded.class* method
70
69
 
71
- The _Autoloaded.module_ and _Autoloaded.class_ method calls below invoke
72
- [_Module#autoload_][Ruby-Core-Module-autoload] for each source file in the
70
+ The *Autoloaded.module* and *Autoloaded.class* method calls below invoke
71
+ [*Module#autoload*][Ruby-Core-Module-autoload] for each source file in the
73
72
  calling module’s corresponding directory. Note that these methods must receive a
74
73
  block, even if it’s an empty block.
75
74
 
76
75
  The file paths used are abbreviated, if possible, using a directory of the Ruby
77
- load path (`$:`). They are also rendered without their _.rb_ extension.
76
+ load path (`$:`). They are also rendered without their *.rb* extension.
78
77
 
79
78
  ```ruby
80
79
  # lib/my_awesome_gem.rb
@@ -152,7 +151,7 @@ MyAwesomeGem::DB::Mysql # Raises NameError because
152
151
 
153
152
  ### The `with` specification
154
153
 
155
- _Autoloaded_ needs hints from you concerning unpredictable spellings,
154
+ *Autoloaded* needs hints from you concerning unpredictable spellings,
156
155
  stylization, and organization of constant names and/or source file names. You can
157
156
  specify `with` as:
158
157
 
@@ -173,21 +172,21 @@ You can specify `with` multiple times, and its effects are cumulative.
173
172
  # lib/my_awesome_gem.rb
174
173
  module MyAwesomeGem
175
174
 
176
- Autoloaded.module do |autoloaded|
177
- autoloaded.with :DB, :VERSION
175
+ Autoloaded.module do |autoloading|
176
+ autoloading.with :DB, :VERSION
178
177
  # Or:
179
- # autoloaded.with :DB
180
- # autoloaded.with :VERSION
178
+ # autoloading.with :DB
179
+ # autoloading.with :VERSION
181
180
  # Or:
182
- # autoloaded.with DB: 'db', VERSION: 'version'
181
+ # autoloading.with DB: 'db', VERSION: 'version'
183
182
  # Or:
184
- # autoloaded.with DB: 'db'
185
- # autoloaded.with VERSION: 'version'
183
+ # autoloading.with DB: 'db'
184
+ # autoloading.with VERSION: 'version'
186
185
  # Or:
187
- # autoloaded.with 'db' => :DB, 'version' => :VERSION
186
+ # autoloading.with 'db' => :DB, 'version' => :VERSION
188
187
  # Or:
189
- # autoloaded.with 'db' => :DB
190
- # autoloaded.with 'version' => :VERSION
188
+ # autoloading.with 'db' => :DB
189
+ # autoloading.with 'version' => :VERSION
191
190
  end
192
191
 
193
192
  # The above is the equivalent of:
@@ -202,20 +201,20 @@ module MyAwesomeGem
202
201
 
203
202
  class DB
204
203
 
205
- Autoloaded.class do |autoloaded|
206
- autoloaded.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
204
+ Autoloaded.class do |autoloading|
205
+ autoloading.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
207
206
  # Or:
208
- # autoloaded.with :MySQL,
209
- # :PostgreSQL,
210
- # Access: 'MicroSoft',
211
- # SQLServer: 'MicroSoft'
207
+ # autoloading.with :MySQL,
208
+ # :PostgreSQL,
209
+ # Access: 'MicroSoft',
210
+ # SQLServer: 'MicroSoft'
212
211
  # Or:
213
- # autoloaded.with :MySQL, :PostgreSQL, 'MicroSoft' => [:Access, :SQLServer]
212
+ # autoloading.with :MySQL, :PostgreSQL, 'MicroSoft' => [:Access, :SQLServer]
214
213
  # Or:
215
- # autoloaded.with :MySQL,
216
- # :PostgreSQL,
217
- # 'MicroSoft' => :Access,
218
- # 'MicroSoft' => :SQLServer
214
+ # autoloading.with :MySQL,
215
+ # :PostgreSQL,
216
+ # 'MicroSoft' => :Access,
217
+ # 'MicroSoft' => :SQLServer
219
218
  # Or ...
220
219
  end
221
220
 
@@ -283,12 +282,12 @@ module MyAwesomeGem
283
282
 
284
283
  class DB
285
284
 
286
- Autoloaded.class do |autoloaded|
287
- autoloaded.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
285
+ Autoloaded.class do |autoloading|
286
+ autoloading.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
288
287
 
289
- autoloaded.except 'SELF-DESTRUCT!'
288
+ autoloading.except 'SELF-DESTRUCT!'
290
289
  # Or:
291
- # autoloaded.except :SELF_DESTRUCT_
290
+ # autoloading.except :SELF_DESTRUCT_
292
291
  # Or ...
293
292
  end
294
293
 
@@ -340,9 +339,9 @@ cumulative.
340
339
 
341
340
  ### The `from` specification
342
341
 
343
- It’s recommended that you call _Autoloaded.module_ or _Autoloaded.class_ from
342
+ It’s recommended that you call *Autoloaded.module* or *Autoloaded.class* from
344
343
  within the source file where your module or class is defined. This practice
345
- allows _Autoloaded_ to assume that the source files to be autoloaded are in a
344
+ allows *Autoloaded* to assume that the source files to be autoloaded are in a
346
345
  directory of the same name (and in the same location) as the module’s defining
347
346
  source file.
348
347
 
@@ -357,12 +356,12 @@ which source files should be autoloaded.
357
356
 
358
357
  module MyAwesomeGem
359
358
 
360
- Autoloaded.module do |autoloaded|
359
+ Autoloaded.module do |autoloading|
361
360
  # The following code is not actually very useful since the installed location
362
361
  # of a RubyGem varies with the operating system and user preferences. How to
363
362
  # compute the path properly is outside the scope of this readme and is left
364
363
  # as an exercise for the reader.
365
- autoloaded.from '/absolute/path/to/my_awesome_gem'
364
+ autoloading.from '/absolute/path/to/my_awesome_gem'
366
365
  end
367
366
 
368
367
  end
@@ -371,18 +370,18 @@ end
371
370
  A path provided to `from` cannot be relative; it must start with the filesystem
372
371
  root.
373
372
 
374
- If you specify `from` multiple times in an _Autoloaded_ block, only the last one
373
+ If you specify `from` multiple times in an *Autoloaded* block, only the last one
375
374
  takes effect.
376
375
 
377
- ### The _Autoloaded.warn_ method
376
+ ### The *Autoloaded.warn* method
378
377
 
379
- There are two circumstances under which _Autoloaded_ by default will write
378
+ There are two circumstances under which *Autoloaded* by default will write
380
379
  warnings to stderr:
381
380
 
382
381
  * Overriding an established autoload
383
382
  * Establishing an autoload for a defined constant
384
383
 
385
- You can silence these warnings by passing `false` to _Autoloaded.warn_. (Passing
384
+ You can silence these warnings by passing `false` to *Autoloaded.warn*. (Passing
386
385
  `true` turns warnings on if they are off.)
387
386
 
388
387
  ```ruby
@@ -438,7 +437,7 @@ end
438
437
 
439
438
  ### How to debug autoloading
440
439
 
441
- The _Autoloaded.module_ or _Autoloaded.class_ method returns an ordered list of
440
+ The *Autoloaded.module* or *Autoloaded.class* method returns an ordered list of
442
441
  arguments it has passed to `autoload`.
443
442
 
444
443
  ```ruby
@@ -448,9 +447,9 @@ module MyAwesomeGem
448
447
 
449
448
  class DB
450
449
 
451
- results = Autoloaded.class do |autoloaded|
452
- autoloaded.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
453
- autoloaded.except 'SELF-DESTRUCT!'
450
+ results = Autoloaded.class do |autoloading|
451
+ autoloading.with :MySQL, :PostgreSQL, [:Access, :SQLServer] => 'MicroSoft'
452
+ autoloading.except 'SELF-DESTRUCT!'
454
453
  end
455
454
  STDOUT.puts results.inspect # See output below.
456
455
 
@@ -465,20 +464,20 @@ end
465
464
  # [:PostgreSQL, 'my_awesome_gem/db/postgre_sql']]
466
465
  ```
467
466
 
468
- You can also hook [_Module#autoload_][Ruby-Core-Module-autoload] and
469
- [_Kernel#autoload_][Ruby-Core-Kernel-autoload] via monkeypatching or other means
467
+ You can also hook [*Module#autoload*][Ruby-Core-Module-autoload] and
468
+ [*Kernel#autoload*][Ruby-Core-Kernel-autoload] via monkeypatching or other means
470
469
  in order to see what’s happening.
471
470
 
472
471
  ### Source filenames are relative to the `from` specification
473
472
 
474
473
  You may have noticed that source filenames in the above examples are not
475
- absolute. They are relative to the _Autoloaded_ block’s `from` specification
474
+ absolute. They are relative to the *Autoloaded* block’s `from` specification
476
475
  (which I recommend that you allow to be computed for you —
477
476
  [see above](#the-from-specification)).
478
477
 
479
478
  ### Recursive autoloading not supported
480
479
 
481
- _Autoloaded_ does not perform deep autoloading of nested namespaces and
480
+ *Autoloaded* does not perform deep autoloading of nested namespaces and
482
481
  directories. This is by design.
483
482
 
484
483
  ## Contributing
@@ -489,6 +488,19 @@ directories. This is by design.
489
488
  4. Push to the branch: `git push origin my-new-feature`.
490
489
  5. [Create][compare-Autoloaded-branches] a new pull request.
491
490
 
491
+ Development
492
+ -----------
493
+
494
+ After cloning the repository, `bin/setup` to install dependencies. Then `rake` to
495
+ run the tests. You can also `bin/console` to get an interactive prompt that will
496
+ allow you to experiment.
497
+
498
+ To install this gem onto your local machine, `bundle exec rake install`. To
499
+ release a new version, update the version number in *lib/autoloaded/version.rb*,
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 *.gem* file to
502
+ [RubyGems.org](RubyGems-release).
503
+
492
504
  ## License
493
505
 
494
506
  Released under the [MIT License][MIT-License].
@@ -497,20 +509,18 @@ Released under the [MIT License][MIT-License].
497
509
  [Travis CI build status]: https://secure.travis-ci.org/njonsson/autoloaded.svg?branch=v1.x
498
510
  [Code Climate quality report]: https://codeclimate.com/github/njonsson/autoloaded/badges/gpa.svg
499
511
  [Code Climate coverage report]: https://codeclimate.com/github/njonsson/autoloaded/badges/coverage.svg
500
- [Gemnasium build status]: https://gemnasium.com/njonsson/autoloaded.svg
501
- [Inch CI build status]: http://inch-ci.org/github/njonsson/autoloaded.svg?branch=v1.x
512
+ [Inch CI build status]: https://www.inch-ci.org/github/njonsson/autoloaded.svg?branch=v1.x
502
513
  [RubyGems release]: https://badge.fury.io/rb/autoloaded.svg
503
514
 
504
- [spider-gear-image]: https://www.flickr.com/photos/dongkwan/4941065976 "spider gear image by Ernesto Andrade"
505
- [Travis-CI-build-status]: http://travis-ci.org/njonsson/autoloaded "Travis CI build status for Autoloaded"
506
- [Code-Climate-report]: http://codeclimate.com/github/njonsson/autoloaded "Code Climate report for Autoloaded"
507
- [Gemnasium-build-status]: http://gemnasium.com/njonsson/autoloaded "Gemnasium build status for Autoloaded"
508
- [Inch-CI-build-status]: http://inch-ci.org/github/njonsson/autoloaded "Inch CI build status for Autoloaded"
509
- [RubyGems-release]: http://rubygems.org/gems/autoloaded "RubyGems release of Autoloaded"
510
- [Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload "‘Module#autoloadmethod in the Ruby Core Library"
511
- [ActiveSupport-Autoload]: http://api.rubyonrails.org/classes/ActiveSupport/Autoload.html "‘ActiveSupport::Autoload’ module in the Rails API"
512
- [Bundler]: http://bundler.io
513
- [Ruby-Core-Kernel-autoload]: http://ruby-doc.org/core/Kernel.html#method-i-autoload "‘Kernel#autoload’ method in the Ruby Core Library"
514
- [fork-Autoloaded]: https://github.com/njonsson/autoloaded/fork "Fork the official repository of Autoloaded"
515
- [compare-Autoloaded-branches]: https://github.com/njonsson/autoloaded/compare "Compare branches of Autoloaded repositories"
516
- [MIT-License]: http://github.com/njonsson/autoloaded/blob/master/License.md "MIT License claim for Autoloaded"
515
+ [spider-gear-image]: https://www.flickr.com/photos/dongkwan/4941065976 "spider gear image by Ernesto Andrade"
516
+ [Travis-CI-build-status]: https://www.travis-ci.org/njonsson/autoloaded "Travis CI build status for Autoloaded"
517
+ [Code-Climate-report]: https://codeclimate.com/github/njonsson/autoloaded "Code Climate report for Autoloaded"
518
+ [Inch-CI-build-status]: https://www.inch-ci.org/github/njonsson/autoloaded "Inch CI build status for Autoloaded"
519
+ [RubyGems-release]: https://rubygems.org/gems/autoloaded "RubyGems release of Autoloaded"
520
+ [Ruby-Core-Module-autoload]: https://ruby-doc.org/core/Module.html#method-i-autoload "‘Module#autoload’ method in the Ruby Core Library"
521
+ [ActiveSupport-Autoload]: https://api.rubyonrails.org/classes/ActiveSupport/Autoload.html "‘ActiveSupport::Autoloadmodule in the Rails API"
522
+ [Bundler]: https://bundler.io/
523
+ [Ruby-Core-Kernel-autoload]: https://ruby-doc.org/core/Kernel.html#method-i-autoload "‘Kernel#autoload’ method in the Ruby Core Library"
524
+ [fork-Autoloaded]: https://github.com/njonsson/autoloaded/fork "Fork the official repository of Autoloaded"
525
+ [compare-Autoloaded-branches]: https://github.com/njonsson/autoloaded/compare "Compare branches of Autoloaded repositories"
526
+ [MIT-License]: https://github.com/njonsson/autoloaded/blob/master/License.md "MIT License claim for Autoloaded"
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require_relative 'lib/tasks'
3
+
4
+ desc 'Run all specs'
5
+ task '' => :spec
6
+ task default: :spec
data/autoloaded.gemspec CHANGED
@@ -1,46 +1,50 @@
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 = 'autoloaded'
10
- spec.version = Autoloaded::VERSION
11
- spec.authors = ['Nils Jonsson']
12
- spec.email = ['autoloaded@nilsjonsson.com']
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']
11
+
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 = 'https://njonsson.github.io/autoloaded'
32
+ spec.license = 'MIT'
35
33
 
36
- spec.files = `git ls-files -z`.split("\x0")
37
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename f }
38
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
39
- spec.require_paths = ['lib']
34
+ spec.required_ruby_version = '>= 2', '< 4'
40
35
 
41
- spec.required_ruby_version = '~> 2'
36
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
37
+ if RUBY_VERSION < '2.2'
38
+ spec.add_development_dependency 'rake', '~> 12'
39
+ else
40
+ spec.add_development_dependency 'rake', '~> 13'
41
+ end
42
+ spec.add_development_dependency 'rspec', '~> 3.3'
42
43
 
43
- spec.add_development_dependency 'bundler', '~> 1'
44
- spec.add_development_dependency 'rake', '~> 10'
45
- spec.add_development_dependency 'rspec', '~> 3'
44
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
45
+ f.match(%r{^(test|spec|features)/})
46
+ end
47
+ spec.bindir = 'exe'
48
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
49
+ spec.require_paths = %w(lib)
46
50
  end