Skip to content

Commit 954225f

Browse files
authored
chore: Cleanup and update gemspec (#806)
1 parent 07f1cf8 commit 954225f

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

http.gemspec

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,52 @@
11
# frozen_string_literal: true
22

3-
lib = File.expand_path("lib", __dir__)
4-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5-
require "http/version"
3+
require_relative "./lib/http/version"
64

7-
Gem::Specification.new do |gem|
8-
gem.authors = ["Tony Arcieri", "Erik Michaels-Ober", "Alexey V. Zapparov", "Zachary Anker"]
9-
gem.email = ["bascule@gmail.com"]
5+
Gem::Specification.new do |spec|
6+
spec.name = "http"
7+
spec.version = HTTP::VERSION
8+
spec.authors = ["Tony Arcieri", "Erik Michaels-Ober", "Alexey V. Zapparov", "Zachary Anker"]
9+
spec.email = ["bascule@gmail.com"]
1010

11-
gem.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
11+
spec.summary = "HTTP should be easy"
12+
spec.homepage = "https://github.com/httprb/http"
13+
spec.license = "MIT"
14+
15+
spec.description = <<~DESCRIPTION.strip.gsub(/\s+/, " ")
1216
An easy-to-use client library for making requests from Ruby.
1317
It uses a simple method chaining system for building requests,
1418
similar to Python's Requests.
1519
DESCRIPTION
1620

17-
gem.summary = "HTTP should be easy"
18-
gem.homepage = "https://github.com/httprb/http"
19-
gem.licenses = ["MIT"]
21+
spec.metadata["homepage_uri"] = spec.homepage
22+
spec.metadata["source_code_uri"] = "#{spec.homepage}/tree/v#{spec.version}"
23+
spec.metadata["bug_tracker_uri"] = "#{spec.homepage}/issues"
24+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
25+
spec.metadata["rubygems_mfa_required"] = "true"
26+
27+
spec.files = IO.popen(%w[git ls-files -z], chdir: __dir__, err: IO::NULL) do |ls|
28+
extras = %w[CHANGELOG.md LICENSE.txt README.md SECURITY.md] << File.basename(__FILE__)
2029

21-
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
22-
gem.files = `git ls-files`.split("\n")
23-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24-
gem.name = "http"
25-
gem.require_paths = ["lib"]
26-
gem.version = HTTP::VERSION
30+
ls.readlines("\x0", chomp: true).select do |f|
31+
f.start_with?("lib/", "spec/") || extras.include?(f)
32+
end
33+
end
2734

28-
gem.required_ruby_version = ">= 3.0"
35+
spec.bindir = "exe"
36+
spec.executables = spec.files.filter_map { |f| File.basename(f) if f.start_with?("exe/") }
37+
spec.test_files = spec.files.select { |f| f.start_with?("spec/") }
38+
spec.require_paths = ["lib"]
2939

30-
gem.add_dependency "addressable", "~> 2.8"
31-
gem.add_dependency "http-cookie", "~> 1.0"
32-
gem.add_dependency "http-form_data", "~> 2.2"
40+
spec.required_ruby_version = ">= 3.0"
41+
42+
spec.add_dependency "addressable", "~> 2.8"
43+
spec.add_dependency "http-cookie", "~> 1.0"
44+
spec.add_dependency "http-form_data", "~> 2.2"
3345

3446
# Use native llhttp for MRI (more performant) and llhttp-ffi for other interpreters (better compatibility)
3547
if RUBY_ENGINE == "ruby"
36-
gem.add_dependency "llhttp", "~> 0.6.1"
48+
spec.add_dependency "llhttp", "~> 0.6.1"
3749
else
38-
gem.add_dependency "llhttp-ffi", "~> 0.5.1"
50+
spec.add_dependency "llhttp-ffi", "~> 0.5.1"
3951
end
40-
41-
gem.metadata = {
42-
"source_code_uri" => "https://github.com/httprb/http",
43-
"wiki_uri" => "https://github.com/httprb/http/wiki",
44-
"bug_tracker_uri" => "https://github.com/httprb/http/issues",
45-
"changelog_uri" => "https://github.com/httprb/http/blob/v#{HTTP::VERSION}/CHANGELOG.md",
46-
"rubygems_mfa_required" => "true"
47-
}
4852
end

0 commit comments

Comments
 (0)