WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 0 additions & 82 deletions .github/workflows/codeql.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/lint.yml

This file was deleted.

23 changes: 2 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ on:
- main
jobs:
go:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.20.x, 1.21.x]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- run: make test
uses: bsm/misc/.github/workflows/test-go.yml@main
ruby:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["2.7", "3.0", "3.1", "3.2"]
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- run: bundle exec rake
uses: bsm/misc/.github/workflows/test-ruby.yml@main
10 changes: 6 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
linters-settings:
errcheck:
exclude-functions:
- (*github.com/bsm/feedx.Writer).Discard
version: "2"
linters:
settings:
errcheck:
exclude-functions:
- (*github.com/bsm/feedx.Writer).Discard
22 changes: 8 additions & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
inherit_gem:
rubocop-bsm:
- default.yml
plugins:
- rubocop-rake
- rubocop-rspec

inherit_from:
- https://raw.githubusercontent.com/bsm/misc/refs/heads/main/rubocop/default.yml
- https://raw.githubusercontent.com/bsm/misc/refs/heads/main/rubocop/rspec.yml

inherit_mode:
merge:
- Exclude

AllCops:
TargetRubyVersion: 2.7
Naming/MethodParameterName:
MinNameLength: 2
Naming/MemoizedInstanceVariableName:
Enabled: false
Naming/FileName:
Exclude: [lib/sortable-by.rb]
Metrics/ParameterLists:
Max: 8
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.4.7
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
source 'https://rubygems.org'

gemspec
gem 'bundler'
gem 'pbio'
gem 'rake'
gem 'rspec'
gem 'rubocop'
gem 'rubocop-rake'
gem 'rubocop-rspec'
98 changes: 50 additions & 48 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
PATH
remote: .
specs:
feedx (0.13.0)
feedx (0.14.0)
bfs (>= 0.8.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
ast (2.4.3)
bfs (0.9.1)
diff-lcs (1.5.0)
google-protobuf (3.21.7)
json (2.6.2)
parallel (1.22.1)
parser (3.1.2.1)
diff-lcs (1.6.2)
google-protobuf (3.25.8)
json (2.16.0)
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
parallel (1.27.0)
parser (3.3.10.0)
ast (~> 2.4.1)
pbio (0.3.1)
google-protobuf
racc
pbio (0.4.0)
google-protobuf (> 3, < 4)
prism (1.6.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.6.0)
rexml (3.2.8)
strscan (>= 3.0.9)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.1)
rake (13.3.1)
regexp_parser (2.11.3)
rspec (3.13.2)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.6)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.7)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (3.11.1)
rubocop (1.36.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.6)
rubocop (1.81.7)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.47.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-bsm (0.6.0)
rubocop (~> 1.0)
rubocop-performance
rubocop-rake
rubocop-rspec
rubocop-performance (1.15.0)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.13.2)
rubocop (~> 1.33)
ruby-progressbar (1.11.0)
strscan (3.1.0)
unicode-display_width (2.3.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.47.1)
parser (>= 3.3.7.2)
prism (~> 1.4)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-rspec (3.7.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.13.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)

PLATFORMS
ruby
Expand All @@ -72,7 +72,9 @@ DEPENDENCIES
pbio
rake
rspec
rubocop-bsm
rubocop
rubocop-rake
rubocop-rspec

BUNDLED WITH
2.3.16
29 changes: 29 additions & 0 deletions compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"compress/gzip"
"io"
"path"

"github.com/klauspost/compress/zstd"
)

// Compression represents the data compression.
Expand All @@ -23,6 +25,8 @@ func DetectCompression(name string) Compression {
return GZipCompression
} else if ext == ".flate" {
return FlateCompression
} else if ext == ".zst" {
return ZstdCompression
}
}
return NoCompression
Expand Down Expand Up @@ -79,3 +83,28 @@ func (flateCompression) NewReader(r io.Reader) (io.ReadCloser, error) {
func (flateCompression) NewWriter(w io.Writer) (io.WriteCloser, error) {
return flate.NewWriter(w, flate.BestSpeed)
}

// --------------------------------------------------------------------

// ZstdCompression supports zstd compression format.
var ZstdCompression = zstdCompression{}

type zstdCompression struct{}

func (zstdCompression) NewReader(r io.Reader) (io.ReadCloser, error) {
zr, err := zstd.NewReader(r)
if err != nil {
return nil, err
}
return zstdDecoder{Decoder: zr}, nil
}

func (zstdCompression) NewWriter(w io.Writer) (io.WriteCloser, error) {
return zstd.NewWriter(w)
}

type zstdDecoder struct {
*zstd.Decoder
}

func (zstdDecoder) Close() error { return nil }
Loading