From dd0567dea6cc2100bdbb418901e5afd5bcc6b9af Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Wed, 7 Feb 2024 23:47:28 +1300 Subject: [PATCH] Modernize gem. --- .editorconfig | 9 +++ .github/workflows/coverage.yaml | 10 ++-- .github/workflows/documentation.yaml | 58 +++++++++++++++++++ .github/workflows/test-external.yaml | 2 +- .github/workflows/test.yaml | 4 +- .gitignore | 4 +- .rspec | 2 +- gems.rb | 9 ++- lib/composite_io.rb | 2 +- lib/multipart/post.rb | 2 +- lib/multipart/post/composite_read_io.rb | 2 +- lib/multipart/post/multipartable.rb | 2 +- lib/multipart/post/parts.rb | 2 +- lib/multipart/post/upload_io.rb | 2 +- lib/multipart_post.rb | 2 +- lib/multipartable.rb | 2 +- lib/net/http/post/multipart.rb | 2 +- lib/parts.rb | 2 +- license.md | 3 +- multipart-post.gemspec | 8 +-- spec/multipart/post/composite_read_io_spec.rb | 7 ++- spec/multipart/post/parts_spec.rb | 2 +- spec/net/http/post/multipart_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 24 files changed, 109 insertions(+), 33 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/documentation.yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a6e7d26 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 81f3c65..68adbf2 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -21,10 +21,10 @@ jobs: - macos ruby: - - "3.2" + - "3.3" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby}} @@ -34,7 +34,7 @@ jobs: timeout-minutes: 5 run: bundle exec bake test - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: coverage-${{matrix.os}}-${{matrix.ruby}} path: .covered.db @@ -44,10 +44,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.2" + ruby-version: "3.3" bundler-cache: true - uses: actions/download-artifact@v3 diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml new file mode 100644 index 0000000..8dc5227 --- /dev/null +++ b/.github/workflows/documentation.yaml @@ -0,0 +1,58 @@ +name: Documentation + +on: + push: + branches: + - main + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages: +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment: +concurrency: + group: "pages" + cancel-in-progress: true + +env: + CONSOLE_OUTPUT: XTerm + BUNDLE_WITH: maintenance + +jobs: + generate: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3" + bundler-cache: true + + - name: Installing packages + run: sudo apt-get install wget + + - name: Generate documentation + timeout-minutes: 5 + run: bundle exec bake utopia:project:static --force no + + - name: Upload documentation artifact + uses: actions/upload-pages-artifact@v2 + with: + path: docs + + deploy: + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{steps.deployment.outputs.page_url}} + + needs: generate + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v3 diff --git a/.github/workflows/test-external.yaml b/.github/workflows/test-external.yaml index 2a45dc1..18efa2c 100644 --- a/.github/workflows/test-external.yaml +++ b/.github/workflows/test-external.yaml @@ -26,7 +26,7 @@ jobs: - "3.3" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby}} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 00c6531..973f5b9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -43,7 +43,7 @@ jobs: experimental: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby}} @@ -51,4 +51,4 @@ jobs: - name: Run tests timeout-minutes: 10 - run: bundle exec rspec + run: bundle exec bake test diff --git a/.gitignore b/.gitignore index 66f7fe4..09a72e0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -/pkg +/.bundle/ +/pkg/ /gems.locked -/.rspec_status /.covered.db /external diff --git a/.rspec b/.rspec index 744a412..c16a0e6 100644 --- a/.rspec +++ b/.rspec @@ -2,4 +2,4 @@ --format documentation --backtrace --require spec_helper ---warnings +--warnings \ No newline at end of file diff --git a/gems.rb b/gems.rb index 2239cf2..5fa1a8d 100644 --- a/gems.rb +++ b/gems.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2022, by Samuel Williams. +# Copyright, 2010, by Tohru Hashimoto. +# Copyright, 2011-2013, by Nick Sieger. +# Copyright, 2017-2024, by Samuel Williams. source "https://rubygems.org" @@ -13,10 +15,15 @@ group :maintenance, optional: true do gem "bake-gem" gem "bake-modernize" + + gem "utopia-project" end end group :test do + gem "covered" + gem "rspec", "~> 3.4" + gem "bake-test" gem "bake-test-external" end diff --git a/lib/composite_io.rb b/lib/composite_io.rb index c0748a4..94c986d 100644 --- a/lib/composite_io.rb +++ b/lib/composite_io.rb @@ -11,7 +11,7 @@ # Copyright, 2013, by Mislav Marohnić. # Copyright, 2013, by Leo Cassarani. # Copyright, 2019, by Olle Jonsson. -# Copyright, 2022, by Samuel Williams. +# Copyright, 2022-2024, by Samuel Williams. warn "Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!" require_relative 'multipart/post' diff --git a/lib/multipart/post.rb b/lib/multipart/post.rb index 29ab41a..16f8f4b 100644 --- a/lib/multipart/post.rb +++ b/lib/multipart/post.rb @@ -2,7 +2,7 @@ # Released under the MIT License. # Copyright, 2019, by Patrick Davey. -# Copyright, 2021-2022, by Samuel Williams. +# Copyright, 2021-2024, by Samuel Williams. require_relative 'post/multipartable' require_relative 'post/upload_io' diff --git a/lib/multipart/post/composite_read_io.rb b/lib/multipart/post/composite_read_io.rb index 6773e39..41296c2 100644 --- a/lib/multipart/post/composite_read_io.rb +++ b/lib/multipart/post/composite_read_io.rb @@ -13,7 +13,7 @@ # Copyright, 2019, by Olle Jonsson. # Copyright, 2019, by Patrick Davey. # Copyright, 2021, by Lewis Cowles. -# Copyright, 2021-2022, by Samuel Williams. +# Copyright, 2021-2024, by Samuel Williams. module Multipart module Post diff --git a/lib/multipart/post/multipartable.rb b/lib/multipart/post/multipartable.rb index 11d0428..f9c1d59 100644 --- a/lib/multipart/post/multipartable.rb +++ b/lib/multipart/post/multipartable.rb @@ -9,7 +9,7 @@ # Copyright, 2013, by Socrates Vicente. # Copyright, 2013, by Steffen Grunwald. # Copyright, 2019, by Olle Jonsson. -# Copyright, 2019-2022, by Samuel Williams. +# Copyright, 2019-2024, by Samuel Williams. # Copyright, 2019, by Patrick Davey. # Copyright, 2022, by Jason York. diff --git a/lib/multipart/post/parts.rb b/lib/multipart/post/parts.rb index 14ab5aa..059143a 100644 --- a/lib/multipart/post/parts.rb +++ b/lib/multipart/post/parts.rb @@ -17,7 +17,7 @@ # Copyright, 2019-2021, by Olle Jonsson. # Copyright, 2019, by Ethan Turkeltaub. # Copyright, 2019, by Patrick Davey. -# Copyright, 2021-2022, by Samuel Williams. +# Copyright, 2021-2024, by Samuel Williams. require 'stringio' diff --git a/lib/multipart/post/upload_io.rb b/lib/multipart/post/upload_io.rb index 6381744..181374d 100644 --- a/lib/multipart/post/upload_io.rb +++ b/lib/multipart/post/upload_io.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2022, by Samuel Williams. +# Copyright, 2022-2024, by Samuel Williams. module Multipart module Post diff --git a/lib/multipart_post.rb b/lib/multipart_post.rb index 2913ab2..bcbaebc 100644 --- a/lib/multipart_post.rb +++ b/lib/multipart_post.rb @@ -2,7 +2,7 @@ # Released under the MIT License. # Copyright, 2009-2013, by Nick Sieger. -# Copyright, 2019-2022, by Samuel Williams. +# Copyright, 2019-2024, by Samuel Williams. warn "Top level ::MultipartPost is deprecated, require 'multipart/post' and use `Multipart::Post` instead!" require_relative 'multipart/post' diff --git a/lib/multipartable.rb b/lib/multipartable.rb index aa5978a..89f40fe 100644 --- a/lib/multipartable.rb +++ b/lib/multipartable.rb @@ -9,7 +9,7 @@ # Copyright, 2013, by Socrates Vicente. # Copyright, 2013, by Steffen Grunwald. # Copyright, 2019, by Olle Jonsson. -# Copyright, 2019-2022, by Samuel Williams. +# Copyright, 2019-2024, by Samuel Williams. # Copyright, 2019, by Patrick Davey. warn "Top level ::Multipartable is deprecated, require 'multipart/post' and use `Multipart::Post::Multipartable` instead!" diff --git a/lib/net/http/post/multipart.rb b/lib/net/http/post/multipart.rb index 5a201d2..b7deff8 100644 --- a/lib/net/http/post/multipart.rb +++ b/lib/net/http/post/multipart.rb @@ -5,7 +5,7 @@ # Copyright, 2008, by McClain Looney. # Copyright, 2019, by Olle Jonsson. # Copyright, 2019, by Patrick Davey. -# Copyright, 2021-2022, by Samuel Williams. +# Copyright, 2021-2024, by Samuel Williams. require 'net/http' diff --git a/lib/parts.rb b/lib/parts.rb index c9a52d2..70672bd 100644 --- a/lib/parts.rb +++ b/lib/parts.rb @@ -16,7 +16,7 @@ # Copyright, 2017, by Eric Hutzelman. # Copyright, 2019, by Olle Jonsson. # Copyright, 2019, by Ethan Turkeltaub. -# Copyright, 2022, by Samuel Williams. +# Copyright, 2022-2024, by Samuel Williams. warn "Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!" require_relative 'multipart/post' diff --git a/license.md b/license.md index 1e1a413..e670a9f 100644 --- a/license.md +++ b/license.md @@ -21,7 +21,7 @@ Copyright, 2013, by Leo Cassarani. Copyright, 2013, by Jagtesh Chadha. Copyright, 2013, by Steffen Grunwald. Copyright, 2013, by Lonre Wang. -Copyright, 2017-2023, by Samuel Williams. +Copyright, 2017-2024, by Samuel Williams. Copyright, 2017, by Feuda Nan. Copyright, 2017, by David Moles. Copyright, 2017, by Matt Colyer. @@ -37,6 +37,7 @@ Copyright, 2021, by Lewis Cowles. Copyright, 2022, by Jason York. Copyright, 2022, by Takuya Noguchi. Copyright, 2023, by Peter Goldstein. +Copyright, 2024, by Masato Nakamura. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/multipart-post.gemspec b/multipart-post.gemspec index 0e44415..6138991 100644 --- a/multipart-post.gemspec +++ b/multipart-post.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |spec| spec.version = Multipart::Post::VERSION spec.summary = "A multipart form post accessory for Net::HTTP." - spec.authors = ["Nick Sieger", "Samuel Williams", "Olle Jonsson", "McClain Looney", "Lewis Cowles", "Gustav Ernberg", "Patrick Davey", "Steven Davidovitz", "Alex Koppel", "Ethan Turkeltaub", "Jagtesh Chadha", "Jason York", "Tohru Hashimoto", "Vincent Pellé", "hexfet", "Christine Yen", "David Moles", "Eric Hutzelman", "Feuda Nan", "Gerrit Riessen", "Jan Piotrowski", "Jan-Joost Spanjers", "Jason Moore", "Jeff Hodges", "Johannes Wagener", "Jordi Massaguer Pla", "Lachlan Priest", "Leo Cassarani", "Lonre Wang", "Luke Redpath", "Matt Colyer", "Mislav Marohnić", "Peter Goldstein", "Socrates Vicente", "Steffen Grunwald", "Takuya Noguchi", "Tim Barkley"] + spec.authors = ["Nick Sieger", "Samuel Williams", "Olle Jonsson", "McClain Looney", "Lewis Cowles", "Gustav Ernberg", "Patrick Davey", "Steven Davidovitz", "Alex Koppel", "Ethan Turkeltaub", "Jagtesh Chadha", "Jason York", "Tohru Hashimoto", "Vincent Pellé", "hexfet", "Christine Yen", "David Moles", "Eric Hutzelman", "Feuda Nan", "Gerrit Riessen", "Jan Piotrowski", "Jan-Joost Spanjers", "Jason Moore", "Jeff Hodges", "Johannes Wagener", "Jordi Massaguer Pla", "Lachlan Priest", "Leo Cassarani", "Lonre Wang", "Luke Redpath", "Masato Nakamura", "Matt Colyer", "Mislav Marohnić", "Peter Goldstein", "Socrates Vicente", "Steffen Grunwald", "Takuya Noguchi", "Tim Barkley"] spec.license = "MIT" spec.cert_chain = ['release.cert'] @@ -15,11 +15,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://github.com/socketry/multipart-post" - spec.files = Dir['{lib}/**/*', '*.md'] + spec.files = Dir['{lib}/**/*', '*.md', base: __dir__] spec.required_ruby_version = ">= 2.5.0" - - spec.add_development_dependency "bundler" - spec.add_development_dependency "rspec", "~> 3.4" - spec.add_development_dependency "covered" end diff --git a/spec/multipart/post/composite_read_io_spec.rb b/spec/multipart/post/composite_read_io_spec.rb index 4cfd237..dc6470c 100644 --- a/spec/multipart/post/composite_read_io_spec.rb +++ b/spec/multipart/post/composite_read_io_spec.rb @@ -1,7 +1,12 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2017-2021, by Samuel Williams. +# Copyright, 2006-2013, by Nick Sieger. +# Copyright, 2010, by Tohru Hashimoto. +# Copyright, 2011, by Alex Koppel. +# Copyright, 2011, by Luke Redpath. +# Copyright, 2013, by Mislav Marohnić. +# Copyright, 2017-2024, by Samuel Williams. # Copyright, 2019, by Patrick Davey. # Copyright, 2021, by Lewis Cowles. diff --git a/spec/multipart/post/parts_spec.rb b/spec/multipart/post/parts_spec.rb index bbd076f..e5dcaac 100644 --- a/spec/multipart/post/parts_spec.rb +++ b/spec/multipart/post/parts_spec.rb @@ -5,7 +5,7 @@ # Copyright, 2011-2013, by Nick Sieger. # Copyright, 2012, by Steven Davidovitz. # Copyright, 2012, by hexfet. -# Copyright, 2017-2022, by Samuel Williams. +# Copyright, 2017-2024, by Samuel Williams. # Copyright, 2017, by Eric Hutzelman. # Copyright, 2019, by Ethan Turkeltaub. # Copyright, 2019, by Patrick Davey. diff --git a/spec/net/http/post/multipart_spec.rb b/spec/net/http/post/multipart_spec.rb index e310763..4f22b3d 100644 --- a/spec/net/http/post/multipart_spec.rb +++ b/spec/net/http/post/multipart_spec.rb @@ -8,7 +8,7 @@ # Copyright, 2013, by Gustav Ernberg. # Copyright, 2013, by Socrates Vicente. # Copyright, 2013, by Steffen Grunwald. -# Copyright, 2017-2021, by Samuel Williams. +# Copyright, 2017-2024, by Samuel Williams. # Copyright, 2019, by Patrick Davey. # Copyright, 2022, by Jason York. diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 78a7e55..3b080f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # Released under the MIT License. -# Copyright, 2017-2022, by Samuel Williams. +# Copyright, 2017-2024, by Samuel Williams. # Copyright, 2019, by Patrick Davey. require "bundler/setup"