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
data/spec/spec_helper.rb DELETED
@@ -1,91 +0,0 @@
1
- require 'codeclimate-test-reporter'
2
-
3
- CodeClimate::TestReporter.start
4
-
5
- # This file was generated by the `rspec --init` command. Conventionally, all
6
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
7
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
8
- # file to always be loaded, without a need to explicitly require it in any files.
9
- #
10
- # Given that it is always loaded, you are encouraged to keep this file as
11
- # light-weight as possible. Requiring heavyweight dependencies from this file
12
- # will add to the boot time of your test suite on EVERY test run, even for an
13
- # individual file that may not need all of that loaded. Instead, consider making
14
- # a separate helper file that requires the additional dependencies and performs
15
- # the additional setup, and require it from the spec files that actually need it.
16
- #
17
- # The `.rspec` file also contains a few flags that are not defaults but that
18
- # users commonly want.
19
- #
20
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
- RSpec.configure do |config|
22
- # rspec-expectations config goes here. You can use an alternate
23
- # assertion/expectation library such as wrong or the stdlib/minitest
24
- # assertions if you prefer.
25
- config.expect_with :rspec do |expectations|
26
- # This option will default to `true` in RSpec 4. It makes the `description`
27
- # and `failure_message` of custom matchers include text for helper methods
28
- # defined using `chain`, e.g.:
29
- # be_bigger_than(2).and_smaller_than(4).description
30
- # # => "be bigger than 2 and smaller than 4"
31
- # ...rather than:
32
- # # => "be bigger than 2"
33
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
- end
35
-
36
- # rspec-mocks config goes here. You can use an alternate test double
37
- # library (such as bogus or mocha) by changing the `mock_with` option here.
38
- config.mock_with :rspec do |mocks|
39
- # Prevents you from mocking or stubbing a method that does not exist on
40
- # a real object. This is generally recommended, and will default to
41
- # `true` in RSpec 4.
42
- mocks.verify_partial_doubles = true
43
- end
44
-
45
- # These two settings work together to allow you to limit a spec run
46
- # to individual examples or groups you care about by tagging them with
47
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
48
- # get run.
49
- config.filter_run :focus
50
- config.run_all_when_everything_filtered = true
51
-
52
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
53
- # For more details, see:
54
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
55
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
56
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
57
- config.disable_monkey_patching!
58
-
59
- # This setting enables warnings. It's recommended, but in some cases may
60
- # be too noisy due to issues in dependencies.
61
- # config.warnings = true
62
-
63
- # Many RSpec users commonly either run the entire suite or an individual
64
- # file, and it's useful to allow more verbose output when running an
65
- # individual spec file.
66
- if config.files_to_run.one?
67
- # Use the documentation formatter for detailed output,
68
- # unless a formatter has already been configured
69
- # (e.g. via a command-line flag).
70
- config.default_formatter = 'doc'
71
- end
72
-
73
- # Print the 10 slowest examples and example groups at the
74
- # end of the spec run, to help surface which specs are running
75
- # particularly slow.
76
- config.profile_examples = 1
77
-
78
- # Run specs in random order to surface order dependencies. If you find an
79
- # order dependency and want to debug it, you can fix the order by providing
80
- # the seed, which is printed after each run.
81
- # --seed 1234
82
- config.order = :random
83
-
84
- # Seed global randomization in this process using the `--seed` CLI option.
85
- # Setting this allows you to use `--seed` to deterministically reproduce
86
- # test failures related to randomization by passing the same `--seed` value
87
- # as the one that triggered the failure.
88
- Kernel.srand config.seed
89
- end
90
-
91
- require 'autoloaded'
data/spec/support/util.rb DELETED
@@ -1,43 +0,0 @@
1
- module Util
2
-
3
- class << self
4
-
5
- def constantize(name)
6
- return nil unless name
7
-
8
- begin
9
- eval name.to_s
10
- rescue NameError
11
- nil
12
- end
13
- end
14
-
15
- def namespace_and_unqualified_constant_name(constant_name,
16
- raise_if_namespace_invalid: false)
17
- namespace_name, unqualified_constant_name = split_namespace_and_constant(constant_name)
18
- if namespace_name && (namespace = constantize(namespace_name)).nil?
19
- if raise_if_namespace_invalid
20
- raise "namespace of #{constant_name} is not defined"
21
- end
22
- end
23
- [namespace, unqualified_constant_name]
24
- end
25
-
26
- def namespace_delimiter
27
- '::'
28
- end
29
-
30
- private
31
-
32
- def split_namespace_and_constant(constant_name)
33
- if (last_delimiter_index = constant_name.to_s.rindex(namespace_delimiter))
34
- return [constant_name[0...last_delimiter_index],
35
- constant_name[(last_delimiter_index + namespace_delimiter.length)..-1]]
36
- end
37
-
38
- return [nil, constant_name]
39
- end
40
-
41
- end
42
-
43
- end
@@ -1,37 +0,0 @@
1
- def without_side_effects
2
- return nil unless block_given?
3
-
4
- out_reader, out_writer = IO.pipe.collect { |io| io.tap(&:binmode) }
5
- err_reader, err_writer = IO.pipe.collect { |io| io.tap(&:binmode) }
6
-
7
- pid = fork do
8
- out_reader.close
9
- err_reader.close
10
-
11
- begin
12
- out_writer.write Marshal.dump(yield)
13
- rescue Exception => e
14
- clean_backtrace = e.backtrace.reject do |frame|
15
- frame.include? __FILE__
16
- end
17
- e.set_backtrace clean_backtrace
18
- err_writer.write Marshal.dump(e)
19
- raise e
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']
27
- end
28
-
29
- Process.wait pid
30
-
31
- out_writer.close
32
- err_writer.close
33
-
34
- return Marshal.load(out_reader.read) if $?.success?
35
-
36
- raise Marshal.load(err_reader.read)
37
- end