Skip to content

Commit bf18c8b

Browse files
committed
Modernize gem.
1 parent 6c06685 commit bf18c8b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+333
-227
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Documentation Coverage
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
COVERAGE: PartialSummary
11+
12+
jobs:
13+
validate:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: "3.3"
21+
bundler-cache: true
22+
23+
- name: Validate coverage
24+
timeout-minutes: 5
25+
run: bundle exec bake decode:index:coverage lib

.github/workflows/rubocop.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: RuboCop
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: ruby
20+
bundler-cache: true
21+
22+
- name: Run RuboCop
23+
timeout-minutes: 10
24+
run: bundle exec rubocop

.github/workflows/coverage.yaml .github/workflows/test-coverage.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Coverage
1+
name: Test Coverage
22

33
on: [push, pull_request]
44

@@ -33,9 +33,11 @@ jobs:
3333
- name: Run tests
3434
timeout-minutes: 5
3535
run: bundle exec bake test
36-
37-
- uses: actions/upload-artifact@v3
36+
37+
- uses: actions/upload-artifact@v4
3838
with:
39+
include-hidden-files: true
40+
if-no-files-found: error
3941
name: coverage-${{matrix.os}}-${{matrix.ruby}}
4042
path: .covered.db
4143

@@ -50,7 +52,7 @@ jobs:
5052
ruby-version: "3.3"
5153
bundler-cache: true
5254

53-
- uses: actions/download-artifact@v3
55+
- uses: actions/download-artifact@v4
5456

5557
- name: Validate coverage
5658
timeout-minutes: 5

.rubocop.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
AllCops:
2+
DisabledByDefault: true
3+
4+
Layout/IndentationStyle:
5+
Enabled: true
6+
EnforcedStyle: tabs
7+
8+
Layout/InitialIndentation:
9+
Enabled: true
10+
11+
Layout/IndentationWidth:
12+
Enabled: true
13+
Width: 1
14+
15+
Layout/IndentationConsistency:
16+
Enabled: true
17+
EnforcedStyle: normal
18+
19+
Layout/BlockAlignment:
20+
Enabled: true
21+
22+
Layout/EndAlignment:
23+
Enabled: true
24+
EnforcedStyleAlignWith: start_of_line
25+
26+
Layout/BeginEndAlignment:
27+
Enabled: true
28+
EnforcedStyleAlignWith: start_of_line
29+
30+
Layout/ElseAlignment:
31+
Enabled: true
32+
33+
Layout/DefEndAlignment:
34+
Enabled: true
35+
36+
Layout/CaseIndentation:
37+
Enabled: true
38+
39+
Layout/CommentIndentation:
40+
Enabled: true
41+
42+
Layout/EmptyLinesAroundClassBody:
43+
Enabled: true
44+
45+
Layout/EmptyLinesAroundModuleBody:
46+
Enabled: true
47+
48+
Style/FrozenStringLiteralComment:
49+
Enabled: true
50+
51+
Style/StringLiterals:
52+
Enabled: true
53+
EnforcedStyle: double_quotes

config/sus.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2023, by Samuel Williams.
4+
# Copyright, 2023-2024, by Samuel Williams.
55

6-
require 'covered/sus'
6+
require "covered/sus"
77
include Covered::Sus

examples/http2/request.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

66
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
77

8-
require 'async'
9-
require 'async/io/stream'
10-
require 'async/http/endpoint'
11-
require 'protocol/http2/client'
8+
require "async"
9+
require "async/io/stream"
10+
require "async/http/endpoint"
11+
require "protocol/http2/client"
1212

1313
Async do
1414
endpoint = Async::HTTP::Endpoint.parse("https://www.google.com/search?q=kittens")

examples/http2/requests.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

66
$LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
77

8-
require 'async'
9-
require 'async/io/stream'
10-
require 'async/http/endpoint'
11-
require 'protocol/http2/client'
8+
require "async"
9+
require "async/io/stream"
10+
require "async/http/endpoint"
11+
require "protocol/http2/client"
1212

1313
queries = ["apple", "orange", "teapot", "async"]
1414

fixtures/protocol/http2/a_frame.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http2/framer'
6+
require "protocol/http2/framer"
77

88
module Protocol
99
module HTTP2

fixtures/protocol/http2/connection_context.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http2/client'
7-
require 'protocol/http2/server'
8-
require 'protocol/http2/stream'
6+
require "protocol/http2/client"
7+
require "protocol/http2/server"
8+
require "protocol/http2/stream"
99

