mongoid_embedded_helper 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,15 @@
1
1
  source :gemcutter
2
2
 
3
- gem 'mongoid', '>= 2.0.2'
3
+ gem 'mongoid', '>= 2.0.1'
4
4
  gem "mongoid_adjust", '>= 0.1.1'
5
- gem 'bson_ext', '>= 1.0.1'
5
+ gem 'bson_ext', '>= 1.2'
6
6
 
7
7
  group :test do
8
8
  gem 'rspec', '>= 2.4.0'
9
9
  gem 'mocha'
10
+ gem "shoulda", ">= 0"
11
+ # gem "cutter", ">= 0"
12
+ gem "bundler", "~> 1.0.10"
13
+ gem "jeweler", "~> 1.6.4"
14
+ gem "rcov", ">= 0"
10
15
  end
data/Rakefile CHANGED
@@ -1,22 +1,55 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
2
12
  require 'rake'
3
13
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
7
17
  gem.name = "mongoid_embedded_helper"
8
18
  gem.summary = %Q{Facilitates performing queries on collections in embedded Mongoid documents}
9
19
  gem.description = %Q{Facilitates performing queries on collections in embedded Mongoid documents by performing query from the root node}
10
20
  gem.email = "kmandrup@gmail.com"
11
21
  gem.homepage = "http://github.com/kristianmandrup/mongoid_embedded_helper"
12
22
  gem.authors = ["Kristian Mandrup"]
13
- gem.add_dependency "mongoid", ">= 2.0.0.rc.7"
14
- gem.add_dependency "mongoid_adjust", ">= 0.1.1"
15
- gem.add_dependency "bson_ext", ">= 1.0.8"
16
-
17
- gem.add_development_dependency "rspec", ">= 2.4.0"
18
- end
19
- Jeweler::GemcutterTasks.new
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
23
+ # dependencies defined in Gemfile
24
+ end
25
+ Jeweler::RubygemsDotOrgTasks.new
26
+
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/test_*.rb'
31
+ test.verbose = true
32
+ end
33
+
34
+ require 'rcov/rcovtask'
35
+ Rcov::RcovTask.new do |test|
36
+ test.libs << 'test'
37
+ test.pattern = 'test/**/test_*.rb'
38
+ test.verbose = true
39
+ test.rcov_opts << '--exclude "gems/*"'
22
40
  end
41
+
42
+ task :default => :test
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
47
+
48
+ rdoc.rdoc_dir = 'rdoc'
49
+ rdoc.title = "mongoid_embedded_helper #{version}"
50
+ rdoc.rdoc_files.include('README*')
51
+ rdoc.rdoc_files.include('lib/**/*.rb')
52
+ end
53
+
54
+
55
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
@@ -2,51 +2,51 @@ require 'mongoid'
2
2
 
3
3
  module Mongoid
4
4
  module EmbeddedHelper
5
- def self.included(model)
6
- model.class_eval do
5
+ def self.included(model)
6
+ model.class_eval do
7
7
  alias_method :old_parentize, :parentize
8
8
  def parentize(document)
9
9
  old_parentize document
10
10
  send(:after_parentize) if respond_to?(:after_parentize)
11
- # run_callbacks(:after_parentize)
12
- end
11
+ # run_callbacks(:after_parentize)
12
+ end
13
13
  end
14
14
  end
15
-
15
+
16
16
  def in_collection stack = []
17
17
  stack.extend(ArrayExt) if stack.empty?
18
- if embedded?
18
+ if embedded?
19
19
  stack.add_collection_name self
20
20
  if _parent.respond_to?(:in_collection)
21
21
  _parent.in_collection(stack)
22
22
  else
23
23
  iterate_collection_stack stack, _parent
24
24
  end
25
- else
26
- return self.class if stack.empty?
25
+ else
26
+ return self.class if stack.empty?
27
27
  iterate_collection_stack stack
28
28
  end
29
29
  end
