mongoid-slug 5.0.0 → 5.1.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzVhMTg3OTVmNzYyZDVmNWQ1MGQxYTNiMDYyZDUzMDhkMTFiNjNkOA==
5
- data.tar.gz: !binary |-
6
- MDNjMmJjZTI4MDE3Njk1NThhYjg4ZTZjNmEwYzE4NzVkMjA3ZTUwNg==
2
+ SHA1:
3
+ metadata.gz: bb594c9cba9d0b1747cfe7de88bd16025729bb92
4
+ data.tar.gz: c196bf56ba7b22a85277955c87a46054be646d7b
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NWIzMWQzYTFlNTNhNDcwY2IwN2RhM2M0M2Q5OGVkNTg1MjUzOTM1ODA5N2Rh
10
- ZTA0NjQ0ODk0MGI5MDMzNmM4Y2I0ZDAzZWIxYzM3ZmVjOTZiYTA3NGJhZjJi
11
- YmQyOWQxZjkwZmVmYTBkOWM4MTMxMTAzYjRhZDc2MDdhMDBiYzA=
12
- data.tar.gz: !binary |-
13
- MTBkMDU5NDRlYjkxY2MyNDdjMTI1OWY4NThkYTkyNTRmMzUyZmY2ZDU4ODVl
14
- MjU2YjNjMTRkZThiNmU3OWRmNGQ0ZTEyZTkxZTFkNDQ2ZTJkMmI2YjJmMTgx
15
- OWQxNDEwYTQ5OTYzYzI3ZDk3MTlkMWFlNThjNTcyODJmZTI0Yjc=
6
+ metadata.gz: 5114980882e64954cfa197753e32c36ff78f32d09aa933e75d5ea705a1f04c6efe3837a8060b2f0747e2d8a4fe382c07e4f50d4ee1ec6623a4fae2962bda8d3b
7
+ data.tar.gz: 7d29e77096446b20be262a5e648a845e5621e5b8402aab368103115ae890e7a297c5213dc7f31a61fb395227e0e6c7cae5096f016c0af8c65cf2777237a6aae0
data/README.md CHANGED
@@ -3,10 +3,10 @@ Mongoid Slug
3
3
 
