autoloaded 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7221b689c0211923b999e3da078512a464179c5
4
- data.tar.gz: f15a23ea558e0064748939779f3d4c3891bfc455
3
+ metadata.gz: c8931d8ff044c161e9a4ac8a2b5ff68dcb567f4b
4
+ data.tar.gz: 85a1ad725f3204618a2e08937819a1249cc88b8c
5
5
  SHA512:
6
- metadata.gz: b9d88de3898d6351c0367c76cde73ed73661b8753ed17b60d9ba592c2c306585c1f79f4875713b3351dd12c0a450e721f51b359087af90c178beb93bada66975
7
- data.tar.gz: 975e195c4b69254dc9a47945af0e78ec696b5f784f3e6f613cece9343da983944912af173f7fb8ad02aa5f95a50a3b063a42bce6e30dc9bf6571758f3c52c3a9
6
+ metadata.gz: 648c600b35a0068b001ba3ada55454c98a29bc55bec37c458d024d05137fc6a08b2625c320b09508b63e598d47b29d682d466ec875f6a56153f3f522f6fd60b1
7
+ data.tar.gz: d927ce04c49c708d784763b7d563e2189e6f9b195c2261ca3ba6bdcd01d0f295bd0599bd71652eaff5671be51c8c46cd089a2c2f62e5635d664213b7b103f07f
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ end
9
9
 
10
10
  group :doc do
11
11
  gem 'yard', '~> 0', require: false
12
- gem 'rdiscount', '~> 2', require: false
12
+ gem 'rdiscount', '~> 2', require: false, platforms: :mri
13
13
  end
14
14
 
15
15
  group :test do
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Version history for the _Autoloaded_ project
2
2
 
3
+ ## <a name="v1.2.0"></a>v1.2.0, Fri 11/28/2013
4
+
5
+ * Add support for [JRuby][JRuby] (Ruby v2.x-compatible versions)
6
+
3
7
  ## <a name="v1.1.0"></a>v1.1.0, Tue 11/04/2013
4
8
 
5
9
  * Correct/improve autoload behavior
@@ -19,6 +23,7 @@
19
23
 
20
24
  (First release)
21
25
 
