Drop support for MongoMapper.

This extension will be unsupported in Kaminari 1.x

If you'd like to support it, please let us know by opening a ticket on
https://github.com/amatsuda/kaminari/issues/new

Conflicts:
	.travis.yml
	README.rdoc
	spec/fake_app/mongo_mapper/config.rb
This commit is contained in:
Zachary Scott 2014-11-22 16:01:37 -08:00 committed by Yuki Nishijima
parent 57bd721811
commit 48fc4bd0f1
12 changed files with 1 additions and 176 deletions

View File

@ -15,7 +15,6 @@ gemfile:
- gemfiles/active_record_41.gemfile
- gemfiles/active_record_42.gemfile
- gemfiles/active_record_edge.gemfile
- gemfiles/mongo_mapper.gemfile
- gemfiles/mongoid_24.gemfile
- gemfiles/mongoid_30.gemfile
- gemfiles/mongoid_31.gemfile

View File

@ -19,7 +19,7 @@ No special collection class or anything for the paginated values, instead using
As the whole pagination helper is basically just a collection of links and non-links, Kaminari renders each of them through its own partial template inside the Engine. So, you can easily modify their behaviour, style or whatever by overriding partial templates.
=== ORM & template engine agnostic
Kaminari supports multiple ORMs (ActiveRecord, Mongoid, MongoMapper) multiple web frameworks (Rails, Sinatra, Grape), and multiple template engines (ERB, Haml, Slim).
Kaminari supports multiple ORMs (ActiveRecord, Mongoid) multiple web frameworks (Rails, Sinatra, Grape), and multiple template engines (ERB, Haml, Slim).
=== Modern
The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper supports Rails 3 unobtrusive Ajax.
@ -35,8 +35,6 @@ The pagination helper outputs the HTML5 <nav> tag by default. Plus, the helper s
* Mongoid 2+
* MongoMapper 0.9+
== Install
Put this line in your Gemfile:

View File

@ -1,25 +0,0 @@
source 'https://rubygems.org'
gem 'railties', '>= 3.2.3'
gem 'bson', '~> 1.9.2'
gem 'mongo_mapper', '>= 0.11.0'
gem 'rspec-rails', '~> 2.14.1'
# stick to versions that work under Ruby 1.8 for now
gem 'capybara', '< 2.1'
gem 'nokogiri', '< 1.6'
gem 'rubyzip', '< 1'
gem 'mime-types', '< 2'
if RUBY_VERSION == '1.8.7'
gem 'activesupport', '~> 3.2.18'
end
platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc'
gem 'minitest'
gem 'rubinius-developer_tools'
end
gemspec :path => '../'

View File

@ -12,11 +12,6 @@ module Kaminari
::Mongoid::Document.send :include, Kaminari::MongoidExtension::Document
end
ActiveSupport.on_load(:mongo_mapper) do
require 'kaminari/models/mongo_mapper_extension'
::MongoMapper::Document.send :include, Kaminari::MongoMapperExtension::Document
::Plucky::Query.send :include, Kaminari::PluckyCriteriaMethods
end
require 'kaminari/models/array_extension'
ActiveSupport.on_load(:action_view) do

View File

@ -1,18 +0,0 @@
require 'kaminari/models/plucky_criteria_methods'
module Kaminari
module MongoMapperExtension
module Document
extend ActiveSupport::Concern
include Kaminari::ConfigurationMethods
included do
# Fetch the values at the specified page number
# Model.page(5)
scope Kaminari.config.page_method_name, Proc.new {|num|
limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
}
end
end
end
end

View File

@ -1,23 +0,0 @@
module Kaminari
module PluckyCriteriaMethods
include Kaminari::PageScopeMethods
delegate :default_per_page, :max_per_page, :max_pages, :to => :model
def entry_name
model.model_name.human.downcase
end
def limit_value #:nodoc:
options[:limit]
end
def offset_value #:nodoc:
options[:skip]
end
def total_count #:nodoc:
count
end
end
end

View File

@ -1,2 +0,0 @@
MongoMapper.connection = Mongo::Connection.new '0.0.0.0', 27017
MongoMapper.database = 'kaminari_test'

View File

@ -1,9 +0,0 @@
class User
include ::MongoMapper::Document
key :name, String
key :age, Integer
end
class User::Address
include ::MongoMapper::Document
end

View File

@ -4,7 +4,6 @@ require 'action_view/railtie'
require 'fake_app/active_record/config' if defined? ActiveRecord
require 'fake_app/mongoid/config' if defined? Mongoid
require 'fake_app/mongo_mapper/config' if defined? MongoMapper
# config
app = Class.new(Rails::Application)
app.config.secret_token = '3b7cd727ee24e8444053437c36cc66c4'
@ -27,7 +26,6 @@ end
#models
require 'fake_app/active_record/models' if defined? ActiveRecord
require 'fake_app/mongoid/models' if defined? Mongoid
require 'fake_app/mongo_mapper/models' if defined? MongoMapper
# controllers
class ApplicationController < ActionController::Base; end

View File

@ -1,11 +1,9 @@
require 'fake_app/active_record/config' if defined? ActiveRecord
require 'fake_app/mongoid/config' if defined? Mongoid
require 'fake_app/mongo_mapper/config' if defined? MongoMapper
#models
require 'fake_app/active_record/models' if defined? ActiveRecord
require 'fake_app/mongoid/models' if defined? Mongoid
require 'fake_app/mongo_mapper/models' if defined? MongoMapper
class SinatraApp < Sinatra::Base
register Kaminari::Helpers::SinatraHelpers

View File

@ -1,84 +0,0 @@
require 'spec_helper'
if defined? MongoMapper
describe Kaminari::MongoMapperExtension do
before(:each) do
User.destroy_all
41.times { User.create!({:salary => 1}) }
end
describe '#page' do
context 'page 1' do
subject { User.page(1) }
it { should be_a Plucky::Query }
its(:current_page) { should == 1 }
its(:prev_page) { should be_nil }
its(:next_page) { should == 2 }
its(:limit_value) { should == 25 }
its(:total_pages) { should == 2 }
it { should skip(0) }
end
context 'page 2' do
subject { User.page 2 }
it { should be_a Plucky::Query }
its(:current_page) { should == 2 }
its(:prev_page) { should == 1 }
its(:next_page) { should be_nil }
its(:limit_value) { should == 25 }
its(:total_pages) { should == 2 }
it { should skip 25 }
end
context 'page "foobar"' do
subject { User.page 'foobar' }
it { should be_a Plucky::Query }
its(:current_page) { should == 1 }
its(:prev_page) { should be_nil }
its(:next_page) { should == 2 }
its(:limit_value) { should == 25 }
its(:total_pages) { should == 2 }
it { should skip 0 }
end
context 'with criteria before' do
it "should have the proper criteria source" do
User.where(:salary => 1).page(2).criteria.source.should == {:salary => 1}
end
subject { User.where(:salary => 1).page 2 }
its(:current_page) { should == 2 }
its(:prev_page) { should == 1 }
its(:next_page) { should be_nil }
its(:limit_value) { should == 25 }
its(:total_pages) { should == 2 }
it { should skip 25 }
end
context 'with criteria after' do
it "should have the proper criteria source" do
User.where(:salary => 1).page(2).criteria.source.should == {:salary => 1}
end
subject { User.page(2).where(:salary => 1) }
its(:current_page) { should == 2 }
its(:prev_page) { should == 1 }
its(:next_page) { should be_nil }
its(:limit_value) { should == 25 }
its(:total_pages) { should == 2 }
it { should skip 25 }
end
end
describe '#per' do
subject { User.page(2).per(10) }
it { should be_a Plucky::Query }
its(:current_page) { should == 2 }
its(:prev_page) { should == 1 }
its(:next_page) { should == 3 }
its(:limit_value) { should == 10 }
its(:total_pages) { should == 5 }
it { should skip 10 }
end
end
end

View File

@ -1,12 +1,10 @@
DatabaseCleaner[:active_record].strategy = :transaction if defined? ActiveRecord
DatabaseCleaner[:mongoid].strategy = :truncation if defined? Mongoid
DatabaseCleaner[:mongo_mapper].strategy = :truncation if defined? MongoMapper
RSpec.configure do |config|
config.before :suite do
DatabaseCleaner.clean_with :truncation if defined? ActiveRecord
DatabaseCleaner.clean_with :truncation if defined? Mongoid
DatabaseCleaner.clean_with :truncation if defined? MongoMapper
end
config.before :each do
DatabaseCleaner.start