Browse files

updated mongoid and small save bug

  • Loading branch information...
1 parent 5caf2e2 commit 3ce096f0098ae08e41d91c16e2e0c624e05361a9 @ryanong ryanong committed Oct 5, 2011
View
33 Gemfile
@@ -1,31 +1,4 @@
-source "http://rubygems.org"
-# Add dependencies required to use your gem here.
-# Example:
-# gem "activesupport", ">= 2.3.5"
+source 'http://rubygems.org'
-# Add dependencies to develop your gem here.
-# Include everything needed to run rake, tests, features, etc.
-gem 'mongoid'
-gem 'activesupport'
-
-group :development do
- gem "bson", '>= 1.3', :platforms => [:jruby] # for non jruby apps, require bson_ext in your Gemfile to boost performance
- gem "bson_ext", '>= 1.3', :platforms => [:mri]
- gem "rspec", "~> 2.3.0"
- gem "yard", "~> 0.6.0"
- gem "bundler"
- gem "jeweler", "~> 1.6.2"
- gem "rcov", ">= 0"
-end
-
-group :test, :development do
- gem 'linecache19'
- gem 'ruby-debug19'
-end
-
-group :test do
- gem 'rspec-rails'
- gem 'mocha'
- gem 'will_paginate'
- gem 'kaminari'
-end
+# Specify your gem's dependencies in mongoid_spacial.gemspec
+gemspec
View
2 README.md
@@ -148,7 +148,7 @@ Thanks
* Thanks to Kristian Mandrup for creating the base of the gem and a few of the tests
* Thanks to CarZen LLC. for letting me release the code we are using
-Contributing to mongoid_ranges
+Contributing to mongoid_spacial
-----------
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
View
44 Rakefile
@@ -1,42 +1,2 @@
-# encoding: utf-8
-
-require 'rubygems'
-require 'bundler'
-begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
-require 'rake'
-
-require 'jeweler'
-Jeweler::Tasks.new do |gem|
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
- gem.name = "mongoid_spacial"
- gem.homepage = "http://github.com/ryanong/mongoid_spacial"
- gem.license = "MIT"
- gem.summary = %Q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
- gem.description = %Q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
- gem.email = "ryanong@gmail.com"
- gem.authors = ["Ryan Ong"]
- # dependencies defined in Gemfile
-end
-Jeweler::RubygemsDotOrgTasks.new
-
-require 'rspec/core'
-require 'rspec/core/rake_task'
-RSpec::Core::RakeTask.new(:spec) do |spec|
- spec.pattern = FileList['spec/**/*_spec.rb']
-end
-
-RSpec::Core::RakeTask.new(:rcov) do |spec|
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
-end
-
-task :default => :spec
-
-require 'yard'
-YARD::Rake::YardocTask.new
+#!/usr/bin/env rake
+require "bundler/gem_tasks"
View
1 VERSION
@@ -1 +0,0 @@
-0.2.13
View
22 lib/mongoid_spacial/extentions/hash/criteria_helpers.rb
@@ -1,22 +0,0 @@
-# encoding: utf-8
-module Mongoid #:nodoc:
- module Extensions #:nodoc:
- module Hash #:nodoc:
- module CriteriaHelpers #:nodoc:
- def expand_complex_criteria
- hsh = {}
- each_pair do |k,v|
- if k.respond_to?(:key) && k.respond_to?(:to_mongo_query)
- hsh[k.key] ||= {}
- hsh[k.key].merge!(k.to_mongo_query(v))
- else
- hsh[k] = v
- end
- end
- hsh
- end
- end
- end
- end
-end
-
View
5 lib/mongoid_spacial/field_option.rb
@@ -23,14 +23,15 @@
define_method "#{field.name}=" do |arg|
if arg.kind_of?(Hash) && arg[lng_meth] && arg[lat_meth]
- arg = [arg[lng_meth], arg[lat_meth]]
+ arg = [arg[lng_meth].to_f, arg[lat_meth].to_f]
elsif arg.respond_to?(:to_lng_lat)
arg = arg.to_lng_lat
end
self[field.name]=arg
arg = [nil,nil] if arg.nil?
return arg[0..1] if options[:return_array]
- return h = {lng_meth => arg[0], lat_meth => arg[1]} if options[:class].blank?
+ h = {lng_meth => arg[0], lat_meth => arg[1]}
+ return h if options[:class].blank?
options[:class].new(h)
end
end
View
5 lib/mongoid_spacial/spacial/version.rb
@@ -0,0 +1,5 @@
+module Mongoid
+ module Spacial
+ VERSION = "0.2.14"
+ end
+end
View
189 mongoid_spacial.gemspec
@@ -1,177 +1,22 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/mongoid_spacial/spacial/version', __FILE__)
-Gem::Specification.new do |s|
- s.name = %q{mongoid_spacial}
- s.version = "0.2.13"
+Gem::Specification.new do |gem|
+ gem.authors = ["Ryan Ong"]
+ gem.email = ["ryanong@gmail.com"]
+ gem.description = %q{mongoid_spacial simplifies spacial calculations. Adds integration into mongoid so pagination and other function continue to work. It adds symbol extentions to simplify query creation.}
+ gem.summary = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
+ gem.homepage = "https://github.com/ryanong/mongoid_spacial"
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = [%q{Ryan Ong}]
- s.date = %q{2011-08-15}
- s.description = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
- s.email = %q{ryanong@gmail.com}
- s.extra_rdoc_files = [
- "LICENSE.txt",
- "README.md"
- ]
- s.files = [
- ".document",
- ".rspec",
- "Gemfile",
- "LICENSE.txt",
- "README.md",
- "Rakefile",
- "VERSION",
- "lib/mongoid_spacial.rb",
- "lib/mongoid_spacial/contexts/mongo.rb",
- "lib/mongoid_spacial/criteria.rb",
- "lib/mongoid_spacial/criterion.rb",
- "lib/mongoid_spacial/criterion/complex.rb",
- "lib/mongoid_spacial/criterion/inclusion.rb",
- "lib/mongoid_spacial/criterion/near_spacial.rb",
- "lib/mongoid_spacial/criterion/within_spacial.rb",
- "lib/mongoid_spacial/extentions/hash/criteria_helpers.rb",
- "lib/mongoid_spacial/extentions/symbol/inflections.rb",
- "lib/mongoid_spacial/field_option.rb",
- "lib/mongoid_spacial/finders.rb",
- "lib/mongoid_spacial/spacial.rb",
- "lib/mongoid_spacial/spacial/core_ext.rb",
- "lib/mongoid_spacial/spacial/document.rb",
- "lib/mongoid_spacial/spacial/formulas.rb",
- "lib/mongoid_spacial/spacial/geo_near_results.rb",
- "mongoid_spacial.gemspec",
- "spec/config/mongod.conf",
- "spec/config/mongoid.yml",
- "spec/functional/mongoid/contexts/mongo_spec.rb",
- "spec/functional/mongoid/criterion/inclusion_spec.rb",
- "spec/functional/mongoid/spacial/geo_near_results_spec.rb",
- "spec/functional/mongoid/spacial_spec.rb",
- "spec/models/account.rb",
- "spec/models/acolyte.rb",
- "spec/models/address.rb",
- "spec/models/address_component.rb",
- "spec/models/agent.rb",
- "spec/models/alert.rb",
- "spec/models/animal.rb",
- "spec/models/answer.rb",
- "spec/models/bar.rb",
- "spec/models/birthday.rb",
- "spec/models/book.rb",
- "spec/models/business.rb",
- "spec/models/callbacks.rb",
- "spec/models/category.rb",
- "spec/models/circus.rb",
- "spec/models/comment.rb",
- "spec/models/country_code.rb",
- "spec/models/description.rb",
- "spec/models/division.rb",
- "spec/models/drug.rb",
- "spec/models/employer.rb",
- "spec/models/entry.rb",
- "spec/models/event.rb",
- "spec/models/favorite.rb",
- "spec/models/fruits.rb",
- "spec/models/game.rb",
- "spec/models/ghost.rb",
- "spec/models/house.rb",
- "spec/models/inheritance.rb",
- "spec/models/league.rb",
- "spec/models/location.rb",
- "spec/models/login.rb",
- "spec/models/membership.rb",
- "spec/models/mixed_drink.rb",
- "spec/models/name.rb",
- "spec/models/namespacing.rb",
- "spec/models/observed.rb",
- "spec/models/override.rb",
- "spec/models/owner.rb",
- "spec/models/page.rb",
- "spec/models/page_question.rb",
- "spec/models/paranoid_post.rb",
- "spec/models/parents.rb",
- "spec/models/patient.rb",
- "spec/models/person.rb",
- "spec/models/pet.rb",
- "spec/models/pet_owner.rb",
- "spec/models/phone.rb",
- "spec/models/player.rb",
- "spec/models/post.rb",
- "spec/models/preference.rb",
- "spec/models/question.rb",
- "spec/models/quiz.rb",
- "spec/models/rating.rb",
- "spec/models/river.rb",
- "spec/models/role.rb",
- "spec/models/service.rb",
- "spec/models/shelf.rb",
- "spec/models/slave_address_numbers.rb",
- "spec/models/survey.rb",
- "spec/models/tag.rb",
- "spec/models/tracking_id_validation_history.rb",
- "spec/models/translation.rb",
- "spec/models/tree.rb",
- "spec/models/user.rb",
- "spec/models/user_account.rb",
- "spec/models/vet_visit.rb",
- "spec/models/video.rb",
- "spec/models/wiki_page.rb",
- "spec/spec_helper.rb",
- "spec/support/authentication.rb",
- "spec/unit/mongoid/criterion/complex_spec.rb",
- "spec/unit/mongoid/criterion/inclusion_spec.rb",
- "spec/unit/mongoid/criterion/near_spacial_spec.rb",
- "spec/unit/mongoid/criterion/within_spacial_spec.rb",
- "spec/unit/mongoid/spacial/formulas_spec.rb",
- "spec/unit/mongoid/spacial_spec.rb"
- ]
- s.homepage = %q{http://github.com/ryanong/mongoid_spacial}
- s.licenses = [%q{MIT}]
- s.require_paths = [%q{lib}]
- s.rubygems_version = %q{1.8.6}
- s.summary = %q{A Mongoid Extention that simplifies and adds support for MongoDB Geo Spacial Calculations.}
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ gem.files = `git ls-files`.split("\n")
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ gem.name = "mongoid_spacial"
+ gem.require_paths = ["lib"]
+ gem.version = Mongoid::Spacial::VERSION
- if s.respond_to? :specification_version then
- s.specification_version = 3
-
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<mongoid>, [">= 0"])
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
- s.add_development_dependency(%q<bson>, [">= 1.3"])
- s.add_development_dependency(%q<bson_ext>, [">= 1.3"])
- s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
- s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
- s.add_development_dependency(%q<bundler>, [">= 0"])
- s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
- s.add_development_dependency(%q<rcov>, [">= 0"])
- s.add_development_dependency(%q<linecache19>, [">= 0"])
- s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
- else
- s.add_dependency(%q<mongoid>, [">= 0"])
- s.add_dependency(%q<activesupport>, [">= 0"])
- s.add_dependency(%q<bson>, [">= 1.3"])
- s.add_dependency(%q<bson_ext>, [">= 1.3"])
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
- s.add_dependency(%q<bundler>, [">= 0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
- s.add_dependency(%q<rcov>, [">= 0"])
- s.add_dependency(%q<linecache19>, [">= 0"])
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
- end
- else
- s.add_dependency(%q<mongoid>, [">= 0"])
- s.add_dependency(%q<activesupport>, [">= 0"])
- s.add_dependency(%q<bson>, [">= 1.3"])
- s.add_dependency(%q<bson_ext>, [">= 1.3"])
- s.add_dependency(%q<rspec>, ["~> 2.3.0"])
- s.add_dependency(%q<yard>, ["~> 0.6.0"])
- s.add_dependency(%q<bundler>, [">= 0"])
- s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
- s.add_dependency(%q<rcov>, [">= 0"])
- s.add_dependency(%q<linecache19>, [">= 0"])
- s.add_dependency(%q<ruby-debug19>, [">= 0"])
- end
+ gem.add_dependency("mongoid", ['>= 2.3.0'])
+ gem.add_dependency('activesupport', ["~> 3.0"])
+ gem.add_development_dependency('yard', ["~>0.6.0"])
+ gem.add_development_dependency('rspec', ['~>2.3'])
end
-

0 comments on commit 3ce096f

Please sign in to comment.