Skip to content

Commit 6b7ae68

Browse files
committed
Modernize gem.
1 parent 43940ca commit 6b7ae68

Some content is hidden

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

91 files changed

+549
-543
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ jobs:
3636

3737
- 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

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ Layout/EmptyLinesAroundModuleBody:
4747

4848
Style/FrozenStringLiteralComment:
4949
Enabled: true
50+
51+
Style/StringLiterals:
52+
Enabled: true
53+
EnforcedStyle: double_quotes

async-http.gemspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
1010
spec.authors = ["Samuel Williams", "Brian Morearty", "Bruno Sutic", "Janko Marohnić", "Thomas Morgan", "Adam Daniels", "Igor Sidorov", "Anton Zhuravsky", "Cyril Roelandt", "Denis Talakevich", "Hal Brodigan", "Ian Ker-Seymer", "Josh Huber", "Marco Concetto Rudilosso", "Olle Jonsson", "Orgad Shaneh", "Sam Shadwell", "Stefan Wrobel", "Tim Meusel", "Trevor Turk", "Viacheslav Koval", "dependabot[bot]"]
1111
spec.license = "MIT"
1212

13-
spec.cert_chain = ['release.cert']
14-
spec.signing_key = File.expand_path('~/.gem/release.pem')
13+
spec.cert_chain = ["release.cert"]
14+
spec.signing_key = File.expand_path("~/.gem/release.pem")
1515

1616
spec.homepage = "https://github.com/socketry/async-http"
1717

@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020
"source_code_uri" => "https://github.com/socketry/async-http.git",
2121
}
2222

23-
spec.files = Dir.glob(['{bake,lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
23+
spec.files = Dir.glob(["{bake,lib}/**/*", "*.md"], File::FNM_DOTMATCH, base: __dir__)
2424

2525
spec.required_ruby_version = ">= 3.1"
2626

bake.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
#
88
# @parameter version [String] The new version number.
99
def after_gem_release_version_increment(version)
10-
context['releases:update'].call(version)
11-
context['utopia:project:readme:update'].call
10+
context["releases:update"].call(version)
11+
context["utopia:project:readme:update"].call
1212
end

bake/async/http.rb

Lines changed: 3 additions & 3 deletions
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, 2020-2023, by Samuel Williams.
4+
# Copyright, 2020-2024, by Samuel Williams.
55

66
# Fetch the specified URL and print the response.
77
# @param url [String] the URL to parse and fetch.
88
# @param method [String] the HTTP method to use.
99
def fetch(url, method:)
10-
require 'async/http/internet'
11-
require 'kernel/sync'
10+
require "async/http/internet"
11+
require "kernel/sync"
1212

1313
terminal = Console::Terminal.for($stdout)
1414
terminal[:request] = terminal.style(:blue, nil, :bold)

bake/async/http/h2spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ def test
2121
private
2222

2323
def server
24-
require 'async'
25-
require 'async/container'
26-
require 'async/http/server'
27-
require 'io/endpoint/host_endpoint'
24+
require "async"
25+
require "async/container"
26+
require "async/http/server"
27+
require "io/endpoint/host_endpoint"
2828

29-
endpoint = IO::Endpoint.tcp('127.0.0.1', 7272)
29+
endpoint = IO::Endpoint.tcp("127.0.0.1", 7272)
3030

3131
container = Async::Container.new
3232

3333
Console.logger.info(self){"Starting server..."}
3434

3535
container.run(count: 1) do
3636
server = Async::HTTP::Server.for(endpoint, protocol: Async::HTTP::Protocol::HTTP2, scheme: "https") do |request|
37-
Protocol::HTTP::Response[200, {'content-type' => 'text/plain'}, ["Hello World"]]
37+
Protocol::HTTP::Response[200, {"content-type" => "text/plain"}, ["Hello World"]]
3838
end
3939

4040
Async do

config/sus.rb

Lines changed: 5 additions & 5 deletions
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, 2017-2023, by Samuel Williams.
4+
# Copyright, 2017-2024, by Samuel Williams.
55
# Copyright, 2018, by Janko Marohnić.
66

7-
ENV['CONSOLE_LEVEL'] ||= 'fatal'
7+
ENV["CONSOLE_LEVEL"] ||= "fatal"
88

9-
require 'covered/sus'
9+
require "covered/sus"
1010
include Covered::Sus
1111

12-
require 'traces'
13-
ENV['TRACES_BACKEND'] ||= 'traces/backend/test'
12+
require "traces"
13+
ENV["TRACES_BACKEND"] ||= "traces/backend/test"

examples/compare/benchmark.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
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 'benchmark'
7+
require "benchmark"
88

9-
require 'httpx'
9+
require "httpx"
1010

11-
require 'async'
12-
require 'async/barrier'
13-
require 'async/semaphore'
14-
require 'async/http/internet'
11+
require "async"
12+
require "async/barrier"
13+
require "async/semaphore"
14+
require "async/http/internet"
1515

1616
URL = "https://www.codeotaku.com/index"
1717
REPEATS = 10

examples/download/chunked.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
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 'async'
8-
require 'async/clock'
9-
require 'async/barrier'
10-
require 'async/semaphore'
11-
require_relative '../../lib/async/http/endpoint'
12-
require_relative '../../lib/async/http/client'
7+
require "async"
8+
require "async/clock"
9+
require "async/barrier"
10+
require "async/semaphore"
11+
require_relative "../../lib/async/http/endpoint"
12+
require_relative "../../lib/async/http/client"
1313

1414
Async do
1515
url = "https://static.openfoodfacts.org/data/en.openfoodfacts.org.products.csv"
1616

1717
endpoint = Async::HTTP::Endpoint.parse(url)
1818
client = Async::HTTP::Client.new(endpoint)
1919

20-
headers = {'user-agent' => 'curl/7.69.1', 'accept' => '*/*'}
20+
headers = {"user-agent" => "curl/7.69.1", "accept" => "*/*"}
2121

2222
file = File.open("products.csv", "w")
2323
Console.logger.info(self) {"Saving download to #{Dir.pwd}"}
@@ -27,7 +27,7 @@
2727
content_length = nil
2828

2929
if response.success?
30-
unless response.headers['accept-ranges'].include?('bytes')
30+
unless response.headers["accept-ranges"].include?("bytes")
3131
raise "Does not advertise support for accept-ranges: bytes!"
3232
end
3333

examples/fetch/config.ru

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'rack'
3+
require "rack"
44

55
class Echo
66
def initialize(app)
@@ -24,6 +24,6 @@ end
2424

2525
use Echo
2626

27-
use Rack::Static, :urls => [''], :root => 'public', :index => 'index.html'
27+
use Rack::Static, :urls => [""], :root => "public", :index => "index.html"
2828

2929
run lambda{|env| [404, {}, []]}

0 commit comments

Comments
 (0)