mongoid-paranoia 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc24c0ced97e7874f1ede67769d583404566c9d1
4
- data.tar.gz: 0de95f0da7e4629b174c6cd913f14d0253fd878c
3
+ metadata.gz: 930ec09266d04577e3f4eae158f5b8cb761d641b
4
+ data.tar.gz: e228ab1b67ca7e28b3248477d3cdd433b2538d22
5
5
  SHA512:
6
- metadata.gz: 4d8c7d26685e95732fd05d271448842213729afc0b5f7fc239be52272a84a8cc8dff643652365f27df8ad14af28b7e4264843fa374ca28b8cdf811e1a4e15b28
7
- data.tar.gz: 022abe0146a850af533e7233e8861ab3957603927e09e48754e7b42cd68db60e9dc05624ba43c2d3b59367f867bd0c4afeade4a4625191eb8f91ce3adc039ee9
6
+ metadata.gz: ae099b36c38bde44e23427a1a7c0fa538b992cec635a09a419a38ca91129981e6e9a1173d79310a14f0867942547b24e61309c254df4e60b3a2526c40d72ce55
7
+ data.tar.gz: 7fdb998bd8dce73c9e8f953a32125d9e4debe11cce5f4020bb5ec50bcbdbbc83daa98ba5982881f231ddf4162bfc3656684455612771ec4a92f1476b444227ce
data/.travis.yml CHANGED
@@ -5,14 +5,4 @@ rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
7
  - 2.1.0
8
-
9
- gemfile:
10
- - Gemfile
11
-
12
- branches:
13
- only:
14
- - master
15
-
16
- matrix:
17
- allow_failures:
18
- - rvm: ruby-head
8
+ - 2.2.0
data/README.md CHANGED
@@ -56,7 +56,7 @@ Person.deleted # Returns documents that have been "flagged" as deleted.
56
56
 
57
57
  (The MIT license)
58
58
 
59
- Copyright (c) 2013-2014 Mario Uher
59
+ Copyright (c) 2013-2015 Mario Uher
60
60
 
61
61
  Permission is hereby granted, free of charge, to any person obtaining
62
62
  a copy of this software and associated documentation files (the
@@ -50,12 +50,16 @@ module Mongoid
50
50
  #
51
51
  # @return [ true ] True.
52
52
  #
53
+ # @todo Remove Mongoid 4 support.
53
54
  # @since 1.0.0
54
55
  def remove_with_paranoia(options = {})
55
56
  cascade!
56
57
  time = self.deleted_at = Time.now
57
- paranoid_collection.find(atomic_selector).
58
- update({ "$set" => { paranoid_field => time }})
58
+ query = paranoid_collection.find(atomic_selector)
59
+ query.respond_to?(:update_one) ?
60
+ query.update_one({ "$set" => { paranoid_field => time }}) :
61
+ query.update({ "$set" => { paranoid_field => time }})
62
+
59
63
  @destroyed = true
60
64
  true
61
65
  end
@@ -99,10 +103,14 @@ module Mongoid
99
103
  #
100
104
  # @return [ Time ] The time the document had been deleted.
101
105
  #
106
+ # @todo Remove Mongoid 4 support.
102
107
  # @since 1.0.0
103
108
  def restore
104
- paranoid_collection.find(atomic_selector).
105
- update({ "$unset" => { paranoid_field => true }})
109
+ query = paranoid_collection.find(atomic_selector)
110
+ query.respond_to?(:update_one) ?
111
+ query.update_one({ "$unset" => { paranoid_field => true }}) :
112
+ query.update({ "$unset" => { paranoid_field => true }})
113
+
106
114
  attributes.delete("deleted_at")
107
115
  @destroyed = false
108
116
  true
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module Paranoia
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -13,9 +13,9 @@ Gem::Specification.new do |gem|
13
13
  gem.files = `git ls-files`.split("\n")
14
14
  gem.require_path = 'lib'
15
15
 
16
- gem.add_dependency 'activesupport'
17
- gem.add_dependency 'mongoid', '~> 4.0.0'
18
- gem.add_development_dependency 'mongoid-versioning', '1.0.0'
16
+ gem.add_dependency 'activesupport', '~> 4.0'
17
+ gem.add_dependency 'mongoid', '>= 4.0.0', '<= 5.0.0'
18
+ gem.add_development_dependency 'mongoid-versioning', '>= 1.1.0'
19
19
  gem.add_development_dependency 'rake'
20
20
  gem.add_development_dependency 'rspec', '~> 3'
21
21
  end
metadata CHANGED
@@ -1,57 +1,63 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-paranoia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Uher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.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
- version: '0'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongoid
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.0.0
34
+ - - "<="
35
+ - !ruby/object:Gem::Version
36
+ version: 5.0.0
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
38
- - - "~>"
41
+ - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: 4.0.0
44
+ - - "<="
45
+ - !ruby/object:Gem::Version
46
+ version: 5.0.0
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: mongoid-versioning
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '='
51
+ - - ">="
46
52
  - !ruby/object:Gem::Version
47
- version: 1.0.0
53
+ version: 1.1.0
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
51
57
  requirements:
52
- - - '='
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: 1.0.0
60
+ version: 1.1.0
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: rake
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -310,9 +316,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
310
316
  version: '0'
311
317
  requirements: []
312
318
  rubyforge_project:
313
- rubygems_version: 2.4.8
319
+ rubygems_version: 2.2.2
314
320
  signing_key:
315
321
  specification_version: 4
316
322
  summary: Extraction of mongoid-paranoia into its own gem.
317
323
  test_files: []
318
- has_rdoc: