New Upstream Snapshot - ruby-api-pagination
Ready changes
Summary
Merged new upstream version: 5.0.0 (was: 4.8.2).
Resulting package
Built on 2022-11-20T04:36 (took 5m7s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots ruby-api-pagination
Lintian Result
Diff
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4279c1c..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,19 +0,0 @@
-*.gem
-*.rbc
-.bundle
-.config
-.yardoc
-.ruby-version
-.ruby-gemset
-Gemfile.lock
-InstalledFiles
-_yardoc
-coverage
-doc/
-lib/bundler/man
-pkg
-rdoc
-spec/reports
-test/tmp
-test/version_tmp
-tmp
diff --git a/README.md b/README.md
index 673bd20..0137d76 100644
--- a/README.md
+++ b/README.md
@@ -58,11 +58,11 @@ ApiPagination.configure do |config|
config.per_page_param do |params|
params[:page][:size] if params[:page].is_a?(ActionController::Parameters)
end
-
+
# Optional: Include the total and last_page link header
# By default, this is set to true
# Note: When using kaminari, this prevents the count call to the database
- config.include_total = false
+ config.include_total = false
end
```
@@ -71,7 +71,7 @@ end
Pagy does not have a built-in way to specify a maximum number of items per page, but `api-pagination` will check if you've set a `:max_per_page` variable. To configure this, you can use the following code somewhere in an initializer:
```ruby
-Pagy::VARS[:max_per_page] = 100
+Pagy::DEFAULT[:max_per_page] = 100
```
If left unconfigured, clients can request as many items per page as they wish, so it's highly recommended that you configure this.
diff --git a/api-pagination.gemspec b/api-pagination.gemspec
index 4d33dfe..0d7c582 100644
--- a/api-pagination.gemspec
+++ b/api-pagination.gemspec
@@ -16,10 +16,16 @@ Gem::Specification.new do |s|
s.test_files = Dir['spec/**/*']
s.require_paths = ['lib']
- s.add_development_dependency 'rspec', '~> 3.0'
- s.add_development_dependency 'grape', '>= 0.10.0'
- s.add_development_dependency 'railties', '>= 5.0.0'
- s.add_development_dependency 'actionpack', '>= 5.0.0'
- s.add_development_dependency 'sequel', '>= 4.9.0'
- s.add_development_dependency 'activerecord-nulldb-adapter', '>= 0.3.9'
+ s.required_ruby_version = '> 2.7'
+
+ s.add_development_dependency 'kaminari', '~> 1.2', '>= 1.2.1'
+ s.add_development_dependency 'pagy', '~> 5.1', '>= 5.1.2'
+ s.add_development_dependency 'will_paginate', '~> 3.3', '>= 3.3.1'
+
+ s.add_development_dependency 'rspec', '~> 3.10'
+ s.add_development_dependency 'grape', '~> 1.6'
+ s.add_development_dependency 'railties', '~> 6.1', '>= 6.1.4.1'
+ s.add_development_dependency 'actionpack', '~> 6.1', '>= 6.1.4.1'
+ s.add_development_dependency 'sequel', '~> 5.49'
+ s.add_development_dependency 'activerecord-nulldb-adapter', '~> 0.7.0'
end
diff --git a/debian/changelog b/debian/changelog
index e1cc895..96d0a4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ruby-api-pagination (5.0.0-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Drop patch ruby3.0.patch, present upstream.
+
+ -- Debian Janitor <janitor@jelmer.uk> Sun, 20 Nov 2022 04:33:34 -0000
+
ruby-api-pagination (4.8.2-2) unstable; urgency=medium
* Team Upload.
diff --git a/debian/patches/0001-Allow-running-test-suite-without-PAGINATOR-set.patch b/debian/patches/0001-Allow-running-test-suite-without-PAGINATOR-set.patch
index b0b50c5..963ec7f 100644
--- a/debian/patches/0001-Allow-running-test-suite-without-PAGINATOR-set.patch
+++ b/debian/patches/0001-Allow-running-test-suite-without-PAGINATOR-set.patch
@@ -11,10 +11,10 @@ Author: Antonio Terceiro <terceiro@debian.org>
spec/spec_helper.rb | 2 ++
1 file changed, 2 insertions(+)
-diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
-index 02d1ee7..2b8e96c 100644
---- a/spec/spec_helper.rb
-+++ b/spec/spec_helper.rb
+Index: ruby-api-pagination.git/spec/spec_helper.rb
+===================================================================
+--- ruby-api-pagination.git.orig/spec/spec_helper.rb
++++ ruby-api-pagination.git/spec/spec_helper.rb
@@ -2,6 +2,8 @@ require 'support/numbers_controller'
require 'support/numbers_api'
require 'api-pagination'
diff --git a/debian/patches/ruby3.0.patch b/debian/patches/ruby3.0.patch
deleted file mode 100644
index 602b8a0..0000000
--- a/debian/patches/ruby3.0.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-From f276939dcf1362a35527a3028a4623a145c88b57 Mon Sep 17 00:00:00 2001
-From: Viktor Sych <skcc321@gmail.com>
-Date: Mon, 25 Oct 2021 22:29:11 +0300
-Subject: [PATCH] [~] ruby 3 support
-
----
- README.md | 6 +++---
- api-pagination.gemspec | 18 ++++++++++++------
- lib/api-pagination.rb | 10 +++++-----
- spec/api-pagination_spec.rb | 2 +-
- spec/rails_spec.rb | 10 +++++-----
- 5 files changed, 26 insertions(+), 20 deletions(-)
-
---- a/README.md
-+++ b/README.md
-@@ -58,11 +58,11 @@
- config.per_page_param do |params|
- params[:page][:size] if params[:page].is_a?(ActionController::Parameters)
- end
--
-+
- # Optional: Include the total and last_page link header
- # By default, this is set to true
- # Note: When using kaminari, this prevents the count call to the database
-- config.include_total = false
-+ config.include_total = false
- end
- ```
-
-@@ -71,7 +71,7 @@
- Pagy does not have a built-in way to specify a maximum number of items per page, but `api-pagination` will check if you've set a `:max_per_page` variable. To configure this, you can use the following code somewhere in an initializer:
-
- ```ruby
--Pagy::VARS[:max_per_page] = 100
-+Pagy::DEFAULT[:max_per_page] = 100
- ```
-
- If left unconfigured, clients can request as many items per page as they wish, so it's highly recommended that you configure this.
---- a/api-pagination.gemspec
-+++ b/api-pagination.gemspec
-@@ -16,10 +16,16 @@
- s.test_files = Dir['spec/**/*']
- s.require_paths = ['lib']
-
-- s.add_development_dependency 'rspec', '~> 3.0'
-- s.add_development_dependency 'grape', '>= 0.10.0'
-- s.add_development_dependency 'railties', '>= 5.0.0'
-- s.add_development_dependency 'actionpack', '>= 5.0.0'
-- s.add_development_dependency 'sequel', '>= 4.9.0'
-- s.add_development_dependency 'activerecord-nulldb-adapter', '>= 0.3.9'
-+ s.required_ruby_version = '> 2.7'
-+
-+ s.add_development_dependency 'kaminari', '~> 1.2', '>= 1.2.1'
-+ s.add_development_dependency 'pagy', '~> 5.1', '>= 5.1.2'
-+ s.add_development_dependency 'will_paginate', '~> 3.3', '>= 3.3.1'
-+
-+ s.add_development_dependency 'rspec', '~> 3.10'
-+ s.add_development_dependency 'grape', '~> 1.6'
-+ s.add_development_dependency 'railties', '~> 6.1', '>= 6.1.4.1'
-+ s.add_development_dependency 'actionpack', '~> 6.1', '>= 6.1.4.1'
-+ s.add_development_dependency 'sequel', '~> 5.49'
-+ s.add_development_dependency 'activerecord-nulldb-adapter', '~> 0.7.0'
- end
---- a/lib/api-pagination.rb
-+++ b/lib/api-pagination.rb
-@@ -47,10 +47,10 @@
- private
-
- def paginate_with_pagy(collection, options)
-- if Pagy::VARS[:max_per_page] && options[:per_page] > Pagy::VARS[:max_per_page]
-- options[:per_page] = Pagy::VARS[:max_per_page]
-+ if Pagy::DEFAULT[:max_per_page] && options[:per_page] > Pagy::DEFAULT[:max_per_page]
-+ options[:per_page] = Pagy::DEFAULT[:max_per_page]
- elsif options[:per_page] <= 0
-- options[:per_page] = Pagy::VARS[:items]
-+ options[:per_page] = Pagy::DEFAULT[:items]
- end
-
- pagy = pagy_from(collection, options)
-@@ -69,7 +69,7 @@
- else
- count = collection.is_a?(Array) ? collection.count : collection.count(:all)
- end
--
-+
- Pagy.new(count: count, items: options[:per_page], page: options[:page])
- end
-
-@@ -94,7 +94,7 @@
- options[:per_page] = get_default_per_page_for_kaminari(collection)
- end
-
-- collection = Kaminari.paginate_array(collection, paginate_array_options) if collection.is_a?(Array)
-+ collection = Kaminari.paginate_array(collection, **paginate_array_options) if collection.is_a?(Array)
- collection = collection.page(options[:page]).per(options[:per_page])
- collection.without_count if !collection.is_a?(Array) && !ApiPagination.config.include_total
- [collection, nil]
---- a/spec/api-pagination_spec.rb
-+++ b/spec/api-pagination_spec.rb
-@@ -11,7 +11,7 @@
- describe '.paginate' do
- it 'should accept paginate_array_options option' do
- expect(Kaminari).to receive(:paginate_array)
-- .with(collection, paginate_array_options)
-+ .with(collection, **paginate_array_options)
- .and_call_original
-
- ApiPagination.paginate(
---- a/spec/rails_spec.rb
-+++ b/spec/rails_spec.rb
-@@ -262,7 +262,7 @@
- end
- end
-
-- after :all do
-+ after :all do
- class Fixnum
- class << self
- undef_method :default_per_page, :per_page
-@@ -286,7 +286,7 @@
-
- expect(response.header['Per-Page']).to eq(
- case ApiPagination.config.paginator
-- when :pagy then Pagy::VARS[:items].to_s
-+ when :pagy then Pagy::DEFAULT[:items].to_s
- when :kaminari then Kaminari.config.default_per_page.to_s
- when :will_paginate then WillPaginate.per_page.to_s
- end
-@@ -295,13 +295,13 @@
- end
- end
-
-- context 'default per page in objects without paginator defaults' do
-+ context 'default per page in objects without paginator defaults' do
- it 'should not fail if model does not respond to per page' do
- get :index_with_no_per_page, params: {count: 100}
-
- expect(response.header['Per-Page']).to eq(
- case ApiPagination.config.paginator
-- when :pagy then Pagy::VARS[:items].to_s
-+ when :pagy then Pagy::DEFAULT[:items].to_s
- when :kaminari then Kaminari.config.default_per_page.to_s
- when :will_paginate then WillPaginate.per_page.to_s
- end
-@@ -309,4 +309,4 @@
- end
- end
- end
--end
-\ No newline at end of file
-+end
diff --git a/debian/patches/series b/debian/patches/series
index 988a05d..12249dd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
0001-Allow-running-test-suite-without-PAGINATOR-set.patch
-ruby3.0.patch
diff --git a/lib/api-pagination.rb b/lib/api-pagination.rb
index d8c94d2..fa55ae4 100644
--- a/lib/api-pagination.rb
+++ b/lib/api-pagination.rb
@@ -47,10 +47,10 @@ module ApiPagination
private
def paginate_with_pagy(collection, options)
- if Pagy::VARS[:max_per_page] && options[:per_page] > Pagy::VARS[:max_per_page]
- options[:per_page] = Pagy::VARS[:max_per_page]
+ if Pagy::DEFAULT[:max_per_page] && options[:per_page] > Pagy::DEFAULT[:max_per_page]
+ options[:per_page] = Pagy::DEFAULT[:max_per_page]
elsif options[:per_page] <= 0
- options[:per_page] = Pagy::VARS[:items]
+ options[:per_page] = Pagy::DEFAULT[:items]
end
pagy = pagy_from(collection, options)
@@ -69,7 +69,7 @@ module ApiPagination
else
count = collection.is_a?(Array) ? collection.count : collection.count(:all)
end
-
+
Pagy.new(count: count, items: options[:per_page], page: options[:page])
end
@@ -94,7 +94,7 @@ module ApiPagination
options[:per_page] = get_default_per_page_for_kaminari(collection)
end
- collection = Kaminari.paginate_array(collection, paginate_array_options) if collection.is_a?(Array)
+ collection = Kaminari.paginate_array(collection, **paginate_array_options) if collection.is_a?(Array)
collection = collection.page(options[:page]).per(options[:per_page])
collection.without_count if !collection.is_a?(Array) && !ApiPagination.config.include_total
[collection, nil]
diff --git a/lib/api-pagination/version.rb b/lib/api-pagination/version.rb
index 559d752..aa285e4 100644
--- a/lib/api-pagination/version.rb
+++ b/lib/api-pagination/version.rb
@@ -1,8 +1,8 @@
module ApiPagination
class Version
- MAJOR = 4
- MINOR = 8
- PATCH = 2
+ MAJOR = 5
+ MINOR = 0
+ PATCH = 0
def self.to_s
[MAJOR, MINOR, PATCH].join('.')
diff --git a/spec/api-pagination_spec.rb b/spec/api-pagination_spec.rb
index ea01cde..cbe7fcc 100644
--- a/spec/api-pagination_spec.rb
+++ b/spec/api-pagination_spec.rb
@@ -11,7 +11,7 @@ describe ApiPagination do
describe '.paginate' do
it 'should accept paginate_array_options option' do
expect(Kaminari).to receive(:paginate_array)
- .with(collection, paginate_array_options)
+ .with(collection, **paginate_array_options)
.and_call_original
ApiPagination.paginate(
diff --git a/spec/rails_spec.rb b/spec/rails_spec.rb
index cde7420..56b5911 100644
--- a/spec/rails_spec.rb
+++ b/spec/rails_spec.rb
@@ -262,7 +262,7 @@ describe NumbersController, :type => :controller do
end
end
- after :all do
+ after :all do
class Fixnum
class << self
undef_method :default_per_page, :per_page
@@ -286,7 +286,7 @@ describe NumbersController, :type => :controller do
expect(response.header['Per-Page']).to eq(
case ApiPagination.config.paginator
- when :pagy then Pagy::VARS[:items].to_s
+ when :pagy then Pagy::DEFAULT[:items].to_s
when :kaminari then Kaminari.config.default_per_page.to_s
when :will_paginate then WillPaginate.per_page.to_s
end
@@ -295,13 +295,13 @@ describe NumbersController, :type => :controller do
end
end
- context 'default per page in objects without paginator defaults' do
+ context 'default per page in objects without paginator defaults' do
it 'should not fail if model does not respond to per page' do
get :index_with_no_per_page, params: {count: 100}
expect(response.header['Per-Page']).to eq(
case ApiPagination.config.paginator
- when :pagy then Pagy::VARS[:items].to_s
+ when :pagy then Pagy::DEFAULT[:items].to_s
when :kaminari then Kaminari.config.default_per_page.to_s
when :will_paginate then WillPaginate.per_page.to_s
end
@@ -309,4 +309,4 @@ describe NumbersController, :type => :controller do
end
end
end
-end
\ No newline at end of file
+end
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/api-pagination-5.0.0.gemspec
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/rubygems-integration/all/specifications/api-pagination-4.8.2.gemspec
Control files: lines which differ (wdiff format)
Ruby-Versions: all