4
4
  Mongoid Slug generates a URL slug or permalink based on one or more fields in a Mongoid model. It sits idly on top of [stringex](https://github.com/rsl/stringex), supporting non-Latin characters.
5
5
 
6
- [![Build Status](https://secure.travis-ci.org/digitalplaywright/mongoid-slug.png)](http://travis-ci.org/digitalplaywright/mongoid-slug)
6
+ [![Build Status](https://secure.travis-ci.org/digitalplaywright/mongoid-slug.svg)](http://travis-ci.org/digitalplaywright/mongoid-slug)
7
7
  [![Gem Version](https://badge.fury.io/rb/mongoid-slug.svg)](http://badge.fury.io/rb/mongoid-slug)
8
- [![Dependency Status](https://gemnasium.com/digitalplaywright/mongoid-slug.png)](https://gemnasium.com/digitalplaywright/mongoid-slug)
9
- [![Code Climate](https://codeclimate.com/github/digitalplaywright/mongoid-slug.png)](https://codeclimate.com/github/digitalplaywright/mongoid-slug)
8
+ [![Dependency Status](https://gemnasium.com/digitalplaywright/mongoid-slug.svg)](https://gemnasium.com/digitalplaywright/mongoid-slug)
9
+ [![Code Climate](https://codeclimate.com/github/digitalplaywright/mongoid-slug.svg)](https://codeclimate.com/github/digitalplaywright/mongoid-slug)
10
10
 
11
11
  Installation
12
12
  ------------
@@ -267,10 +267,6 @@ module Mongoid
267
267
  cur_slug || pre_slug_string
268
268
  end
269
269
 
270
- def self.mongoid3?
271
- ::Mongoid.const_defined? :Observer
272
- end
273
-
274
270
  private
275
271
 
276
272
  def append_slug(value)
@@ -67,11 +67,7 @@ module Mongoid
67
67
 
68
68
  # a string will not look like a slug if it looks like a legal BSON::ObjectId
69
69
  def objectid_slug_strategy(id)
70
- if Mongoid::Slug.mongoid3?
71
- Moped::BSON::ObjectId.legal? id
72
- else
73
- BSON::ObjectId.legal?(id)
74
- end
70
+ Mongoid::Compatibility::ObjectId.legal?(id)
75
71
  end
76
72
 
77
73
  # a string will always look like a slug
@@ -1,5 +1,5 @@
1
1
  module Mongoid #:nodoc:
2
2
  module Slug
3
- VERSION = '5.0.0'
3
+ VERSION = '5.1.0'
4
4
  end
5
5
  end
@@ -98,7 +98,7 @@ module Mongoid
98
98
  end
99
99
 
100
100
  it 'does not allow a BSON::ObjectId as use for a slug' do
101
- bson_id = Mongoid::Slug.mongoid3? ? Moped::BSON::ObjectId.new.to_s : BSON::ObjectId.new.to_s
101
+ bson_id = Mongoid::Compatibility::Version.mongoid3? ? Moped::BSON::ObjectId.new.to_s : BSON::ObjectId.new.to_s
102
102
  bad = Book.create(title: bson_id)
103
103
  expect(bad.slugs).not_to include(bson_id)
104
104
  end
@@ -1,13 +1,13 @@
1
1
  shared_examples 'has an index' do |key, options|
2
2
  it "has a #{key} index" do
3
- index = if Mongoid::Slug.mongoid3?
3
+ index = if Mongoid::Compatibility::Version.mongoid3?
4
4
  subject.index_options[key]
5
5
  else
6
6
  subject.index_specifications.detect { |spec| spec.key == key }
7
7
  end
8
8
  expect(index).not_to be_nil
9
9
  options.each_pair do |name, value|
10
- if Mongoid::Slug.mongoid3?
10
+ if Mongoid::Compatibility::Version.mongoid3?
11
11
  expect(index[name]).to eq(value)
12
12
  else
13
13
  expect(index.options[name]).to eq(value)
@@ -18,7 +18,7 @@ end
18
18
 
19
19
  shared_examples 'does not have an index' do |key, _option|
20
20
  it "does not have the #{key} index" do
21
- if Mongoid::Slug.mongoid3?
21
+ if Mongoid::Compatibility::Version.mongoid3?
22
22
  expect(subject.index_options[key]).to be_nil
23
23
  else
24
24
  expect(subject.index_specifications.detect { |spec| spec.key == key }).to be_nil
@@ -8,10 +8,12 @@ require 'active_support/deprecation'
8
8
  require 'mongoid'
9
9
  require 'mongoid/paranoia'
10
10
  require 'rspec/its'
11
- require 'mongoid-compatibility'
11
+ require 'mongoid/compatibility'
12
12
 
13
13
  require File.expand_path '../../lib/mongoid/slug', __FILE__
14
14
 
15
+ require 'mongoid-observers' unless Mongoid.const_defined?(:Observer)
16
+
15
17
  module Mongoid
16
18
  module Slug
17
19
  module UuidIdStrategy
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-slug
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Saebjoernsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-22 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongoid-compatibility
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: stringex
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec-its
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: awesome_print
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ! '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ! '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: uuid
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ! '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ! '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: pry
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ! '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
@@ -222,17 +222,17 @@ require_paths:
222
222
  - lib
223
223
  required_ruby_version: !ruby/object:Gem::Requirement
224
224
  requirements:
225
- - - ! '>='
225
+ - - ">="
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  required_rubygems_version: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ! '>='
230
+ - - ">="
231
231
  - !ruby/object:Gem::Version
232
232
  version: '0'
233
233
  requirements: []
234
234
  rubyforge_project: mongoid-slug
235
- rubygems_version: 2.4.5
235
+ rubygems_version: 2.4.8
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Mongoid URL slugs