30
-
31
- private
32
-
30
+
31
+ private
32
+
33
33
  def iterate_collection_stack stack, subject = nil
34
34
  collection = subject || self
35
35
  stack = stack.reverse
36
36
  stack.each do |entry|
37
- sub_collection = collection.send entry[:collection_name]
38
- index = sub_collection.to_a.index(entry[:object]) if entry != stack.last
37
+ sub_collection = collection.send entry[:collection_name]
38
+ index = sub_collection.to_a.index(entry[:object]) if entry != stack.last
39
39
  collection = sub_collection[index] if index
40
40
  collection = sub_collection if !index
41
41
  end
42
42
  collection
43
43
  end
44
-
44
+
45
45
  module ArrayExt
46
46
  def add_collection_name obj
47
47
  self << {:collection_name => obj.collection_name, :object => obj}
48
- end
49
- end
48
+ end
49
+ end
50
50
  end
51
51
  end
52
52
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongoid_embedded_helper}
8
- s.version = "0.3.1"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
12
- s.date = %q{2011-06-24}
12
+ s.date = %q{2011-07-02}
13
13
  s.description = %q{Facilitates performing queries on collections in embedded Mongoid documents by performing query from the root node}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -42,20 +42,20 @@ Gem::Specification.new do |s|
42
42
  s.specification_version = 3
43
43
 
44
44
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_runtime_dependency(%q<mongoid>, [">= 2.0.2"])
45
+ s.add_runtime_dependency(%q<mongoid>, [">= 2.0.1"])
46
46
  s.add_runtime_dependency(%q<mongoid_adjust>, [">= 0.1.1"])
47
- s.add_runtime_dependency(%q<bson_ext>, [">= 1.0.1"])
48
- s.add_runtime_dependency(%q<mongoid>, [">= 2.0.0.rc.7"])
47
+ s.add_runtime_dependency(%q<bson>, [">= 1.2"])
48
+ s.add_runtime_dependency(%q<mongoid>, [">= 2.0.1"])
49
49
  s.add_runtime_dependency(%q<mongoid_adjust>, [">= 0.1.1"])
50
- s.add_runtime_dependency(%q<bson_ext>, [">= 1.0.8"])
50
+ s.add_runtime_dependency(%q<bson>, [">= 1.2"])
51
51
  s.add_development_dependency(%q<rspec>, [">= 2.4.0"])
52
52
  else
53
- s.add_dependency(%q<mongoid>, [">= 2.0.2"])
53
+ s.add_dependency(%q<mongoid>, [">= 2.0.1"])
54
54
  s.add_dependency(%q<mongoid_adjust>, [">= 0.1.1"])
55
- s.add_dependency(%q<bson_ext>, [">= 1.0.1"])
56
- s.add_dependency(%q<mongoid>, [">= 2.0.0.rc.7"])
55
+ s.add_dependency(%q<bson>, [">= 1.2"])
56
+ s.add_dependency(%q<mongoid>, [">= 2.0.1"])
57
57
  s.add_dependency(%q<mongoid_adjust>, [">= 0.1.1"])
58
- s.add_dependency(%q<bson_ext>, [">= 1.0.8"])
58
+ s.add_dependency(%q<bson>, [">= 1.2"])
59
59
  s.add_dependency(%q<rspec>, [">= 2.4.0"])
60
60
  end
61
61
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_embedded_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,23 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-24 00:00:00.000000000Z
12
+ date: 2011-07-02 00:00:00.000000000 +02:00
13
+ default_executable:
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: mongoid
16
- requirement: &2157044020 !ruby/object:Gem::Requirement
17
+ requirement: &2153238920 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
20
21
  - !ruby/object:Gem::Version
21
- version: 2.0.2
22
+ version: 2.0.1
22
23
  type: :runtime
23
24
  prerelease: false
