freezolite 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +14 -33
- data/lib/freezolite/auto.rb +4 -1
- data/lib/freezolite/version.rb +1 -1
- data/lib/freezolite.rb +7 -14
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba7e6d9681a85534191c401f217c1d8f184dc86d1f2ac520972352db9d4b7f47
|
4
|
+
data.tar.gz: 4f92015d4bb62e597f707dc2fc512730bbeb2c06fc652f6b3b20b9bfaa38379c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71499e074c60a508d907b0fa2e983ad870668fa74430bee8fcc06cbe34ed1d591ae5b6f86e9e0d71d2571d963263a8ad028f745c7be01f2d7b733f09d11a03e2
|
7
|
+
data.tar.gz: fb213aaa5f7677908f65154888cb511883ef3e97a2a59b53a7831c8dfc2e9e3a0e9244e465a09677645fd62e6e3d15c1fa45c6a6c41a227e61b60c1e4eadaf09
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 0.4.0 (2023-08-23)
|
6
|
+
|
7
|
+
- Upgrade to `require-hooks` 0.2.0. ([@palkan][])
|
8
|
+
|
9
|
+
## 0.3.0 (2023-07-19)
|
10
|
+
|
11
|
+
- Ignore `./vendor` by default when using `freezolite/auto`. ([@palkan][])
|
12
|
+
|
13
|
+
- Replace `watch_dirs` with `patterns` and `exclude_patterns`. ([@palkan][])
|
14
|
+
|
5
15
|
## 0.2.0 (2023-07-14)
|
6
16
|
|
7
17
|
- Change name from `freeze_the_lits` to `freezolite`. ([@palkan][])
|
data/README.md
CHANGED
@@ -15,10 +15,17 @@ Add the gem to your Gemfile:
|
|
15
15
|
gem "freezolite"
|
16
16
|
```
|
17
17
|
|
18
|
-
And drop the following line to your application
|
18
|
+
And drop the following line to your application entry-point **after loading dependencies** and before loading your application code. For example, in Rails, you can put it to `config/application.rb` after the `Bundler.require(...)` call:
|
19
19
|
|
20
20
|
```ruby
|
21
|
+
# config/application.rb
|
22
|
+
|
23
|
+
#...
|
24
|
+
Bundler.require(*Rails.groups)
|
25
|
+
|
21
26
|
require "freezolite/auto"
|
27
|
+
|
28
|
+
# <application configuration>
|
22
29
|
```
|
23
30
|
|
24
31
|
By default, the gem uses `Dir.pwd` to determine the project root. If you want to use a different directory or multiple directories, configure the gem like this:
|
@@ -27,43 +34,17 @@ By default, the gem uses `Dir.pwd` to determine the project root. If you want to
|
|
27
34
|
require "freezolite"
|
28
35
|
|
29
36
|
Freezolite.setup(
|
30
|
-
|
37
|
+
# You must pass a list of glob patterns
|
38
|
+
patterns: ["/path/to/dir1/*.rb", "/path/to/dir2/*.rb"],
|
39
|
+
exclude_patterns: ["/path/to/dir1/vendor/*"]
|
31
40
|
)
|
32
41
|
```
|
33
42
|
|
34
|
-
|
35
|
-
|
36
|
-
FreezeTheList is compatible with Bootsnap. Just make sure you require it **after** Bootsnap:
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
# config/boot.rb
|
40
|
-
|
41
|
-
require "bootsnap/setup"
|
42
|
-
require "freezolite/auto"
|
43
|
-
require "bundler/setup"
|
44
|
-
```
|
45
|
-
|
46
|
-
### Using in tests
|
43
|
+
**NOTE**: When using auto mode, the `<project-root>/vendor/bundle` folder is excluded automatically. In manual mode, you may want to exclude it yourself.
|
47
44
|
|
48
|
-
|
49
|
-
|
50
|
-
#### RSpec
|
51
|
-
|
52
|
-
Put the following line to `spec_helper.rb`:
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
require "freezolite/auto"
|
56
|
-
```
|
57
|
-
|
58
|
-
Make sure you have `spec_helper.rb` _preloaded_ by RSpec by putting the following to the `.rspec` file:
|
59
|
-
|
60
|
-
```txt
|
61
|
-
--require spec_helper
|
62
|
-
```
|
63
|
-
|
64
|
-
#### Minitest
|
45
|
+
### Using with Bootsnap
|
65
46
|
|
66
|
-
|
47
|
+
Freezolite is compatible with Bootsnap. Just make sure you require it **after** Bootsnap. No manual cache invalidation required.
|
67
48
|
|
68
49
|
### Supported Ruby versions
|
69
50
|
|
data/lib/freezolite/auto.rb
CHANGED
data/lib/freezolite/version.rb
CHANGED
data/lib/freezolite.rb
CHANGED
@@ -4,22 +4,15 @@ require "freezolite/version"
|
|
4
4
|
|
5
5
|
module Freezolite
|
6
6
|
class << self
|
7
|
-
|
8
|
-
|
9
|
-
def setup(watch_dirs:)
|
10
|
-
self.watch_dirs = watch_dirs.freeze
|
7
|
+
def setup(patterns:, exclude_patterns: nil)
|
11
8
|
require "require-hooks/setup"
|
12
9
|
|
13
|
-
::RequireHooks.around_load do |path, &block|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
block.call
|
20
|
-
ensure
|
21
|
-
::RubyVM::InstructionSequence.compile_option = {frozen_string_literal: was_frozen_string_literal}
|
22
|
-
end
|
10
|
+
::RequireHooks.around_load(patterns: patterns, exclude_patterns: exclude_patterns) do |path, &block|
|
11
|
+
was_frozen_string_literal = ::RubyVM::InstructionSequence.compile_option[:frozen_string_literal]
|
12
|
+
::RubyVM::InstructionSequence.compile_option = {frozen_string_literal: true}
|
13
|
+
block.call
|
14
|
+
ensure
|
15
|
+
::RubyVM::InstructionSequence.compile_option = {frozen_string_literal: was_frozen_string_literal}
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freezolite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Dementyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: require-hooks
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|