|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
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" |
6 | 4 |
|
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"] |
10 | 10 |
|
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+/, " ") |
12 | 16 | An easy-to-use client library for making requests from Ruby. |
13 | 17 | It uses a simple method chaining system for building requests, |
14 | 18 | similar to Python's Requests. |
15 | 19 | DESCRIPTION |
16 | 20 |
|
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__) |
20 | 29 |
|
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 |
27 | 34 |
|
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"] |
29 | 39 |
|
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" |
33 | 45 |
|
34 | 46 | # Use native llhttp for MRI (more performant) and llhttp-ffi for other interpreters (better compatibility) |
35 | 47 | if RUBY_ENGINE == "ruby" |
36 | | - gem.add_dependency "llhttp", "~> 0.6.1" |
| 48 | + spec.add_dependency "llhttp", "~> 0.6.1" |
37 | 49 | else |
38 | | - gem.add_dependency "llhttp-ffi", "~> 0.5.1" |
| 50 | + spec.add_dependency "llhttp-ffi", "~> 0.5.1" |
39 | 51 | 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 | | - } |
48 | 52 | end |
0 commit comments