Skip to content

Commit

Permalink
Merge pull request #3 from bmedenwald/LIB-122/puma-5
Browse files Browse the repository at this point in the history
LIB-122: Version 1.0.0 (Allow for Puma 5.x)
  • Loading branch information
bmedenwald committed Apr 25, 2022
2 parents ff6f1bd + 95ae7e6 commit 76e1903
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 38 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tests
on: [pull_request]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [2.7.6, 3.0.4, 3.1.2]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
RAILS_ENV: test
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Install Code Climate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: Appraisal Install
run: bundle exec appraisal install

- name: Rubocop
run: bundle exec rubocop

- name: Rspec
run: bundle exec appraisal rspec

- name: Code Climate
run: ./cc-test-reporter after-build --exit-code $?
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
AllCops:
NewCops: enable
TargetRubyVersion: 2.7

Bundler/OrderedGems:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby-3.0.3
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

12 changes: 11 additions & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@ appraise "rails-5" do
end

appraise "rails-6" do
gem "rails", "~> 6.0"
gem "rails", "~> 6.0.0"
gem "puma", "~> 4.0"
end

appraise "rails-6-1" do
gem "rails", "~> 6.1.0"
gem "puma", "~> 5.0"
end

appraise "rails-7-0" do
gem "rails", "~> 7.0.0"
gem "puma", "~> 5.0"
end

appraise "latest" do
gem "rails"
gem "puma"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Puma Pool Usage

[![Build Status](https://travis-ci.org/simplymadeapps/puma-pool-usage.svg?branch=master)](https://travis-ci.org/simplymadeapps/puma-pool-usage)
![Tests](https://github.com/simplymadeapps/puma-pool-usage/actions/workflows/tests.yml/badge.svg)
[![Code Climate](https://codeclimate.com/github/simplymadeapps/puma-pool-usage/badges/gpa.svg)](https://codeclimate.com/github/simplymadeapps/puma-pool-usage)
[![Test Coverage](https://codeclimate.com/github/simplymadeapps/puma-pool-usage/badges/coverage.svg)](https://codeclimate.com/github/simplymadeapps/puma-pool-usage/coverage)

Expand Down Expand Up @@ -38,7 +38,7 @@ In your Puma configuration file (config/puma.rb), add the following line:
plugin :pool_usage
```

Restart your server and you're all set.
Restart your server and you're all set.

## Configuration

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails_6.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

gem "rails", "~> 6.0"
gem "rails", "~> 6.0.0"
gem "puma", "~> 4.0"

gemspec path: "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_6_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 6.1.0"
gem "puma", "~> 5.0"

gemspec path: "../"
8 changes: 8 additions & 0 deletions gemfiles/rails_7_0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "~> 7.0.0"
gem "puma", "~> 5.0"

gemspec path: "../"
9 changes: 6 additions & 3 deletions puma-pool-usage.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "puma-pool-usage"
spec.version = "0.1.0"
spec.version = "1.0.0"
spec.authors = ["Brandon Medenwald"]
spec.email = ["brandon@simplymadeapps.com"]

Expand All @@ -11,9 +11,12 @@ Gem::Specification.new do |spec|
spec.homepage = "https://www.github.com/simplymadeapps/puma-pool-usage"
spec.license = "MIT"

spec.required_ruby_version = ">= 2.7.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "https://www.github.com/simplymadeapps/puma-pool-usage/CHANGELOG.md"
spec.metadata["rubygems_mfa_required"] = "true"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
Expand All @@ -22,14 +25,14 @@ Gem::Specification.new do |spec|
end
spec.require_paths = ["lib"]

spec.add_runtime_dependency "puma", ">= 3.12", "< 5.0"
spec.add_runtime_dependency "puma", ">= 3.12", "< 6.0"
spec.add_runtime_dependency "rails", ">= 5.0"

spec.add_development_dependency "appraisal"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rubocop", "~> 0.83.0"
spec.add_development_dependency "rubocop", "~> 1.28"
spec.add_development_dependency "simplecov", "< 0.18" # https://github.com/codeclimate/test-reporter/issues/413
spec.add_development_dependency "simplecov-rcov"
end
9 changes: 7 additions & 2 deletions spec/puma/plugin/pool_usage_spec.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# frozen_string_literal: true

RSpec.describe "Puma Pool Usage" do
subject { Puma::Plugins.find("pool_usage").new(Puma::Plugin) }
subject do
# starting in Puma 5.x, the new method no longer takes any arguments
Puma::Plugins.find("pool_usage").new
rescue ArgumentError
Puma::Plugins.find("pool_usage").new(Puma::Plugin)
end

before do
Rails.logger = Logger.new(STDOUT)
Rails.logger = Logger.new($stdout)
end

describe "Registration" do
Expand Down

0 comments on commit 76e1903

Please sign in to comment.