delayed_job_shallow_mongoid 0.5.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2d1e8a25417131807e3bf934e40a4c6402421bdd
4
+ data.tar.gz: 146449f07f3583272b536739dae635c234bd7ce1
5
+ SHA512:
6
+ metadata.gz: a6579c531263a834df13274f8639fac2b5acd64ec67872dc6cc0e8b5a2857b20f6732ab93cec02cd3cb2f5cb4071c1341f9afa82e9674768ff0a3431543e466f
7
+ data.tar.gz: 5b4e0d6c08ddb79d2045678fb4a87732f1fd1435cdc855c82539a034922add7b3dda3abe24680120308f944777aaf1fe7077aa4a20eab9de8193c9791dd1e4f2
data/.travis.yml CHANGED
@@ -1,5 +1,16 @@
1
- language: ruby
2
1
  services: mongodb
2
+
3
+ language: ruby
4
+
5
+ cache: bundler
6
+
3
7
  rvm:
8
+ - 2.1.1
9
+ - 2.0.0
4
10
  - 1.9.3
11
+ - rbx-2
12
+ - jruby-19mode
5
13
 
14
+ env:
15
+ - MONGOID_VERSION=3
16
+ - MONGOID_VERSION=4
data/CHANGELOG.md CHANGED
@@ -1,11 +1,21 @@
1
- 0.5.1
2
- -----
1
+ 1.0.1 (2014-07-02)
2
+ ------------------
3
+
4
+ * Fixed missing file in .gemspec - [@dblock](http://github.com/dblock).
5
+
6
+ 1.0.0 (2014-07-01)
7
+ ------------------
8
+
9
+ * Fixed compatibility with Mongoid 4.x and DelayedJob 4.x - [@dblock](http://github.com/dblock).
10
+
11
+ 0.5.1 (2012-11-20)
12
+ ------------------
3
13
 
4
14
  * [#4](https://github.com/joeyAghion/delayed_job_shallow_mongoid/pull/4): Fix: `const_missing: uninitialized constant Delayed::DelayMail (NameError)` with Rails - [@dblock](http://github.com/dblock).
5
15
  * [#4](https://github.com/joeyAghion/delayed_job_shallow_mongoid/pull/4): Fix: do not run job when a Mongoid instance is not found within delayed_job arguments and `Mongoid.raise_not_found_error` is set to `false` - [@dblock](http://github.com/dblock).
6
16
 
7
- 0.5.0
8
- -----
17
+ 0.5.0 (2012-11-19)
18
+ ------------------
9
19
 
10
20
  * [#3](https://github.com/joeyAghion/delayed_job_shallow_mongoid/pull/3): Added Mongoid 3.x support - [@dblock](http://github.com/dblock).
11
21
 
data/Gemfile CHANGED
@@ -1,3 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ case version = ENV['MONGOID_VERSION'] || '~> 4.0'
6
+ when /4/
7
+ gem 'mongoid', '~> 4.0'
8
+ when /3/
9
+ gem 'mongoid', '~> 3.1'
10
+ else
11
+ gem 'mongoid', version
12
+ end
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  "LICENSE.txt",
16
16
  "README.md"
17
17
  ]
18
- s.files = [
18
+ s.files = Dir[
19
19
  ".document",
20
20
  ".travis.yml",
21
21
  "CHANGELOG.md",
@@ -24,12 +24,7 @@ Gem::Specification.new do |s|
24
24
  "README.md",
25
25
  "Rakefile",
26
26
  "delayed_job_shallow_mongoid.gemspec",
27
- "lib/delayed/shallow_mongoid.rb",
28
- "lib/delayed/shallow_mongoid/document_stub.rb",
29
- "lib/delayed/shallow_mongoid/performable_mailer.rb",
30
- "lib/delayed/shallow_mongoid/performable_method.rb",
31
- "lib/delayed/shallow_mongoid/version.rb",
32
- "lib/delayed_job_shallow_mongoid.rb"
27
+ 'lib/**/*'
33
28
  ]
34
29
  s.homepage = "http://github.com/joeyAghion/delayed_job_shallow_mongoid"
35
30
  s.licenses = ["MIT"]
@@ -37,13 +32,13 @@ Gem::Specification.new do |s|
37
32
  s.summary = "More efficient Mongoid document serialization for delayed_job."
38
33
 
39
34
  s.specification_version = 3
40
- s.add_runtime_dependency(%q<delayed_job>, ["~> 3.0"])
41
- s.add_runtime_dependency(%q<delayed_job_mongoid>, ["~> 2.0"])
42
- s.add_runtime_dependency(%q<mongoid>, ["~> 3.0"])
35
+ s.add_runtime_dependency(%q<delayed_job>, [">= 3.0"])
36
+ s.add_runtime_dependency(%q<delayed_job_mongoid>, [">= 2.0"])
37
+ s.add_runtime_dependency(%q<mongoid>, [">= 3.0"])
38
+ s.add_runtime_dependency(%q<activesupport>, [">= 3.2"])
43
39
  s.add_development_dependency(%q<actionmailer>, [">= 0"])
44
40
  s.add_development_dependency(%q<shoulda>, [">= 0"])
45
41
  s.add_development_dependency(%q<rake>, ["~> 10.0"])
46
- s.add_development_dependency(%q<rspec>, [">= 0"])
47
- s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
42
+ s.add_development_dependency(%q<rspec>, [">= 3.0"])
48
43
  end
49
44
 
@@ -10,14 +10,14 @@ module Delayed
10
10
  return arg unless arg.is_a?(::Mongoid::Document) && arg.persisted?
11
11
  return arg if arg._updates.any? && !Delayed::Worker.delay_jobs
12
12
  if arg.embedded?
13
- ShallowMongoid::DocumentStub.new(arg._root.class, arg._root._id.to_s, selector_from(arg))
13
+ Delayed::ShallowMongoid::DocumentStub.new(arg._root.class, arg._root._id.to_s, selector_from(arg))
14
14
  else
15
- ShallowMongoid::DocumentStub.new(arg.class, arg._id.to_s)
15
+ Delayed::ShallowMongoid::DocumentStub.new(arg.class, arg._id.to_s)
16
16
  end
17
17
  end
18
18
 
19
19
  def self.load(arg)
20
- return arg unless arg.is_a?(ShallowMongoid::DocumentStub)
20
+ return arg unless arg.is_a?(Delayed::ShallowMongoid::DocumentStub)
21
21
  begin
22
22
  result = arg.klass.find(arg.id)
23
23
  raise Delayed::ShallowMongoid::Errors::DocumentNotFound unless result
@@ -36,8 +36,8 @@ module Delayed
36
36
  def self.selector_from(doc)
37
37
  [].tap do |selector|
38
38
  while doc._parent do
39
- selector.unshift ['find', doc._id.to_s] if doc.metadata.macro == :embeds_many
40
- selector.unshift doc.metadata.key
39
+ selector.unshift ['find', doc._id.to_s] if Delayed::ShallowMongoid.metadata(doc).macro == :embeds_many
40
+ selector.unshift Delayed::ShallowMongoid.metadata(doc).key
41
41
  doc = doc._parent
42
42
  end
43
43
  end
@@ -1,10 +1,12 @@
1
- module Delayed::ShallowMongoid
2
- class DocumentStub < Struct.new(:klass, :id, :selector)
3
- def description
4
- "#{klass}[#{id}]".tap do |desc|
5
- desc << "." + selector.map{ |s|
6
- s.is_a?(Array) ? "#{s.first}(#{s[1..-1].map(&:inspect).join(', ')})" : s
7
- }.join(".") if selector && selector.any?
1
+ module Delayed
2
+ module ShallowMongoid
3
+ class DocumentStub < Struct.new(:klass, :id, :selector)
4
+ def description
5
+ "#{klass}[#{id}]".tap do |desc|
6
+ desc << "." + selector.map{ |s|
7
+ s.is_a?(Array) ? "#{s.first}(#{s[1..-1].map(&:inspect).join(', ')})" : s
8
+ }.join(".") if selector && selector.any?
9
+ end
8
10
  end
9
11
  end
10
12
  end
@@ -0,0 +1,15 @@
1
+ module Delayed
2
+ module ShallowMongoid
3
+ def self.mongoid3?
4
+ ::Mongoid.const_defined? :Observer # deprecated in Mongoid 4.x
5
+ end
6
+
7
+ def self.metadata instance
8
+ if Delayed::ShallowMongoid.mongoid3?
9
+ instance.metadata
10
+ else
11
+ instance.relation_metadata
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Delayed
2
2
  module ShallowMongoid
3
- VERSION = "0.5.1"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  require 'delayed_job'
2
- require File.dirname(__FILE__) + '/delayed/shallow_mongoid'
3
- require File.dirname(__FILE__) + '/delayed/shallow_mongoid/version'
4
- require File.dirname(__FILE__) + '/delayed/shallow_mongoid/document_stub'
5
- require File.dirname(__FILE__) + '/delayed/shallow_mongoid/performable_method'
6
- require File.dirname(__FILE__) + '/delayed/shallow_mongoid/performable_mailer'
2
+ require 'delayed/shallow_mongoid'
3
+ require 'delayed/shallow_mongoid/version'
4
+ require 'delayed/shallow_mongoid/mongoid'
5
+ require 'delayed/shallow_mongoid/document_stub'
6
+ require 'delayed/shallow_mongoid/performable_method'
7
+ require 'delayed/shallow_mongoid/performable_mailer'
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_shallow_mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
5
- prerelease:
4
+ version: 1.0.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joey Aghion
@@ -10,92 +9,95 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-11-20 00:00:00.000000000 Z
12
+ date: 2014-07-02 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: delayed_job
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ~>
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '3.0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ~>
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
27
  version: '3.0'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: delayed_job_mongoid
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ~>
32
+ - - '>='
37
33
  - !ruby/object:Gem::Version
38
34
  version: '2.0'
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ~>
39
+ - - '>='
45
40
  - !ruby/object:Gem::Version
46
41
  version: '2.0'
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: mongoid
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ~>
46
+ - - '>='
53
47
  - !ruby/object:Gem::Version
54
48
  version: '3.0'
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ~>
53
+ - - '>='
61
54
  - !ruby/object:Gem::Version
62
55
  version: '3.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: activesupport
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '3.2'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '3.2'
63
70
  - !ruby/object:Gem::Dependency
64
71
  name: actionmailer
65
72
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
73
  requirements:
68
- - - ! '>='
74
+ - - '>='
69
75
  - !ruby/object:Gem::Version
70
76
  version: '0'
71
77
  type: :development
72
78
  prerelease: false
73
79
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
80
  requirements:
76
- - - ! '>='
81
+ - - '>='
77
82
  - !ruby/object:Gem::Version
78
83
  version: '0'
79
84
  - !ruby/object:Gem::Dependency
80
85
  name: shoulda
81
86
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
87
  requirements:
84
- - - ! '>='
88
+ - - '>='
85
89
  - !ruby/object:Gem::Version
86
90
  version: '0'
87
91
  type: :development
88
92
  prerelease: false
89
93
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
94
  requirements:
92
- - - ! '>='
95
+ - - '>='
93
96
  - !ruby/object:Gem::Version
94
97
  version: '0'
95
98
  - !ruby/object:Gem::Dependency
96
99
  name: rake
97
100
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
101
  requirements:
100
102
  - - ~>
101
103
  - !ruby/object:Gem::Version
@@ -103,7 +105,6 @@ dependencies:
103
105
  type: :development
104
106
  prerelease: false
105
107
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
108
  requirements:
108
109
  - - ~>
109
110
  - !ruby/object:Gem::Version
@@ -111,35 +112,17 @@ dependencies:
111
112
  - !ruby/object:Gem::Dependency
112
113
  name: rspec
113
114
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
- requirements:
116
- - - ! '>='
117
- - !ruby/object:Gem::Version
118
- version: '0'
119
- type: :development
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
- requirements:
124
- - - ! '>='
125
- - !ruby/object:Gem::Version
126
- version: '0'
127
- - !ruby/object:Gem::Dependency
128
- name: ruby-debug19
129
- requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
- - - ! '>='
116
+ - - '>='
133
117
  - !ruby/object:Gem::Version
134
- version: '0'
118
+ version: '3.0'
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
- - - ! '>='
123
+ - - '>='
141
124
  - !ruby/object:Gem::Version
142
- version: '0'
125
+ version: '3.0'
143
126
  description: When the object or arg to a delayed_job is a Mongoid document, store
144
127
  only a small stub of the object instead of the full serialization.
145
128
  email: joey@aghion.com
@@ -157,40 +140,34 @@ files:
157
140
  - README.md
158
141
  - Rakefile
159
142
  - delayed_job_shallow_mongoid.gemspec
160
- - lib/delayed/shallow_mongoid.rb
161
143
  - lib/delayed/shallow_mongoid/document_stub.rb
144
+ - lib/delayed/shallow_mongoid/mongoid.rb
162
145
  - lib/delayed/shallow_mongoid/performable_mailer.rb
163
146
  - lib/delayed/shallow_mongoid/performable_method.rb
164
147
  - lib/delayed/shallow_mongoid/version.rb
148
+ - lib/delayed/shallow_mongoid.rb
165
149
  - lib/delayed_job_shallow_mongoid.rb
166
150
  homepage: http://github.com/joeyAghion/delayed_job_shallow_mongoid
167
151
  licenses:
168
152
  - MIT
153
+ metadata: {}
169
154
  post_install_message:
170
155
  rdoc_options: []
171
156
  require_paths:
172
157
  - lib
173
158
  required_ruby_version: !ruby/object:Gem::Requirement
174
- none: false
175
159
  requirements:
176
- - - ! '>='
160
+ - - '>='
177
161
  - !ruby/object:Gem::Version
178
162
  version: '0'
179
- segments:
180
- - 0
181
- hash: 480325997688566083
182
163
  required_rubygems_version: !ruby/object:Gem::Requirement
183
- none: false
184
164
  requirements:
185
- - - ! '>='
165
+ - - '>='
186
166
  - !ruby/object:Gem::Version
187
167
  version: '0'
188
- segments:
189
- - 0
190
- hash: 480325997688566083
191
168
  requirements: []
192
169
  rubyforge_project:
193
- rubygems_version: 1.8.24
170
+ rubygems_version: 2.0.14
194
171
  signing_key:
195
172
  specification_version: 3
196
173
  summary: More efficient Mongoid document serialization for delayed_job.