plucky 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  gem 'bson_ext', '~> 1.5'
@@ -8,11 +8,6 @@ group :performance do
8
8
  gem 'perftools.rb', :require => 'perftools'
9
9
  end
10
10
 
11
- group(:debug) do
12
- platforms(:mri_18) { gem 'ruby-debug' }
13
- platforms(:mri_19) { gem 'ruby-debug19' }
14
- end
15
-
16
11
  group(:test) do
17
12
  gem 'rspec'
18
13
  gem 'log_buddy'
@@ -22,6 +17,5 @@ group(:guard) do
22
17
  gem 'guard'
23
18
  gem 'guard-rspec'
24
19
  gem 'guard-bundler'
25
- gem 'terminal-notifier-guard'
26
20
  gem 'rb-fsevent'
27
21
  end
@@ -53,8 +53,9 @@ module Plucky
53
53
  def paginate(opts={})
54
54
  page = opts.delete(:page)
55
55
  limit = opts.delete(:per_page) || per_page
56
+ total_entries = opts.delete(:total_entries)
56
57
  query = clone.amend(opts)
57
- paginator = Pagination::Paginator.new(query.count, page, limit)
58
+ paginator = Pagination::Paginator.new(total_entries || query.count, page, limit)
58
59
  docs = query.amend({
59
60
  :limit => paginator.limit,
60
61
  :skip => paginator.skip,
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Plucky
3
- Version = '0.6.2'
3
+ Version = '0.6.3'
4
4
  end
@@ -17,7 +17,7 @@ Log = Logger.new(File.join(log_dir, 'test.log'))
17
17
 
18
18
  LogBuddy.init :logger => Log
19
19
 
20
- connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => Log)
20
+ connection = Mongo::MongoClient.new('127.0.0.1', 27017, :logger => Log)
21
21
  DB = connection.db('test')
22
22
 
23
23
  RSpec.configure do |config|
@@ -27,15 +27,15 @@ RSpec.configure do |config|
27
27
  config.run_all_when_everything_filtered = true
28
28
 
29
29
  config.before(:suite) do
30
- DB.collections.map do |collection|
31
- collection.drop_indexes
32
- end
30
+ DB.collections.reject { |collection|
31
+ collection.name =~ /system\./
32
+ }.map(&:drop_indexes)
33
33
  end
34
34
 
35
35
  config.before(:each) do
36
- DB.collections.map do |collection|
37
- collection.remove
38
- end
36
+ DB.collections.reject { |collection|
37
+ collection.name =~ /system\./
38
+ }.map(&:remove)
39
39
  end
40
40
  end
41
41
 
@@ -182,6 +182,11 @@ describe Plucky::Query do
182
182
  subject[:name].should be_nil
183
183
  end
184
184
 
185
+ it "allows total_entries overrides" do
186
+ docs = subject.paginate(:total_entries => 1)
187
+ docs.total_entries.should == 1
188
+ end
189
+
185
190
  context "with options" do
186
191
  before do
187
192
  @result = @query.sort(:age).paginate(:age.gt => 27, :per_page => 10)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plucky
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-31 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongo
16
- requirement: &70139265557120 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,12 @@ dependencies:
21
21
  version: '1.5'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70139265557120
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.5'
25
30
  description:
26
31
  email:
27
32
  - nunemaker@gmail.com
@@ -29,7 +34,6 @@ executables: []
29
34
  extensions: []
30
35
  extra_rdoc_files: []
31
36
  files:
32
- - .bundle/config
33
37
  - .gitignore
34
38
  - .travis.yml
35
39
  - Gemfile
@@ -91,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
95
  version: '0'
92
96
  segments:
93
97
  - 0
94
- hash: -4423147418805869857
98
+ hash: 2311334578269732837
95
99
  required_rubygems_version: !ruby/object:Gem::Requirement
96
100
  none: false
97
101
  requirements:
@@ -100,10 +104,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
104
  version: '0'
101
105
  segments:
102
106
  - 0
103
- hash: -4423147418805869857
107
+ hash: 2311334578269732837
104
108
  requirements: []
105
109
  rubyforge_project:
106
- rubygems_version: 1.8.10
110
+ rubygems_version: 1.8.23
107
111
  signing_key:
108
112
  specification_version: 3
109
113
  summary: Thin layer over the ruby driver that allows you to quickly grab hold of your
@@ -1,4 +0,0 @@
1
- ---
2
- BUNDLE_BIN: bin
3
- BUNDLE_DISABLE_SHARED_GEMS: "1"
4
- BUNDLE_PATH: vendor/gems