10-
require 'socket'
10+
require "socket"
1111

1212
module Protocol
1313
module HTTP2

fuzz/framer/bake.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2020-2023, by Samuel Williams.
4+
# Copyright, 2020-2024, by Samuel Williams.
55

66
# Run the fuzz test.
77
def run
88
system("AFL_SKIP_BIN_CHECK=1 afl-fuzz -i input/ -o output/ -m 100 -- ruby script.rb")
99
end
1010

1111
def generate
12-
require_relative '../../lib/protocol/http2/framer'
12+
require_relative "../../lib/protocol/http2/framer"
1313

1414
framer = Protocol::HTTP2::Framer.new($stdout)
1515

fuzz/framer/script.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# frozen_string_literal: true
33

44
# Released under the MIT License.
5-
# Copyright, 2020-2023, by Samuel Williams.
5+
# Copyright, 2020-2024, by Samuel Williams.
66

7-
require 'socket'
8-
require_relative '../../lib/protocol/http2/framer'
7+
require "socket"
8+
require_relative "../../lib/protocol/http2/framer"
99

1010
def test
1111
framer = Protocol::HTTP2::Framer.new($stdin)
@@ -18,9 +18,9 @@ def test
1818
end
1919

2020
if ENV["_"] =~ /afl/
21-
require 'kisaten'
21+
require "kisaten"
2222

23-
Kisaten.crash_at [Exception], [EOFError, Protocol::HTTP2::FrameSizeError, Protocol::HTTP2::ProtocolError], Signal.list['USR1']
23+
Kisaten.crash_at [Exception], [EOFError, Protocol::HTTP2::FrameSizeError, Protocol::HTTP2::ProtocolError], Signal.list["USR1"]
2424

2525
while Kisaten.loop 10_000
2626
test

gems.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
end
1616

1717
group "test" do
18-
gem "covered"
1918
gem "sus"
19+
gem "covered"
20+
gem "decode"
21+
gem "rubocop"
2022

2123
gem "bake-test"
2224
gem "bake-test-external"

lib/protocol/http2.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require_relative 'http2/version'
7-
require_relative 'http2/connection'
6+
require_relative "http2/version"
7+
require_relative "http2/connection"

lib/protocol/http2/client.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require_relative 'connection'
6+
require_relative "connection"
77

88
module Protocol
99
module HTTP2

lib/protocol/http2/connection.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
# Copyright, 2019-2024, by Samuel Williams.
55
# Copyright, 2023, by Marco Concetto Rudilosso.
66

7-
require_relative 'framer'
8-
require_relative 'dependency'
9-
require_relative 'flow_controlled'
7+
require_relative "framer"
8+
require_relative "dependency"
9+
require_relative "flow_controlled"
1010

11-
require 'protocol/hpack'
11+
require "protocol/hpack"
1212

1313
module Protocol
1414
module HTTP2

lib/protocol/http2/continuation_frame.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require_relative 'frame'
6+
require_relative "frame"
77

88
module Protocol
99
module HTTP2

lib/protocol/http2/data_frame.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require_relative 'frame'
7-
require_relative 'padded'
6+
require_relative "frame"
7+
require_relative "padded"
88

99
module Protocol
1010
module HTTP2

lib/protocol/http2/error.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55

6-
require 'protocol/http/error'
6+
require "protocol/http/error"
77

88
module Protocol
99
module HTTP2

lib/protocol/http2/flow_controlled.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55
# Copyright, 2019, by Yuta Iwama.
66

7-
require_relative 'window_update_frame'
7+
require_relative "window_update_frame"
88

99
module Protocol
1010
module HTTP2

lib/protocol/http2/frame.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# frozen_string_literal: true
22

33
# Released under the MIT License.
4-
# Copyright, 2019-2023, by Samuel Williams.
4+
# Copyright, 2019-2024, by Samuel Williams.
55
# Copyright, 2019, by Yuta Iwama.
66

7-
require_relative 'error'
7+
require_relative "error"
88

99
module Protocol
1010
module HTTP2
@@ -106,7 +106,7 @@ def connection?
106106
@stream_id.zero?
107107
end
108108

109-
HEADER_FORMAT = 'CnCCN'.freeze
109+
HEADER_FORMAT = "CnCCN".freeze
110110
STREAM_ID_MASK = 0x7fffffff
111111

112112
# Generates common 9-byte frame header.

0 commit comments

Comments
 (0)