26
+ [JRuby]: http://jruby.org
22
27
  [Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload-3F "‘Module#autoload’ method in the Ruby Core Library"
23
28
  [Ruby-Core-Module-constants]: http://ruby-doc.org/core/Module.html#method-i-constants "‘Module#constants’ method in the Ruby Core Library"
24
29
  [readme]: http://github.com/njonsson/autoloaded/blob/master/README.md "Autoloaded readme"
data/README.md CHANGED
@@ -21,19 +21,20 @@ autoloading facilities such as those provided by the
21
21
 
22
22
  ## Installation
23
23
 
24
- Add this line to your application’s Gemfile:
24
+ Install [the RubyGem][RubyGems-release].
25
25
 
26
- ```ruby
27
- gem 'autoloaded', '~> 0'
28
- ```
26
+ $ gem install autoloaded
29
27
 
30
- And then execute:
28
+ Or you may want to make Autoloaded a dependency of your project by using
29
+ [Bundler][Bundler]
31
30
 
32
- $ bundle
31
+ ```ruby
32
+ # Gemfile
33
33
 
34
- Or install it yourself as:
34
+ source 'http://rubygems.org'
35
35
 
36
- $ gem install autoloaded
36
+ gem 'autoloaded', '~> 1'
37
+ ```
37
38
 
38
39
  ## Usage
39
40
 
@@ -158,6 +159,7 @@ Released under the [MIT License][MIT-License].
158
159
  [RubyGems-release]: http://rubygems.org/gems/autoloaded "RubyGems release of Autoloaded"
159
160
  [Ruby-Core-Module-autoload]: http://ruby-doc.org/core/Module.html#method-i-autoload "‘Module#autoload’ method in the Ruby Core Library"
160
161
  [ActiveSupport-Autoload]: http://api.rubyonrails.org/classes/ActiveSupport/Autoload.html "‘ActiveSupport::Autoload’ module in the Rails API"
162
+ [Bundler]: http://bundler.io
161
163
  [fork-Autoloaded]: https://github.com/njonsson/autoloaded/fork "Fork the official repository of Autoloaded"
162
164
  [compare-Autoloaded-branches]: https://github.com/njonsson/autoloaded/compare "Compare branches of Autoloaded repositories"
163
165
  [MIT-License]: http://github.com/njonsson/autoloaded/blob/master/License.md "MIT License claim for Autoloaded"
data/lib/autoloaded.rb CHANGED
@@ -89,6 +89,10 @@
89
89
  #
90
90
  module Autoloaded
91
91
 
92
+ autoload :Constant, 'autoloaded/constant'
93
+ autoload :Refine, 'autoloaded/refine'
94
+ autoload :VERSION, 'autoloaded/version'
95
+
92
96
  def self.extended(other_module)
93
97
  caller_file_path = caller_locations.first.absolute_path
94
98
  dir_path = "#{::File.dirname caller_file_path}/#{::File.basename caller_file_path, '.rb'}"
@@ -124,7 +128,3 @@ module Autoloaded
124
128
  end
125
129
 
126
130
  end
127
-
128
- Dir.glob "#{File.dirname __FILE__}/#{File.basename __FILE__, '.rb'}/*.rb" do |f|
129
- require_relative "#{File.basename __FILE__, '.rb'}/#{File.basename f, '.rb'}"
130
- end
@@ -0,0 +1,17 @@
1
+ # Fall back to monkeypatching if refinements are not supported.
2
+
3
+ unless ::Module.private_instance_methods.include?(:refine)
4
+ class ::Module
5
+
6
+ private
7
+
8
+ def refine(klass, &block)
9
+ klass.class_eval(&block)
10
+ end
11
+
12
+ end
13
+ end
14
+
15
+ unless private_methods.include?(:using)
16
+ def using(*arguments); end
17
+ end
@@ -1,10 +1,10 @@
1
1
  module Autoloaded
2
2
 
3
3
  # @private
4
- module Refine; end
4
+ module Refine
5
5
 
6
- end
6
+ autoload :String, 'autoloaded/refine/string'
7
+
8
+ end
7
9
 
8
- Dir.glob "#{File.dirname __FILE__}/#{File.basename __FILE__, '.rb'}/*.rb" do |f|
9
- require_relative "#{File.basename __FILE__, '.rb'}/#{File.basename f, '.rb'}"
10
10
  end
@@ -2,12 +2,12 @@ module Autoloaded
2
2
 
3
3
  module Refine
4
4
 
5
- module String; end
5
+ module String
6
6
 
7
- end
7
+ autoload :ToSourceFilename, 'autoloaded/refine/string/to_source_filename'
8
8
 
9
- end
9
+ end
10
+
11
+ end
10
12
 
11
- Dir.glob "#{File.dirname __FILE__}/#{File.basename __FILE__, '.rb'}/*.rb" do |f|
12
- require_relative "#{File.basename __FILE__, '.rb'}/#{File.basename f, '.rb'}"
13
13
  end
@@ -1,3 +1,5 @@
1
+ require 'autoloaded/compatibility/refine_and_using'
2
+
1
3
  module Autoloaded
2
4
 
3
5
  module Refine
@@ -1,6 +1,6 @@
1
1
  module Autoloaded
2
2
 
3
3
  # The current version of the _Autoloaded_ project.
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
 
6
6
  end
@@ -8,126 +8,132 @@ RSpec.describe Autoloaded do
8
8
  end
9
9
  end
10
10
 
11
- describe 'not extending a namespace' do
12
- subject(:source_file) { 'spec/fixtures/not_autoloaded.rb' }
11
+ begin
12
+ fork
13
+ rescue NotImplementedError => e
14
+ pending "[pending because #{e.message}]"
15
+ else
16
+ describe 'not extending a namespace' do
17
+ subject(:source_file) { 'spec/fixtures/not_autoloaded.rb' }
13
18
 
14
- it { is_expected.to define_constant(:NotAutoloaded) }
19
+ it { is_expected.to define_constant(:NotAutoloaded) }
15
20
 
16
- it { is_expected.to define_constant('NotAutoloaded::OldSchoolAutoload') }
21
+ it { is_expected.to define_constant('NotAutoloaded::OldSchoolAutoload') }
17
22
 
18
- it { is_expected.not_to define_constant('NotAutoloaded::Nested') }
19
-
20
- it {
21
- is_expected.to set_up_autoload_for_constant('NotAutoloaded::OldSchoolAutoload').
22
- from_file('fixtures/not_autoloaded/old_school_autoload')
23
- }
24
-
25
- it {
26
- is_expected.not_to set_up_autoload_for_constant('NotAutoloaded::Nested')
27
- }
28
- end
29
-
30
- describe 'extending a namespace whose constituent source files have' do
31
- describe 'conventional names used for autoloading' do
32
- subject(:source_file) {
33
- 'spec/fixtures/autoloaded_with_conventional_filename.rb'
34
- }
35
-
36
- it { is_expected.to define_constant(:AutoloadedWithConventionalFilename) }
37
-
38
- it {
39
- is_expected.to define_constant('AutoloadedWithConventionalFilename::OldSchoolAutoload')
40
- }
41
-
42
- it {
43
- is_expected.to define_constant('AutoloadedWithConventionalFilename::Nested').
44
- dynamically
45
- }
46
-
47
- it {
48
- is_expected.not_to define_constant('AutoloadedWithConventionalFilename::NONEXISTENT')
49
- }
50
-
51
- it {
52
- is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::OldSchoolAutoload').
53
- from_file('fixtures/autoloaded_with_conventional_filename/old_school_autoload')
54
- }
55
-
56
- it {
57
- is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::Nested').
58
- from_files('fixtures/autoloaded_with_conventional_filename/nested',
59
- 'fixtures/autoloaded_with_conventional_filename/N-est-ed',
60
- 'fixtures/autoloaded_with_conventional_filename/nest_ed')
61
- }
62
-
63
- it {
64
- is_expected.not_to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::NONEXISTENT')
65
- }
66
- end
67
-
68
- describe 'conventional names' do
69
- subject(:source_file) {
70
- 'spec/fixtures/autoloaded_with_conventional_filename_only.rb'
71
- }
72
-
73
- it { is_expected.to define_constant(:AutoloadedWithConventionalFilenameOnly) }
23
+ it { is_expected.not_to define_constant('NotAutoloaded::Nested') }
74
24
 
75
25
  it {
76
- is_expected.to define_constant('AutoloadedWithConventionalFilenameOnly::OldSchoolAutoload')
26
+ is_expected.to set_up_autoload_for_constant('NotAutoloaded::OldSchoolAutoload').
27
+ from_file('fixtures/not_autoloaded/old_school_autoload')
77
28
  }
78
29
 
79
30
  it {
80
- is_expected.to define_constant('AutoloadedWithConventionalFilenameOnly::Nested').
81
- dynamically
82
- }
83
-
84
- it {
85
- is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::OldSchoolAutoload').
86
- from_file('fixtures/autoloaded_with_conventional_filename_only/old_school_autoload')
87
- }
88
-
89
- it {
90
- is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::Nested').
91
- from_file('fixtures/autoloaded_with_conventional_filename_only/nested')
92
- }
93
-
94
- it {
95
- is_expected.not_to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::NONEXISTENT')
31
+ is_expected.not_to set_up_autoload_for_constant('NotAutoloaded::Nested')
96
32
  }
97
33
  end
98
34
 
99
- describe 'unconventional names' do
100
- subject(:source_file) {
101
- 'spec/fixtures/autoloaded_with_unconventional_filenames.rb'
102
- }
103
-
104
- it {
105
- is_expected.to define_constant(:AutoloadedWithUnconventionalFilenames)
106
- }
107
-
108
- it {
109
- is_expected.to define_constant('AutoloadedWithUnconventionalFilenames::OldSchoolAutoload')
110
- }
111
-
112
- it {
113
- is_expected.to define_constants('AutoloadedWithUnconventionalFilenames::Nested').
114
- dynamically
115
- }
116
-
117
- it {
118
- is_expected.to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::OldSchoolAutoload').
119
- from_file('fixtures/autoloaded_with_unconventional_filenames/old_school_autoload')
120
- }
121
-
122
- it {
123
- is_expected.to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::Nested').
124
- from_files('fixtures/autoloaded_with_unconventional_filenames/N-est-ed',
125
- 'fixtures/autoloaded_with_unconventional_filenames/nest_ed')
126
- }
127
-
128
- it {
129
- is_expected.not_to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::NONEXISTENT')
130
- }
35
+ describe 'extending a namespace whose constituent source files have' do
36
+ describe 'conventional names used for autoloading' do
37
+ subject(:source_file) {
38
+ 'spec/fixtures/autoloaded_with_conventional_filename.rb'
39
+ }
40
+
41
+ it { is_expected.to define_constant(:AutoloadedWithConventionalFilename) }
42
+
43
+ it {
44
+ is_expected.to define_constant('AutoloadedWithConventionalFilename::OldSchoolAutoload')
45
+ }
46
+
47
+ it {
48
+ is_expected.to define_constant('AutoloadedWithConventionalFilename::Nested').
49
+ dynamically
50
+ }
51
+
52
+ it {
53
+ is_expected.not_to define_constant('AutoloadedWithConventionalFilename::NONEXISTENT')
54
+ }
55
+
56
+ it {
57
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::OldSchoolAutoload').
58
+ from_file('fixtures/autoloaded_with_conventional_filename/old_school_autoload')
59
+ }
60
+
61
+ it {
62
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::Nested').
63
+ from_files('fixtures/autoloaded_with_conventional_filename/nested',
64
+ 'fixtures/autoloaded_with_conventional_filename/N-est-ed',
65
+ 'fixtures/autoloaded_with_conventional_filename/nest_ed')
66
+ }
67
+
68
+ it {
69
+ is_expected.not_to set_up_autoload_for_constant('AutoloadedWithConventionalFilename::NONEXISTENT')
70
+ }
71
+ end
72
+
73
+ describe 'conventional names' do
74
+ subject(:source_file) {
75
+ 'spec/fixtures/autoloaded_with_conventional_filename_only.rb'
76
+ }
77
+
78
+ it { is_expected.to define_constant(:AutoloadedWithConventionalFilenameOnly) }
79
+
80
+ it {
81
+ is_expected.to define_constant('AutoloadedWithConventionalFilenameOnly::OldSchoolAutoload')
82
+ }
83
+
84
+ it {
85
+ is_expected.to define_constant('AutoloadedWithConventionalFilenameOnly::Nested').
86
+ dynamically
87
+ }
88
+
89
+ it {
90
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::OldSchoolAutoload').
91
+ from_file('fixtures/autoloaded_with_conventional_filename_only/old_school_autoload')
92
+ }
93
+
94
+ it {
95
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::Nested').
96
+ from_file('fixtures/autoloaded_with_conventional_filename_only/nested')
97
+ }
98
+
99
+ it {
100
+ is_expected.not_to set_up_autoload_for_constant('AutoloadedWithConventionalFilenameOnly::NONEXISTENT')
101
+ }
102
+ end
103
+
104
+ describe 'unconventional names' do
105
+ subject(:source_file) {
106
+ 'spec/fixtures/autoloaded_with_unconventional_filenames.rb'
107
+ }
108
+
109
+ it {
110
+ is_expected.to define_constant(:AutoloadedWithUnconventionalFilenames)
111
+ }
112
+
113
+ it {
114
+ is_expected.to define_constant('AutoloadedWithUnconventionalFilenames::OldSchoolAutoload')
115
+ }
116
+
117
+ it {
118
+ is_expected.to define_constants('AutoloadedWithUnconventionalFilenames::Nested').
119
+ dynamically
120
+ }
121
+
122
+ it {
123
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::OldSchoolAutoload').
124
+ from_file('fixtures/autoloaded_with_unconventional_filenames/old_school_autoload')
125
+ }
126
+
127
+ it {
128
+ is_expected.to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::Nested').
129
+ from_files('fixtures/autoloaded_with_unconventional_filenames/N-est-ed',
130
+ 'fixtures/autoloaded_with_unconventional_filenames/nest_ed')
131
+ }
132
+
133
+ it {
134
+ is_expected.not_to set_up_autoload_for_constant('AutoloadedWithUnconventionalFilenames::NONEXISTENT')
135
+ }
136
+ end
131
137
  end
132
138
  end
133
139
  end
@@ -18,6 +18,12 @@ def without_side_effects
18
18
  err_writer.write Marshal.dump(e)
19
19
  raise e
20
20
  end
21
+
22
+ # The codeclimate-test-reporter RubyGem uses Kernel#at_exit to hook the end
23
+ # of test/spec runs for sending coverage statistics to their web service. We
24
+ # need to skip that hook in this process fork because this is not the end of
25
+ # a test/spec run, only of a process fork.
26
+ exit!(true) if ENV['CODECLIMATE_REPO_TOKEN']
21
27
  end
22
28
 
23
29
  Process.wait pid
metadata CHANGED
@@ -1,57 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoloaded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nils Jonsson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-05 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
20
+ requirement: !ruby/object:Gem::Requirement
23
21
  requirements:
24
22
  - - "~>"
25
23
  - !ruby/object:Gem::Version
26
24
  version: '1'
25
+ prerelease: false
26
+ type: :development
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
- requirement: !ruby/object:Gem::Requirement
29
+ version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
37
35
  requirements:
38
36
  - - "~>"
39
37
  - !ruby/object:Gem::Version
40
38
  version: '10'
39
+ prerelease: false
40
+ type: :development
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
- requirement: !ruby/object:Gem::Requirement
43
+ version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
51
49
  requirements:
52
50
  - - "~>"
53
51
  - !ruby/object:Gem::Version
54
52
  version: '3'
53
+ prerelease: false
54
+ type: :development
55
55
  description: 'Dynamically and flexibly loads source files in a directory when a corresponding
56
56
  constant is dereferenced. Offers several advantages over other autoloading facilities
57
57
  such as those provided by the Ruby Core library and the ActiveSupport gem: (a) it
@@ -76,6 +76,7 @@ files:
76
76
  - Rakefile
77
77
  - autoloaded.gemspec
78
78
  - lib/autoloaded.rb
79
+ - lib/autoloaded/compatibility/refine_and_using.rb
79
80
  - lib/autoloaded/constant.rb
80
81
  - lib/autoloaded/refine.rb
81
82
  - lib/autoloaded/refine/string.rb
@@ -119,7 +120,7 @@ homepage: http://njonsson.github.io/autoloaded
119
120
  licenses:
120
121
  - MIT
121
122
  metadata: {}
122
- post_install_message:
123
+ post_install_message:
123
124
  rdoc_options: []
124
125
  require_paths:
125
126
  - lib
@@ -134,12 +135,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
135
  - !ruby/object:Gem::Version
135
136
  version: '0'
136
137
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.2.2
139
- signing_key:
138
+ rubyforge_project:
139
+ rubygems_version: 2.4.4
140
+ signing_key:
140
141
  specification_version: 4
141
- summary: Dynamically and flexibly loads source files in a directory when a corresponding
142
- constant is dereferenced.
142
+ summary: Dynamically and flexibly loads source files in a directory when a corresponding constant is dereferenced.
143
143
  test_files:
144
144
  - spec/autoloaded/constant_spec.rb
145
145
  - spec/autoloaded/refine/string/to_source_filename_spec.rb
@@ -170,4 +170,4 @@ test_files:
170
170
  - spec/spec_helper.rb
171
171
  - spec/support/util.rb
172
172
  - spec/support/without_side_effects.rb
173
- has_rdoc:
173
+ has_rdoc: