activesupport-cache-zstd_compressor 0.1.0 → 0.1.2
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 +4 -4
- data/CHANGES.md +13 -0
- data/LICENSE.txt +21 -0
- data/README.adoc +116 -0
- data/activesupport-cache-zstd_compressor.gemspec +38 -0
- data/lib/active_support/cache/zstd_compressor/version.rb +9 -0
- data/lib/active_support/cache/zstd_compressor/with_zlib_fallback.rb +21 -0
- data/lib/active_support/cache/zstd_compressor.rb +31 -0
- data/lib/activesupport-cache-zstd_compressor.rb +3 -0
- metadata +11 -40
- data/.github/workflows/ci.yml +0 -56
- data/.gitignore +0 -17
- data/.rspec +0 -2
- data/.rubocop.yml +0 -20
- data/.simplecov +0 -22
- data/Appraisals +0 -13
- data/Gemfile +0 -20
- data/Rakefile +0 -30
- data/bin/console +0 -11
- data/rubocop/layout.yml +0 -29
- data/rubocop/lint.yml +0 -41
- data/rubocop/metrics.yml +0 -18
- data/rubocop/naming.yml +0 -4
- data/rubocop/performance.yml +0 -25
- data/rubocop/rspec.yml +0 -14
- data/rubocop/style.yml +0 -86
- data/spec/active_support/cache/zstd_compressor/version_spec.rb +0 -7
- data/spec/active_support/cache/zstd_compressor/with_zlib_fallback_spec.rb +0 -38
- data/spec/active_support/cache/zstd_compressor_spec.rb +0 -24
- data/spec/spec_helper.rb +0 -92
- data/spec/support/compressor_behaviour.rb +0 -37
- data/spec/support/mutual-aid.muse +0 -1639
- data/tmp/.keep +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f42d60297d2c596b26d6e4ccd2c37103dfed3787b8cf62b687c3d5a443205f01
|
4
|
+
data.tar.gz: 43b0dde8a7e5b3063ea962e13f5b542b23548825872b54cd8af0f56b5604ddec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8700caa5dc33a6ecb8dddaeb969b59ce4077d16a79cdb080989142da959276fdc432f49a25aad19a4c50beff420c18b49253a8442a0f946006cf01db30ce26e
|
7
|
+
data.tar.gz: 97ff2472e62f7be56af4341497d46c646d34d597ed7f65098b7d1ee9faf19ef7e2b9e9c77c3f5d64a14f938c21baa7f0f9ab37cc7373195613af93788dc9c3e6
|
data/CHANGES.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
## [0.1.2] - 2025-05-31
|
4
|
+
|
5
|
+
- Remove Zeitwerk loader.
|
6
|
+
|
7
|
+
## [0.1.1] - 2025-05-30
|
8
|
+
|
9
|
+
- Initial release.
|
10
|
+
|
11
|
+
[Unreleased]: https://github.com/ixti/amazing-activist/compare/v0.1.2...main
|
12
|
+
[0.1.2]: https://github.com/ixti/amazing-activist/compare/v0.1.1...v0.1.2
|
13
|
+
[0.1.1]: https://github.com/ixti/amazing-activist/tree/v0.1.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Alexey Zapparov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.adoc
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
= ActiveSupport::Cache::ZstdCompressor
|
2
|
+
|
3
|
+
A blazing-fast https://facebook.github.io/zstd/[Zstandard] compressor for
|
4
|
+
`ActiveSupport::Cache`. Built for developers who appreciate both performance
|
5
|
+
and the finer things in life, like not waiting forever for cache operations.
|
6
|
+
|
7
|
+
🚀 Blazing Speed:: Decompression speeds that make LZ4 look sleepy.
|
8
|
+
🎯 Excellent Ratios:: Better compression than gzip with less CPU drama.
|
9
|
+
⚡ Tunable Performance:: 30 compression levels from "ludicrous speed" to "maximum squeeze".
|
10
|
+
🧠 Smart Memory Usage:: Uses modern amounts of RAM because it's not 1995 anymore.
|
11
|
+
|
12
|
+
|
13
|
+
== Installation
|
14
|
+
|
15
|
+
Install the gem and add to the application's Gemfile by executing:
|
16
|
+
|
17
|
+
[source,bash]
|
18
|
+
----
|
19
|
+
bundle add activesupport-cache-zstd_compressor
|
20
|
+
----
|
21
|
+
|
22
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
23
|
+
|
24
|
+
[source,bash]
|
25
|
+
----
|
26
|
+
gem install activesupport-cache-zstd_compressor
|
27
|
+
----
|
28
|
+
|
29
|
+
|
30
|
+
== Usage
|
31
|
+
|
32
|
+
[source,ruby]
|
33
|
+
----
|
34
|
+
Rails.application.configure do
|
35
|
+
config.cache_store = :redis_cache_store, {
|
36
|
+
url: ENV["REDIS_URL"],
|
37
|
+
compress: true,
|
38
|
+
compressor: ActiveSupport::Cache::ZstdCompressor.new
|
39
|
+
}
|
40
|
+
----
|
41
|
+
|
42
|
+
By default, it uses compression level `3`, but you can easily tweak it:
|
43
|
+
|
44
|
+
[source,ruby]
|
45
|
+
----
|
46
|
+
Rails.application.configure do
|
47
|
+
config.cache_store = :redis_cache_store, {
|
48
|
+
url: ENV["REDIS_URL"],
|
49
|
+
compress: true,
|
50
|
+
compressor: ActiveSupport::Cache::ZstdCompressor.new(level: 6)
|
51
|
+
}
|
52
|
+
----
|
53
|
+
|
54
|
+
|
55
|
+
=== Migrating from Rails default compressor (Zlib)
|
56
|
+
|
57
|
+
TIP: Perfect for production environments where cache invalidation is not an option.
|
58
|
+
|
59
|
+
[source,ruby]
|
60
|
+
----
|
61
|
+
Rails.application.configure do
|
62
|
+
config.cache_store = :redis_cache_store, {
|
63
|
+
url: ENV["REDIS_URL"],
|
64
|
+
compress: true,
|
65
|
+
compressor: ActiveSupport::Cache::ZstdCompressor::WithZlibFallback.new
|
66
|
+
}
|
67
|
+
----
|
68
|
+
|
69
|
+
How it works::
|
70
|
+
. 🔍 Detects compressed data format by magic number
|
71
|
+
. 📖 Reads existing Zlib-compressed cache entries seamlessly
|
72
|
+
. ✍️ Writes all new entries using superior Zstd compression
|
73
|
+
|
74
|
+
|
75
|
+
== Compatibility
|
76
|
+
|
77
|
+
This library aims to support and is tested against:
|
78
|
+
|
79
|
+
* https://www.ruby-lang.org[Ruby]
|
80
|
+
** MRI 3.2.x
|
81
|
+
** MRI 3.3.x
|
82
|
+
** MRI 3.4.x
|
83
|
+
|
84
|
+
* https://https://rubygems.org/gems/activesupport[ActiveSupport]
|
85
|
+
** 7.1.x
|
86
|
+
** 7.2.x
|
87
|
+
** 8.0.x
|
88
|
+
|
89
|
+
If something doesn't work on one of these versions, it's a bug.
|
90
|
+
|
91
|
+
This library may inadvertently work (or seem to work) on other Ruby versions,
|
92
|
+
however support will only be provided for the versions listed above.
|
93
|
+
|
94
|
+
|
95
|
+
== Development
|
96
|
+
|
97
|
+
[source,bash]
|
98
|
+
----
|
99
|
+
bundle install
|
100
|
+
bundle exec rake
|
101
|
+
----
|
102
|
+
|
103
|
+
|
104
|
+
== Contributing
|
105
|
+
|
106
|
+
* Fork activesupport-cache-zstd_compressor
|
107
|
+
* Make your changes
|
108
|
+
* Ensure all tests pass (`bundle exec rake`)
|
109
|
+
* Send a merge request
|
110
|
+
* If we like them we'll merge them
|
111
|
+
* If we've accepted a patch, feel free to ask for commit access!
|
112
|
+
|
113
|
+
|
114
|
+
== Acknowledgements
|
115
|
+
|
116
|
+
This library is inspired by https://github.com/pawurb/rails-brotli-cache
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "./lib/active_support/cache/zstd_compressor/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "activesupport-cache-zstd_compressor"
|
7
|
+
spec.version = ActiveSupport::Cache::ZstdCompressor::VERSION
|
8
|
+
spec.authors = ["Alexey Zapparov"]
|
9
|
+
spec.email = ["alexey@zapparov.com"]
|
10
|
+
|
11
|
+
spec.summary = "ZStandard compressor for ActiveSupport::Cache"
|
12
|
+
spec.description = "Drop-in Zlib compressor replacement for ActiveSupport::Cache"
|
13
|
+
spec.homepage = "https://github.com/ixti/activesupport-cache-zstd_compressor"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "#{spec.homepage}/tree/v#{spec.version}"
|
18
|
+
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/v#{spec.version}/CHANGES.md"
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
21
|
+
|
22
|
+
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
|
23
|
+
extras = %w[CHANGES.md LICENSE.txt README.adoc] << File.basename(__FILE__)
|
24
|
+
|
25
|
+
ls.readlines("\x0", chomp: true).select do |f|
|
26
|
+
f.start_with?("lib/") || extras.include?(f)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.required_ruby_version = ">= 3.2"
|
35
|
+
|
36
|
+
spec.add_dependency "activesupport", ">= 7.1"
|
37
|
+
spec.add_dependency "zstd-ruby", "~> 1.5", ">= 1.5.6.6"
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "zlib"
|
4
|
+
|
5
|
+
module ActiveSupport
|
6
|
+
module Cache
|
7
|
+
class ZstdCompressor
|
8
|
+
class WithZlibFallback < self
|
9
|
+
# ZStandard Magic Number (0xFD2FB528) in little-endian format.
|
10
|
+
# See: https://datatracker.ietf.org/doc/html/rfc8878#name-zstandard-frames
|
11
|
+
ZSTD_MAGIC_NUMBER = [0xFD2FB528].pack("L<")
|
12
|
+
|
13
|
+
def inflate(deflated)
|
14
|
+
return super if deflated.b.start_with?(ZSTD_MAGIC_NUMBER)
|
15
|
+
|
16
|
+
Zlib.inflate(deflated)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/cache"
|
4
|
+
require "zstd-ruby"
|
5
|
+
|
6
|
+
require_relative "./zstd_compressor/with_zlib_fallback"
|
7
|
+
require_relative "./zstd_compressor/version"
|
8
|
+
|
9
|
+
module ActiveSupport
|
10
|
+
module Cache
|
11
|
+
class ZstdCompressor
|
12
|
+
# @return [Integer] Compression level
|
13
|
+
attr_reader :level
|
14
|
+
|
15
|
+
# @param level [Integer] Compression level
|
16
|
+
def initialize(level: 3)
|
17
|
+
raise ArgumentError, "Compression level must be an Integer" unless level.is_a?(Integer)
|
18
|
+
|
19
|
+
@level = level
|
20
|
+
end
|
21
|
+
|
22
|
+
def deflate(inflated)
|
23
|
+
Zstd.compress(inflated, level:)
|
24
|
+
end
|
25
|
+
|
26
|
+
def inflate(deflated)
|
27
|
+
Zstd.decompress(deflated)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport-cache-zstd_compressor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Zapparov
|
@@ -23,20 +23,6 @@ dependencies:
|
|
23
23
|
- - ">="
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: '7.1'
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: zeitwerk
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
29
|
-
requirements:
|
30
|
-
- - "~>"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '2.6'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - "~>"
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '2.6'
|
40
26
|
- !ruby/object:Gem::Dependency
|
41
27
|
name: zstd-ruby
|
42
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,37 +50,22 @@ executables: []
|
|
64
50
|
extensions: []
|
65
51
|
extra_rdoc_files: []
|
66
52
|
files:
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
73
|
-
-
|
74
|
-
-
|
75
|
-
- bin/console
|
76
|
-
- rubocop/layout.yml
|
77
|
-
- rubocop/lint.yml
|
78
|
-
- rubocop/metrics.yml
|
79
|
-
- rubocop/naming.yml
|
80
|
-
- rubocop/performance.yml
|
81
|
-
- rubocop/rspec.yml
|
82
|
-
- rubocop/style.yml
|
83
|
-
- spec/active_support/cache/zstd_compressor/version_spec.rb
|
84
|
-
- spec/active_support/cache/zstd_compressor/with_zlib_fallback_spec.rb
|
85
|
-
- spec/active_support/cache/zstd_compressor_spec.rb
|
86
|
-
- spec/spec_helper.rb
|
87
|
-
- spec/support/compressor_behaviour.rb
|
88
|
-
- spec/support/mutual-aid.muse
|
89
|
-
- tmp/.keep
|
53
|
+
- CHANGES.md
|
54
|
+
- LICENSE.txt
|
55
|
+
- README.adoc
|
56
|
+
- activesupport-cache-zstd_compressor.gemspec
|
57
|
+
- lib/active_support/cache/zstd_compressor.rb
|
58
|
+
- lib/active_support/cache/zstd_compressor/version.rb
|
59
|
+
- lib/active_support/cache/zstd_compressor/with_zlib_fallback.rb
|
60
|
+
- lib/activesupport-cache-zstd_compressor.rb
|
90
61
|
homepage: https://github.com/ixti/activesupport-cache-zstd_compressor
|
91
62
|
licenses:
|
92
63
|
- MIT
|
93
64
|
metadata:
|
94
65
|
homepage_uri: https://github.com/ixti/activesupport-cache-zstd_compressor
|
95
|
-
source_code_uri: https://github.com/ixti/activesupport-cache-zstd_compressor/tree/v0.1.
|
66
|
+
source_code_uri: https://github.com/ixti/activesupport-cache-zstd_compressor/tree/v0.1.2
|
96
67
|
bug_tracker_uri: https://github.com/ixti/activesupport-cache-zstd_compressor/issues
|
97
|
-
changelog_uri: https://github.com/ixti/activesupport-cache-zstd_compressor/blob/v0.1.
|
68
|
+
changelog_uri: https://github.com/ixti/activesupport-cache-zstd_compressor/blob/v0.1.2/CHANGES.md
|
98
69
|
rubygems_mfa_required: 'true'
|
99
70
|
rdoc_options: []
|
100
71
|
require_paths:
|
data/.github/workflows/ci.yml
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
name: CI
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches: [ main ]
|
6
|
-
pull_request:
|
7
|
-
branches: [ main ]
|
8
|
-
|
9
|
-
jobs:
|
10
|
-
test:
|
11
|
-
name: "test / ${{ matrix.ruby }}"
|
12
|
-
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
|
15
|
-
strategy:
|
16
|
-
fail-fast: false
|
17
|
-
matrix:
|
18
|
-
ruby: [ "3.2", "3.3", "3.4", head ]
|
19
|
-
|
20
|
-
steps:
|
21
|
-
- uses: actions/checkout@v4
|
22
|
-
|
23
|
-
- uses: ruby/setup-ruby@v1
|
24
|
-
with:
|
25
|
-
ruby-version: ${{ matrix.ruby }}
|
26
|
-
bundler-cache: true
|
27
|
-
|
28
|
-
- run: bundle exec rake test
|
29
|
-
|
30
|
-
- name: Upload coverage reports to Codecov
|
31
|
-
uses: codecov/codecov-action@v4
|
32
|
-
|
33
|
-
# See: https://github.com/orgs/community/discussions/26822#discussioncomment-3305794
|
34
|
-
test-finale:
|
35
|
-
name: "test"
|
36
|
-
|
37
|
-
runs-on: ubuntu-latest
|
38
|
-
if: ${{ always() }}
|
39
|
-
|
40
|
-
needs: [test]
|
41
|
-
|
42
|
-
steps:
|
43
|
-
- run: test "success" = "${{ needs.test.result }}"
|
44
|
-
|
45
|
-
lint:
|
46
|
-
runs-on: ubuntu-latest
|
47
|
-
|
48
|
-
steps:
|
49
|
-
- uses: actions/checkout@v4
|
50
|
-
|
51
|
-
- uses: ruby/setup-ruby@v1
|
52
|
-
with:
|
53
|
-
ruby-version: "3.4"
|
54
|
-
bundler-cache: true
|
55
|
-
|
56
|
-
- run: bundle exec rake lint
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
plugins:
|
2
|
-
- rubocop-performance
|
3
|
-
- rubocop-rake
|
4
|
-
- rubocop-rspec
|
5
|
-
|
6
|
-
inherit_from:
|
7
|
-
- rubocop/layout.yml
|
8
|
-
- rubocop/lint.yml
|
9
|
-
- rubocop/metrics.yml
|
10
|
-
- rubocop/naming.yml
|
11
|
-
- rubocop/performance.yml
|
12
|
-
- rubocop/rspec.yml
|
13
|
-
- rubocop/style.yml
|
14
|
-
|
15
|
-
AllCops:
|
16
|
-
NewCops: enable
|
17
|
-
TargetRubyVersion: 3.2
|
18
|
-
Exclude:
|
19
|
-
- gemfiles/**/*
|
20
|
-
- vendor/**/*
|
data/.simplecov
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
SimpleCov.start do
|
4
|
-
gemfile = File.basename(ENV.fetch("BUNDLE_GEMFILE", "Gemfile"), ".gemfile").strip
|
5
|
-
gemfile = nil if gemfile.empty? || gemfile.casecmp?("gems.rb") || gemfile.casecmp?("Gemfile")
|
6
|
-
|
7
|
-
command_name ["#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}", gemfile].compact.join("/")
|
8
|
-
|
9
|
-
enable_coverage :branch
|
10
|
-
|
11
|
-
if ENV["CI"]
|
12
|
-
require "simplecov-cobertura"
|
13
|
-
formatter SimpleCov::Formatter::CoberturaFormatter
|
14
|
-
else
|
15
|
-
formatter SimpleCov::Formatter::MultiFormatter.new([
|
16
|
-
SimpleCov::Formatter::SimpleFormatter,
|
17
|
-
SimpleCov::Formatter::HTMLFormatter
|
18
|
-
])
|
19
|
-
end
|
20
|
-
|
21
|
-
add_filter "/spec/"
|
22
|
-
end
|
data/Appraisals
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
appraise "activesupport-7.1.x" do
|
4
|
-
gem "activesupport", "~> 7.1.0"
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "activesupport-7.2.x" do
|
8
|
-
gem "activesupport", "~> 7.2.0"
|
9
|
-
end
|
10
|
-
|
11
|
-
appraise "activesupport-8.0.x" do
|
12
|
-
gem "activesupport", "~> 8.0.0"
|
13
|
-
end
|
data/Gemfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "appraisal"
|
7
|
-
gem "rake"
|
8
|
-
|
9
|
-
gem "rspec"
|
10
|
-
|
11
|
-
gem "simplecov"
|
12
|
-
gem "simplecov-cobertura"
|
13
|
-
|
14
|
-
gem "rubocop", require: false
|
15
|
-
gem "rubocop-performance", require: false
|
16
|
-
gem "rubocop-rake", require: false
|
17
|
-
gem "rubocop-rspec", require: false
|
18
|
-
|
19
|
-
gem "debug"
|
20
|
-
gem "irb"
|
data/Rakefile
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
|
5
|
-
desc "Run tests"
|
6
|
-
task :test do
|
7
|
-
rm_rf "coverage"
|
8
|
-
rm_rf "gemfiles"
|
9
|
-
|
10
|
-
Bundler.with_unbundled_env do
|
11
|
-
sh "bundle exec appraisal generate"
|
12
|
-
|
13
|
-
# XXX: `bundle exec appraisal install` fails on ruby-3.2
|
14
|
-
Dir["gemfiles/*.gemfile"].each do |gemfile|
|
15
|
-
sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle lock")
|
16
|
-
sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle check") do |ok|
|
17
|
-
sh({ "BUNDLE_GEMFILE" => gemfile }, "bundle install") unless ok
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
sh "bundle exec appraisal rspec --force-colour"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
desc "Lint codebase"
|
26
|
-
task :lint do
|
27
|
-
sh "bundle exec rubocop --color"
|
28
|
-
end
|
29
|
-
|
30
|
-
task default: %i[test lint]
|
data/bin/console
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/setup"
|
5
|
-
require "active_support/cache/zstd_compressor"
|
6
|
-
|
7
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
-
# with your gem easier. You can also use a different console, if you like.
|
9
|
-
|
10
|
-
require "irb"
|
11
|
-
IRB.start(__FILE__)
|
data/rubocop/layout.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
Layout/ArgumentAlignment:
|
2
|
-
Enabled: true
|
3
|
-
EnforcedStyle: with_fixed_indentation
|
4
|
-
|
5
|
-
Layout/ClassStructure:
|
6
|
-
Enabled: true
|
7
|
-
|
8
|
-
Layout/EmptyLinesAroundAttributeAccessor:
|
9
|
-
Enabled: true
|
10
|
-
|
11
|
-
Layout/FirstArrayElementIndentation:
|
12
|
-
Enabled: true
|
13
|
-
EnforcedStyle: consistent
|
14
|
-
|
15
|
-
Layout/FirstHashElementIndentation:
|
16
|
-
Enabled: true
|
17
|
-
EnforcedStyle: consistent
|
18
|
-
|
19
|
-
Layout/HashAlignment:
|
20
|
-
Enabled: true
|
21
|
-
EnforcedHashRocketStyle: table
|
22
|
-
EnforcedColonStyle: table
|
23
|
-
|
24
|
-
Layout/SpaceAroundMethodCallOperator:
|
25
|
-
Enabled: true
|
26
|
-
|
27
|
-
Layout/MultilineMethodCallIndentation:
|
28
|
-
Enabled: true
|
29
|
-
EnforcedStyle: indented
|
data/rubocop/lint.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
Lint/BinaryOperatorWithIdenticalOperands:
|
2
|
-
Enabled: true
|
3
|
-
|
4
|
-
Lint/DeprecatedOpenSSLConstant:
|
5
|
-
Enabled: true
|
6
|
-
|
7
|
-
Lint/DuplicateElsifCondition:
|
8
|
-
Enabled: true
|
9
|
-
|
10
|
-
Lint/DuplicateRescueException:
|
11
|
-
Enabled: true
|
12
|
-
|
13
|
-
Lint/EmptyConditionalBody:
|
14
|
-
Enabled: true
|
15
|
-
|
16
|
-
Lint/FloatComparison:
|
17
|
-
Enabled: true
|
18
|
-
|
19
|
-
Lint/MissingSuper:
|
20
|
-
Enabled: true
|
21
|
-
|
22
|
-
Lint/MixedRegexpCaptureTypes:
|
23
|
-
Enabled: true
|
24
|
-
|
25
|
-
Lint/OutOfRangeRegexpRef:
|
26
|
-
Enabled: true
|
27
|
-
|
28
|
-
Lint/RaiseException:
|
29
|
-
Enabled: true
|
30
|
-
|
31
|
-
Lint/SelfAssignment:
|
32
|
-
Enabled: true
|
33
|
-
|
34
|
-
Lint/StructNewOverride:
|
35
|
-
Enabled: true
|
36
|
-
|
37
|
-
Lint/TopLevelReturnWithArgument:
|
38
|
-
Enabled: true
|
39
|
-
|
40
|
-
Lint/UnreachableLoop:
|
41
|
-
Enabled: true
|
data/rubocop/metrics.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Metrics/BlockLength:
|
2
|
-
Enabled: true
|
3
|
-
CountAsOne: [array, hash, heredoc, method_call]
|
4
|
-
Exclude:
|
5
|
-
- "spec/**/*_spec.rb"
|
6
|
-
- "**/*.gemspec"
|
7
|
-
|
8
|
-
Metrics/ClassLength:
|
9
|
-
Enabled: true
|
10
|
-
CountAsOne: [array, hash, heredoc, method_call]
|
11
|
-
|
12
|
-
Metrics/MethodLength:
|
13
|
-
Enabled: true
|
14
|
-
CountAsOne: [array, hash, heredoc, method_call]
|
15
|
-
|
16
|
-
Metrics/ModuleLength:
|
17
|
-
Enabled: true
|
18
|
-
CountAsOne: [array, hash, heredoc, method_call]
|
data/rubocop/naming.yml
DELETED
data/rubocop/performance.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
Performance/AncestorsInclude:
|
2
|
-
Enabled: true
|
3
|
-
|
4
|
-
Performance/BigDecimalWithNumericArgument:
|
5
|
-
Enabled: true
|
6
|
-
|
7
|
-
Performance/RedundantSortBlock:
|
8
|
-
Enabled: true
|
9
|
-
|
10
|
-
Performance/RedundantStringChars:
|
11
|
-
Enabled: true
|
12
|
-
|
13
|
-
Performance/ReverseFirst:
|
14
|
-
Enabled: true
|
15
|
-
|
16
|
-
Performance/SortReverse:
|
17
|
-
Enabled: true
|
18
|
-
|
19
|
-
Performance/Squeeze:
|
20
|
-
Enabled: true
|
21
|
-
|
22
|
-
Performance/StringInclude:
|
23
|
-
Enabled: true
|
24
|
-
|
25
|
-
|