24
- version_requirements: *2157044020
25
+ version_requirements: *2153238920
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: mongoid_adjust
27
- requirement: &2157043260 !ruby/object:Gem::Requirement
28
+ requirement: &2153238440 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ! '>='
@@ -32,32 +33,32 @@ dependencies:
32
33
  version: 0.1.1
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *2157043260
36
+ version_requirements: *2153238440
36
37
  - !ruby/object:Gem::Dependency
37
- name: bson_ext
38
- requirement: &2157042400 !ruby/object:Gem::Requirement
38
+ name: bson
39
+ requirement: &2153237940 !ruby/object:Gem::Requirement
39
40
  none: false
40
41
  requirements:
41
42
  - - ! '>='
42
43
  - !ruby/object:Gem::Version
43
- version: 1.0.1
44
+ version: '1.2'
44
45
  type: :runtime
45
46
  prerelease: false
46
- version_requirements: *2157042400
47
+ version_requirements: *2153237940
47
48
  - !ruby/object:Gem::Dependency
48
49
  name: mongoid
49
- requirement: &2157041640 !ruby/object:Gem::Requirement
50
+ requirement: &2153237420 !ruby/object:Gem::Requirement
50
51
  none: false
51
52
  requirements:
52
53
  - - ! '>='
53
54
  - !ruby/object:Gem::Version
54
- version: 2.0.0.rc.7
55
+ version: 2.0.1
55
56
  type: :runtime
56
57
  prerelease: false
57
- version_requirements: *2157041640
58
+ version_requirements: *2153237420
58
59
  - !ruby/object:Gem::Dependency
59
60
  name: mongoid_adjust
60
- requirement: &2157040800 !ruby/object:Gem::Requirement
61
+ requirement: &2153236940 !ruby/object:Gem::Requirement
61
62
  none: false
62
63
  requirements:
63
64
  - - ! '>='
@@ -65,21 +66,21 @@ dependencies:
65
66
  version: 0.1.1
66
67
  type: :runtime
67
68
  prerelease: false
68
- version_requirements: *2157040800
69
+ version_requirements: *2153236940
69
70
  - !ruby/object:Gem::Dependency
70
- name: bson_ext
71
- requirement: &2157040140 !ruby/object:Gem::Requirement
71
+ name: bson
72
+ requirement: &2153236420 !ruby/object:Gem::Requirement
72
73
  none: false
73
74
  requirements:
74
75
  - - ! '>='
75
76
  - !ruby/object:Gem::Version
76
- version: 1.0.8
77
+ version: '1.2'
77
78
  type: :runtime
78
79
  prerelease: false
79
- version_requirements: *2157040140
80
+ version_requirements: *2153236420
80
81
  - !ruby/object:Gem::Dependency
81
82
  name: rspec
82
- requirement: &2157039260 !ruby/object:Gem::Requirement
83
+ requirement: &2153235900 !ruby/object:Gem::Requirement
83
84
  none: false
84
85
  requirements:
85
86
  - - ! '>='
@@ -87,7 +88,7 @@ dependencies:
87
88
  version: 2.4.0
88
89
  type: :development
89
90
  prerelease: false
90
- version_requirements: *2157039260
91
+ version_requirements: *2153235900
91
92
  description: Facilitates performing queries on collections in embedded Mongoid documents
92
93
  by performing query from the root node
93
94
  email: kmandrup@gmail.com
@@ -112,6 +113,7 @@ files:
112
113
  - spec/mongoid/embedded_helper_spec.rb
113
114
  - spec/mongoid/more_embedded_helper_spec.rb
114
115
  - spec/spec_helper.rb
116
+ has_rdoc: true
115
117
  homepage: http://github.com/kristianmandrup/mongoid_embedded_helper
116
118
  licenses: []
117
119
  post_install_message:
@@ -132,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
134
  version: '0'
133
135
  requirements: []
134
136
  rubyforge_project:
135
- rubygems_version: 1.8.5
137
+ rubygems_version: 1.6.2
136
138
  signing_key:
137
139
  specification_version: 3
138
140
  summary: Facilitates performing queries on collections in embedded Mongoid documents