onload 1.0.4 → 1.1.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.
@@ -0,0 +1 @@
1
+ 845b2bf708e38dbd5e76ad0e14c5d811cce17629c6fb0906f34608435e939aabb2db6cbc95dc597d7bd4c46d0ba130d4d01e82a68fcb004c5be672221c0cd636
@@ -14,4 +14,12 @@ describe Onload do
14
14
  expect(Hello.new.hello).to eq("hello")
15
15
  end
16
16
  end
17
+
18
+ it "adds an entry to the specified ignore file" do
19
+ Onload.with_config(ignore_path: @ignore_path) do
20
+ require "hello"
21
+ ignore_file = Onload::IgnoreFile.load(@ignore_path)
22
+ expect(ignore_file).to include("fixtures/hello.rb")
23
+ end
24
+ end
17
25
  end
data/spec/spec_setup.rb CHANGED
@@ -4,7 +4,7 @@ require "onload"
4
4
 
5
5
  class UpcasePreprocessor
6
6
  def self.call(source)
7
- source.gsub(/(\"\w+\")/, '\1.upcase')
7
+ source.gsub(/(\"[\w ]+\")/, '\1.upcase')
8
8
  end
9
9
  end
10
10
 
@@ -17,6 +17,14 @@ module Onload
17
17
  processed_file = Onload::File.new(unprocessed_file).outfile
18
18
  ::File.unlink(processed_file) if ::File.exist?(processed_file)
19
19
  $LOADED_FEATURES.delete(unprocessed_file)
20
+
21
+ if defined?(Rails)
22
+ if Rails.respond_to?(:autoloaders)
23
+ Rails.autoloaders.main.reload
24
+ else
25
+ ActiveSupport::Dependencies.remove_unloadable_constants!
26
+ end
27
+ end
20
28
  end
21
29
 
22
30
  yield
@@ -34,7 +42,16 @@ RSpec.configure do |config|
34
42
  config.extend(Onload::TestHelpers)
35
43
 
36
44
  config.around(:each) do |example|
37
- Onload::TestHelpers.with_clean_env { example.run }
45
+ @ignore_path = ::File.join("spec", ".testignore")
46
+
47
+ ::File.unlink(@ignore_path) if ::File.exist?(@ignore_path)
48
+ ::File.write(@ignore_path, "")
49
+
50
+ begin
51
+ Onload::TestHelpers.with_clean_env { example.run }
52
+ ensure
53
+ ::File.unlink(@ignore_path) if ::File.exist?(@ignore_path)
54
+ end
38
55
  end
39
56
  end
40
57
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: A preprocessor system for Ruby.
14
13
  email:
@@ -23,27 +22,36 @@ files:
23
22
  - README.md
24
23
  - Rakefile
25
24
  - lib/onload.rb
25
+ - lib/onload/config.rb
26
26
  - lib/onload/core_ext/kernel.rb
27
27
  - lib/onload/core_ext/kernel_zeitwerk.rb
28
28
  - lib/onload/ext/activesupport/dependencies.rb
29
29
  - lib/onload/ext/bootsnap/autoload.rb
30
30
  - lib/onload/ext/zeitwerk/loader.rb
31
31
  - lib/onload/file.rb
32
+ - lib/onload/ignore_file.rb
32
33
  - lib/onload/railtie.rb
33
34
  - lib/onload/tasks/transpile.rake
34
35
  - lib/onload/tasks/transpile_rails.rake
35
36
  - lib/onload/version.rb
36
37
  - onload.gemspec
38
+ - spec/fixtures/hello.rb
37
39
  - spec/fixtures/hello.rb.up
38
40
  - spec/rails/controllers/home_controller_spec.rb
39
41
  - spec/rails/dummy/app/controllers/application_controller.rb
40
42
  - spec/rails/dummy/app/controllers/home_controller.rb
43
+ - spec/rails/dummy/app/views/home/action_list.html.erb
41
44
  - spec/rails/dummy/app/views/home/index.html.erb
42
45
  - spec/rails/dummy/app/views/layouts/application.html.erb
43
46
  - spec/rails/dummy/config/application.rb
44
47
  - spec/rails/dummy/config/routes.rb
45
48
  - spec/rails/dummy/config/secrets.yml
49
+ - spec/rails/dummy/lib/primer/alpha/action_list.rb
50
+ - spec/rails/dummy/lib/primer/alpha/action_list.up
51
+ - spec/rails/dummy/lib/primer/alpha/action_list/item.rb
52
+ - spec/rails/dummy/lib/primer/alpha/action_list/item.up
46
53
  - spec/rails/dummy/log/test.log
54
+ - spec/rails/dummy/tmp/local_secret.txt
47
55
  - spec/rails/spec_helper.rb
48
56
  - spec/ruby/onload_spec.rb
49
57
  - spec/ruby/spec_helper.rb
@@ -51,7 +59,6 @@ files:
51
59
  homepage: http://github.com/camertron/onload
52
60
  licenses: []
53
61
  metadata: {}
54
- post_install_message:
55
62
  rdoc_options: []
56
63
  require_paths:
57
64
  - lib
@@ -66,8 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
73
  - !ruby/object:Gem::Version
67
74
  version: '0'
68
75
  requirements: []
69
- rubygems_version: 3.4.19
70
- signing_key:
76
+ rubygems_version: 3.6.7
71
77
  specification_version: 4
72
78
  summary: A preprocessor system for Ruby.
73
79
  test_files: []