From 9020201ff5be02046c50203959b51b4a3305a374 Mon Sep 17 00:00:00 2001 From: fukayatsu Date: Tue, 15 Dec 2020 23:20:58 +0900 Subject: [PATCH 1/5] Fix Ruby 2.7 kwargs warning in RedisCacheStoreProxy --- lib/rack/attack/store_proxy/redis_cache_store_proxy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb b/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb index 80412593..00670f06 100644 --- a/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb +++ b/lib/rack/attack/store_proxy/redis_cache_store_proxy.rb @@ -10,7 +10,7 @@ def self.handle?(store) store.class.name == "ActiveSupport::Cache::RedisCacheStore" end - def increment(name, amount = 1, options = {}) + def increment(name, amount = 1, **options) # RedisCacheStore#increment ignores options[:expires_in]. # # So in order to workaround this we use RedisCacheStore#write (which sets expiration) to initialize From 7b3376021b47e2a9bfe20a1e792c9b6e28a6dbcf Mon Sep 17 00:00:00 2001 From: Joe Van Dyk Date: Thu, 24 Dec 2020 12:58:47 -0800 Subject: [PATCH 2/5] Fix speling in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b33c64a3..4c977dd7 100644 --- a/README.md +++ b/README.md @@ -374,7 +374,7 @@ Rack::Attack uses the [ActiveSupport::Notifications](http://api.rubyonrails.org/ You can subscribe to `rack_attack` events and log it, graph it, etc. -To get notified about specific type of events, subscribe to the event name followed by the `rack_attack` namesapce. +To get notified about specific type of events, subscribe to the event name followed by the `rack_attack` namespace. E.g. for throttles use: ```ruby From cbae022df107b58997ac11f15a442a1631811b39 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Fri, 25 Dec 2020 23:47:14 -0300 Subject: [PATCH 3/5] build: update rubocop to earlier version fixing the LineLength crash --- .rubocop.yml | 1 + rack-attack.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 45bd079c..745bb907 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -8,6 +8,7 @@ inherit_mode: AllCops: TargetRubyVersion: 2.4 DisabledByDefault: true + NewCops: disable Exclude: - "examples/instrumentation.rb" - "gemfiles/**/*" diff --git a/rack-attack.gemspec b/rack-attack.gemspec index 69042f1e..e1c12a08 100644 --- a/rack-attack.gemspec +++ b/rack-attack.gemspec @@ -37,7 +37,7 @@ Gem::Specification.new do |s| s.add_development_dependency "minitest-stub-const", "~> 0.6" s.add_development_dependency 'rack-test', "~> 1.0" s.add_development_dependency 'rake', "~> 13.0" - s.add_development_dependency "rubocop", "0.84.0" + s.add_development_dependency "rubocop", "0.89.1" s.add_development_dependency "rubocop-performance", "~> 1.5.0" s.add_development_dependency "timecop", "~> 0.9.1" From 26476670f40239ff51bb3ab1843e7b71a4255fd4 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Fri, 25 Dec 2020 23:51:59 -0300 Subject: [PATCH 4/5] docs: update repo references after move to rack org --- CHANGELOG.md | 92 +++++++++++++++++----------------- CONTRIBUTING.md | 8 +-- README.md | 4 +- docs/advanced_configuration.md | 12 ++--- rack-attack.gemspec | 8 +-- 5 files changed, 62 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d44d1e0d..a7940ac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -96,9 +96,9 @@ All notable changes to this project will be documented in this file. ### Added -- Support "plain" `Redis` as a cache store backend ([#280](https://github.com/kickstarter/rack-attack/pull/280)). Thanks @bfad and @ryandv. +- Support "plain" `Redis` as a cache store backend ([#280](https://github.com/rack/rack-attack/pull/280)). Thanks @bfad and @ryandv. - When overwriting `Rack::Attack.throttled_response` you can now access the exact epoch integer that was used for caching -so your custom code is less prone to race conditions ([#282](https://github.com/kickstarter/rack-attack/pull/282)). Thanks @doliveirakn. +so your custom code is less prone to race conditions ([#282](https://github.com/rack/rack-attack/pull/282)). Thanks @doliveirakn. ### Dependency changes @@ -120,43 +120,43 @@ so your custom code is less prone to race conditions ([#282](https://github.com/ ### Added -- Add support for [`ActiveSupport::Cache::RedisCacheStore`](http://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html) as a store backend ([#340](https://github.com/kickstarter/rack-attack/pull/340) and [#350](https://github.com/kickstarter/rack-attack/pull/350)) +- Add support for [`ActiveSupport::Cache::RedisCacheStore`](http://api.rubyonrails.org/classes/ActiveSupport/Cache/RedisCacheStore.html) as a store backend ([#340](https://github.com/rack/rack-attack/pull/340) and [#350](https://github.com/rack/rack-attack/pull/350)) ## [5.2.0] - 2018-03-29 ### Added -- Shorthand for blocking an IP address `Rack::Attack.blocklist_ip("1.2.3.4")` ([#320](https://github.com/kickstarter/rack-attack/pull/320)) -- Shorthand for blocking an IP subnet `Rack::Attack.blocklist_ip("1.2.0.0/16")` ([#320](https://github.com/kickstarter/rack-attack/pull/320)) -- Shorthand for safelisting an IP address `Rack::Attack.safelist_ip("5.6.7.8")` ([#320](https://github.com/kickstarter/rack-attack/pull/320)) -- Shorthand for safelisting an IP subnet `Rack::Attack.safelist_ip("5.6.0.0/16")` ([#320](https://github.com/kickstarter/rack-attack/pull/320)) -- Throw helpful error message when using `allow2ban` but cache store is misconfigured ([#315](https://github.com/kickstarter/rack-attack/issues/315)) -- Throw helpful error message when using `fail2ban` but cache store is misconfigured ([#315](https://github.com/kickstarter/rack-attack/issues/315)) +- Shorthand for blocking an IP address `Rack::Attack.blocklist_ip("1.2.3.4")` ([#320](https://github.com/rack/rack-attack/pull/320)) +- Shorthand for blocking an IP subnet `Rack::Attack.blocklist_ip("1.2.0.0/16")` ([#320](https://github.com/rack/rack-attack/pull/320)) +- Shorthand for safelisting an IP address `Rack::Attack.safelist_ip("5.6.7.8")` ([#320](https://github.com/rack/rack-attack/pull/320)) +- Shorthand for safelisting an IP subnet `Rack::Attack.safelist_ip("5.6.0.0/16")` ([#320](https://github.com/rack/rack-attack/pull/320)) +- Throw helpful error message when using `allow2ban` but cache store is misconfigured ([#315](https://github.com/rack/rack-attack/issues/315)) +- Throw helpful error message when using `fail2ban` but cache store is misconfigured ([#315](https://github.com/rack/rack-attack/issues/315)) ## [5.1.0] - 2018-03-10 - - Fixes edge case bug when using ruby 2.5.0 and redis [#253](https://github.com/kickstarter/rack-attack/issues/253) ([#271](https://github.com/kickstarter/rack-attack/issues/271)) - - Throws errors with better semantics when missing or misconfigured store caches to aid in developers debugging their configs ([#274](https://github.com/kickstarter/rack-attack/issues/274)) - - Removed legacy code that was originally intended for Rails 3 apps ([#264](https://github.com/kickstarter/rack-attack/issues/264)) + - Fixes edge case bug when using ruby 2.5.0 and redis [#253](https://github.com/rack/rack-attack/issues/253) ([#271](https://github.com/rack/rack-attack/issues/271)) + - Throws errors with better semantics when missing or misconfigured store caches to aid in developers debugging their configs ([#274](https://github.com/rack/rack-attack/issues/274)) + - Removed legacy code that was originally intended for Rails 3 apps ([#264](https://github.com/rack/rack-attack/issues/264)) ## [5.0.1] - 2016-08-11 - - Fixes arguments passed to deprecated internal methods. ([#198](https://github.com/kickstarter/rack-attack/issues/198)) + - Fixes arguments passed to deprecated internal methods. ([#198](https://github.com/rack/rack-attack/issues/198)) ## [5.0.0] - 2016-08-09 - - Deprecate `whitelist`/`blacklist` in favor of `safelist`/`blocklist`. ([#181](https://github.com/kickstarter/rack-attack/issues/181), + - Deprecate `whitelist`/`blacklist` in favor of `safelist`/`blocklist`. ([#181](https://github.com/rack/rack-attack/issues/181), thanks @renee-travisci). To upgrade and fix deprecations, find and replace instances of `whitelist` and `blacklist` with `safelist` and `blocklist`. If you reference `rack.attack.match_type`, note that it will have values like `:safelist`/`:blocklist`. - Remove test coverage for unsupported ruby dependencies: ruby 2.0, activesupport 3.2/4.0, and dalli 1. ## [4.4.1] - 2016-02-17 - Fix a bug affecting apps using Redis::Store and ActiveSupport that could generate an error - saying dalli was a required dependency. I learned all about ActiveSupport autoloading. ([#165](https://github.com/kickstarter/rack-attack/issues/165)) + saying dalli was a required dependency. I learned all about ActiveSupport autoloading. ([#165](https://github.com/rack/rack-attack/issues/165)) ## [4.4.0] - 2016-02-10 - - New: support for MemCacheStore ([#153](https://github.com/kickstarter/rack-attack/issues/153)). Thanks @elhu. + - New: support for MemCacheStore ([#153](https://github.com/rack/rack-attack/issues/153)). Thanks @elhu. - Some documentation and test harness improvements. ## [4.3.1] - 2015-12-18 @@ -222,36 +222,36 @@ so your custom code is less prone to race conditions ([#282](https://github.com/ - Remove unused variable - Extract mandatory options to constants -[6.3.1]: https://github.com/kickstarter/rack-attack/compare/v6.3.0...v6.3.1/ -[6.3.0]: https://github.com/kickstarter/rack-attack/compare/v6.2.2...v6.3.0/ -[6.2.2]: https://github.com/kickstarter/rack-attack/compare/v6.2.1...v6.2.2/ -[6.2.1]: https://github.com/kickstarter/rack-attack/compare/v6.2.0...v6.2.1/ -[6.2.0]: https://github.com/kickstarter/rack-attack/compare/v6.1.0...v6.2.0/ -[6.1.0]: https://github.com/kickstarter/rack-attack/compare/v6.0.0...v6.1.0/ -[6.0.0]: https://github.com/kickstarter/rack-attack/compare/v5.4.2...v6.0.0/ -[5.4.2]: https://github.com/kickstarter/rack-attack/compare/v5.4.1...v5.4.2/ -[5.4.1]: https://github.com/kickstarter/rack-attack/compare/v5.4.0...v5.4.1/ -[5.4.0]: https://github.com/kickstarter/rack-attack/compare/v5.3.2...v5.4.0/ -[5.3.2]: https://github.com/kickstarter/rack-attack/compare/v5.3.1...v5.3.2/ -[5.3.1]: https://github.com/kickstarter/rack-attack/compare/v5.3.0...v5.3.1/ -[5.3.0]: https://github.com/kickstarter/rack-attack/compare/v5.2.0...v5.3.0/ -[5.2.0]: https://github.com/kickstarter/rack-attack/compare/v5.1.0...v5.2.0/ -[5.1.0]: https://github.com/kickstarter/rack-attack/compare/v5.0.1...v5.1.0/ -[5.0.1]: https://github.com/kickstarter/rack-attack/compare/v5.0.0...v5.0.1/ -[5.0.0]: https://github.com/kickstarter/rack-attack/compare/v4.4.1...v5.0.0/ -[4.4.1]: https://github.com/kickstarter/rack-attack/compare/v4.4.0...v4.4.1/ -[4.4.0]: https://github.com/kickstarter/rack-attack/compare/v4.3.1...v4.4.0/ -[4.3.1]: https://github.com/kickstarter/rack-attack/compare/v4.3.0...v4.3.1/ -[4.3.0]: https://github.com/kickstarter/rack-attack/compare/v4.2.0...v4.3.0/ -[4.2.0]: https://github.com/kickstarter/rack-attack/compare/v4.1.1...v4.2.0/ -[4.1.1]: https://github.com/kickstarter/rack-attack/compare/v4.1.0...v4.1.1/ -[4.1.0]: https://github.com/kickstarter/rack-attack/compare/v4.0.1...v4.1.0/ -[4.0.1]: https://github.com/kickstarter/rack-attack/compare/v4.0.0...v4.0.1/ -[4.0.0]: https://github.com/kickstarter/rack-attack/compare/v3.0.0...v4.0.0/ -[3.0.0]: https://github.com/kickstarter/rack-attack/compare/v2.3.0...v3.0.0/ -[2.3.0]: https://github.com/kickstarter/rack-attack/compare/v2.2.1...v2.3.0/ -[2.2.1]: https://github.com/kickstarter/rack-attack/compare/v2.2.0...v2.2.1/ -[2.2.0]: https://github.com/kickstarter/rack-attack/compare/v2.1.1...v2.2.0/ +[6.3.1]: https://github.com/rack/rack-attack/compare/v6.3.0...v6.3.1/ +[6.3.0]: https://github.com/rack/rack-attack/compare/v6.2.2...v6.3.0/ +[6.2.2]: https://github.com/rack/rack-attack/compare/v6.2.1...v6.2.2/ +[6.2.1]: https://github.com/rack/rack-attack/compare/v6.2.0...v6.2.1/ +[6.2.0]: https://github.com/rack/rack-attack/compare/v6.1.0...v6.2.0/ +[6.1.0]: https://github.com/rack/rack-attack/compare/v6.0.0...v6.1.0/ +[6.0.0]: https://github.com/rack/rack-attack/compare/v5.4.2...v6.0.0/ +[5.4.2]: https://github.com/rack/rack-attack/compare/v5.4.1...v5.4.2/ +[5.4.1]: https://github.com/rack/rack-attack/compare/v5.4.0...v5.4.1/ +[5.4.0]: https://github.com/rack/rack-attack/compare/v5.3.2...v5.4.0/ +[5.3.2]: https://github.com/rack/rack-attack/compare/v5.3.1...v5.3.2/ +[5.3.1]: https://github.com/rack/rack-attack/compare/v5.3.0...v5.3.1/ +[5.3.0]: https://github.com/rack/rack-attack/compare/v5.2.0...v5.3.0/ +[5.2.0]: https://github.com/rack/rack-attack/compare/v5.1.0...v5.2.0/ +[5.1.0]: https://github.com/rack/rack-attack/compare/v5.0.1...v5.1.0/ +[5.0.1]: https://github.com/rack/rack-attack/compare/v5.0.0...v5.0.1/ +[5.0.0]: https://github.com/rack/rack-attack/compare/v4.4.1...v5.0.0/ +[4.4.1]: https://github.com/rack/rack-attack/compare/v4.4.0...v4.4.1/ +[4.4.0]: https://github.com/rack/rack-attack/compare/v4.3.1...v4.4.0/ +[4.3.1]: https://github.com/rack/rack-attack/compare/v4.3.0...v4.3.1/ +[4.3.0]: https://github.com/rack/rack-attack/compare/v4.2.0...v4.3.0/ +[4.2.0]: https://github.com/rack/rack-attack/compare/v4.1.1...v4.2.0/ +[4.1.1]: https://github.com/rack/rack-attack/compare/v4.1.0...v4.1.1/ +[4.1.0]: https://github.com/rack/rack-attack/compare/v4.0.1...v4.1.0/ +[4.0.1]: https://github.com/rack/rack-attack/compare/v4.0.0...v4.0.1/ +[4.0.0]: https://github.com/rack/rack-attack/compare/v3.0.0...v4.0.0/ +[3.0.0]: https://github.com/rack/rack-attack/compare/v2.3.0...v3.0.0/ +[2.3.0]: https://github.com/rack/rack-attack/compare/v2.2.1...v2.3.0/ +[2.2.1]: https://github.com/rack/rack-attack/compare/v2.2.0...v2.2.1/ +[2.2.0]: https://github.com/rack/rack-attack/compare/v2.1.1...v2.2.0/ [@fatkodima]: https://github.com/fatkodima [@rofreg]: https://github.com/rofreg diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d6645611..63817fc7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,12 +8,12 @@ This project is intended to be a safe, welcoming space for collaboration, and co Any of the following is greatly appreciated: -* Helping users by answering to their [questions](https://github.com/kickstarter/rack-attack/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+question%22) -* Helping users troubleshoot their [error reports](https://github.com/kickstarter/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+error+report%22) to figure out if the error is caused by an actual bug or some misconfiguration -* Giving feedback by commenting in other users [feature requests](https://github.com/kickstarter/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+feature+request%22) +* Helping users by answering to their [questions](https://github.com/rack/rack-attack/issues?q=is%3Aopen+is%3Aissue+label%3A%22type%3A+question%22) +* Helping users troubleshoot their [error reports](https://github.com/rack/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+error+report%22) to figure out if the error is caused by an actual bug or some misconfiguration +* Giving feedback by commenting in other users [feature requests](https://github.com/rack/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22type%3A+feature+request%22) * Reporting an error you are experiencing * Suggesting a new feature you think it would be useful for many users -* If you want to work on fixing an actual issue and you don't know where to start, those labeled [good first issue](https://github.com/kickstarter/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) may be a good choice +* If you want to work on fixing an actual issue and you don't know where to start, those labeled [good first issue](https://github.com/rack/rack-attack/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) may be a good choice ## Style Guide diff --git a/README.md b/README.md index b33c64a3..43539e45 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ __Note__: You are viewing the development version README. -For the README consistent with the latest released version see https://github.com/kickstarter/rack-attack/blob/6-stable/README.md. +For the README consistent with the latest released version see https://github.com/rack/rack-attack/blob/6-stable/README.md. # Rack::Attack @@ -10,7 +10,7 @@ Protect your Rails and Rack apps from bad clients. Rack::Attack lets you easily See the [Backing & Hacking blog post](https://www.kickstarter.com/backing-and-hacking/rack-attack-protection-from-abusive-clients) introducing Rack::Attack. [![Gem Version](https://badge.fury.io/rb/rack-attack.svg)](https://badge.fury.io/rb/rack-attack) -[![Build Status](https://travis-ci.org/kickstarter/rack-attack.svg?branch=master)](https://travis-ci.org/kickstarter/rack-attack) +[![Build Status](https://travis-ci.org/rack/rack-attack.svg?branch=master)](https://travis-ci.org/rack/rack-attack) [![Code Climate](https://codeclimate.com/github/kickstarter/rack-attack.svg)](https://codeclimate.com/github/kickstarter/rack-attack) [![Join the chat at https://gitter.im/rack-attack/rack-attack](https://badges.gitter.im/rack-attack/rack-attack.svg)](https://gitter.im/rack-attack/rack-attack) diff --git a/docs/advanced_configuration.md b/docs/advanced_configuration.md index 0fd1fe4c..6d8737ea 100644 --- a/docs/advanced_configuration.md +++ b/docs/advanced_configuration.md @@ -6,7 +6,7 @@ If you're feeling ambitious or you have a very particular use-case for Rack::Att ### Exponential Backoff -By layering throttles with linearly increasing limits and exponentially increasing periods, you can mimic an exponential backoff throttle. See [#106](https://github.com/kickstarter/rack-attack/issues/106) for more discussion. +By layering throttles with linearly increasing limits and exponentially increasing periods, you can mimic an exponential backoff throttle. See [#106](https://github.com/rack/rack-attack/issues/106) for more discussion. ```ruby # Allows 20 requests in 8 seconds @@ -24,7 +24,7 @@ end ### Rack::Attack::Request Helpers -You can define helpers on requests like `localhost?` or `subdomain` by monkey-patching `Rack::Attack::Request`. See [#73](https://github.com/kickstarter/rack-attack/issues/73) for more discussion. +You can define helpers on requests like `localhost?` or `subdomain` by monkey-patching `Rack::Attack::Request`. See [#73](https://github.com/rack/rack-attack/issues/73) for more discussion. ```ruby class Rack::Attack::Request < ::Rack::Request @@ -38,7 +38,7 @@ Rack::Attack.safelist("localhost") { |req| req.localhost? } ### Blocklisting From ENV Variables -You can have `Rack::Attack` configure its blocklists from ENV variables to simplify maintenance. See [#110](https://github.com/kickstarter/rack-attack/issues/110) for more discussion. +You can have `Rack::Attack` configure its blocklists from ENV variables to simplify maintenance. See [#110](https://github.com/rack/rack-attack/issues/110) for more discussion. ```ruby class Rack::Attack @@ -57,7 +57,7 @@ end ### Reset Specific Throttles -By doing a bunch of monkey-patching, you can add a helper for resetting specific throttles. The implementation is kind of long, so see [#113](https://github.com/kickstarter/rack-attack/issues/113) for more discussion. +By doing a bunch of monkey-patching, you can add a helper for resetting specific throttles. The implementation is kind of long, so see [#113](https://github.com/rack/rack-attack/issues/113) for more discussion. ```ruby Rack::Attack.reset_throttle "logins/email", "user@example.com" @@ -65,7 +65,7 @@ Rack::Attack.reset_throttle "logins/email", "user@example.com" ### Blocklisting From Rails.cache -You can configure blocklists to check values stored in `Rails.cache` to allow setting blocklists from inside your application. See [#111](https://github.com/kickstarter/rack-attack/issues/111) for more discussion. +You can configure blocklists to check values stored in `Rails.cache` to allow setting blocklists from inside your application. See [#111](https://github.com/rack/rack-attack/issues/111) for more discussion. ```ruby # Block attacks from IPs in cache @@ -78,7 +78,7 @@ end ### Throttle Basic Auth Crackers -An example implementation for blocking hackers who spam basic auth attempts. See [#47](https://github.com/kickstarter/rack-attack/issues/47) for more discussion. +An example implementation for blocking hackers who spam basic auth attempts. See [#47](https://github.com/rack/rack-attack/issues/47) for more discussion. ```ruby # After 5 requests with incorrect auth in 1 minute, diff --git a/rack-attack.gemspec b/rack-attack.gemspec index e1c12a08..34689a36 100644 --- a/rack-attack.gemspec +++ b/rack-attack.gemspec @@ -15,16 +15,16 @@ Gem::Specification.new do |s| s.email = "aaron@ktheory.com" s.files = Dir.glob("{bin,lib}/**/*") + %w(Rakefile README.md) - s.homepage = 'https://github.com/kickstarter/rack-attack' + s.homepage = 'https://github.com/rack/rack-attack' s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.summary = 'Block & throttle abusive requests' s.test_files = Dir.glob("spec/**/*") s.metadata = { - "bug_tracker_uri" => "https://github.com/kickstarter/rack-attack/issues", - "changelog_uri" => "https://github.com/kickstarter/rack-attack/blob/master/CHANGELOG.md", - "source_code_uri" => "https://github.com/kickstarter/rack-attack" + "bug_tracker_uri" => "https://github.com/rack/rack-attack/issues", + "changelog_uri" => "https://github.com/rack/rack-attack/blob/master/CHANGELOG.md", + "source_code_uri" => "https://github.com/rack/rack-attack" } s.required_ruby_version = '>= 2.4' From 55d5e370fd048a558c554dbaa521de99daa730ed Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Fri, 25 Dec 2020 23:55:58 -0300 Subject: [PATCH 5/5] test: update ruby and rails versions --- .travis.yml | 26 ++++++++++++------- Appraisals | 12 ++++----- .../active_support_redis_cache_store.gemfile | 2 +- ...e_support_redis_cache_store_pooled.gemfile | 2 +- .../{rails_5_1.gemfile => rails_6_1.gemfile} | 2 +- rack-attack.gemspec | 2 +- ...e_support_redis_cache_store_pooled_spec.rb | 2 +- .../active_support_redis_cache_store_spec.rb | 2 +- 8 files changed, 28 insertions(+), 22 deletions(-) rename gemfiles/{rails_5_1.gemfile => rails_6_1.gemfile} (77%) diff --git a/.travis.yml b/.travis.yml index 1b876135..03ee277f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,11 +3,11 @@ language: ruby cache: bundler rvm: - - ruby-head - - 2.7.1 + - 3.0.0 + - 2.7.2 - 2.6.6 - 2.5.8 - - 2.4.10 + before_install: - yes | gem update --system @@ -16,9 +16,9 @@ before_install: gemfile: - gemfiles/rack_2.gemfile - gemfiles/rack_1.gemfile + - gemfiles/rails_6_1.gemfile - gemfiles/rails_6_0.gemfile - gemfiles/rails_5_2.gemfile - - gemfiles/rails_5_1.gemfile - gemfiles/rails_4_2.gemfile - gemfiles/dalli2.gemfile - gemfiles/redis_4.gemfile @@ -30,15 +30,21 @@ gemfile: - gemfiles/active_support_redis_store.gemfile matrix: - allow_failures: - - rvm: ruby-head exclude: - gemfile: gemfiles/rack_1.gemfile - rvm: 2.7.1 + rvm: 3.0.0 + - gemfile: gemfiles/rails_5_2.gemfile + rvm: 3.0.0 + - gemfile: gemfiles/rails_4_2.gemfile + rvm: 3.0.0 + - gemfile: gemfiles/dalli2.gemfile + rvm: 3.0.0 + - gemfile: gemfiles/connection_pool_dalli.gemfile + rvm: 3.0.0 + - gemfile: gemfiles/rack_1.gemfile + rvm: 2.7.2 - gemfile: gemfiles/rails_4_2.gemfile - rvm: 2.7.1 - - gemfile: gemfiles/rails_6_0.gemfile - rvm: 2.4.10 + rvm: 2.7.2 fast_finish: true services: diff --git a/Appraisals b/Appraisals index ef44d14e..03c6a706 100644 --- a/Appraisals +++ b/Appraisals @@ -17,6 +17,10 @@ appraise "rack_1" do gem "rack-test", ">= 0.6" end +appraise 'rails_6-1' do + gem 'railties', '~> 6.1.0' +end + appraise 'rails_6-0' do gem 'railties', '~> 6.0.0' end @@ -25,10 +29,6 @@ appraise 'rails_5-2' do gem 'railties', '~> 5.2.0' end -appraise 'rails_5-1' do - gem 'railties', '~> 5.1.0' -end - appraise 'rails_4-2' do gem 'railties', '~> 4.2.0' @@ -55,12 +55,12 @@ appraise "connection_pool_dalli" do end appraise "active_support_redis_cache_store" do - gem "activesupport", "~> 5.2.0" + gem "activesupport", "~> 6.1.0" gem "redis", "~> 4.0" end appraise "active_support_redis_cache_store_pooled" do - gem "activesupport", "~> 5.2.0" + gem "activesupport", "~> 6.1.0" gem "connection_pool", "~> 2.2" gem "redis", "~> 4.0" end diff --git a/gemfiles/active_support_redis_cache_store.gemfile b/gemfiles/active_support_redis_cache_store.gemfile index 30e1e38b..8acbbe13 100644 --- a/gemfiles/active_support_redis_cache_store.gemfile +++ b/gemfiles/active_support_redis_cache_store.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "activesupport", "~> 5.2.0" +gem "activesupport", "~> 6.1.0" gem "redis", "~> 4.0" gemspec path: "../" diff --git a/gemfiles/active_support_redis_cache_store_pooled.gemfile b/gemfiles/active_support_redis_cache_store_pooled.gemfile index 9232a9b5..cf1e92e2 100644 --- a/gemfiles/active_support_redis_cache_store_pooled.gemfile +++ b/gemfiles/active_support_redis_cache_store_pooled.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "activesupport", "~> 5.2.0" +gem "activesupport", "~> 6.1.0" gem "connection_pool", "~> 2.2" gem "redis", "~> 4.0" diff --git a/gemfiles/rails_5_1.gemfile b/gemfiles/rails_6_1.gemfile similarity index 77% rename from gemfiles/rails_5_1.gemfile rename to gemfiles/rails_6_1.gemfile index 66a5a0b9..4c467fec 100644 --- a/gemfiles/rails_5_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "railties", "~> 5.1.0" +gem "railties", "~> 6.1.0" gemspec path: "../" diff --git a/rack-attack.gemspec b/rack-attack.gemspec index 34689a36..75ca531e 100644 --- a/rack-attack.gemspec +++ b/rack-attack.gemspec @@ -46,5 +46,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'byebug', '~> 11.0' end - s.add_development_dependency 'railties', '>= 4.2', '< 6.1' + s.add_development_dependency 'railties', '>= 4.2', '< 6.2' end diff --git a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb index 9c26e8d6..fe951074 100644 --- a/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb +++ b/spec/acceptance/stores/active_support_redis_cache_store_pooled_spec.rb @@ -21,6 +21,6 @@ Rack::Attack.cache.store.clear end - it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.fetch(key) }) + it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.read(key) }) end end diff --git a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb index f595ec2a..a824edea 100644 --- a/spec/acceptance/stores/active_support_redis_cache_store_spec.rb +++ b/spec/acceptance/stores/active_support_redis_cache_store_spec.rb @@ -20,6 +20,6 @@ Rack::Attack.cache.store.clear end - it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.fetch(key) }) + it_works_for_cache_backed_features(fetch_from_store: ->(key) { Rack::Attack.cache.store.read(key) }) end end