couch_potato 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ couch_potato_js_runner.js
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm 1.9.2@couch_potato
data/CHANGES.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Changes
2
2
 
3
+ ### 0.5.0
4
+ * time zone support (Time properties are now converted to current Time.zone)
5
+ * lazy property initialization (performance!)
6
+ * active_model is now the default validation framework
7
+
3
8
  ### 0.4.0
4
9
  * ruby 1.9.2 compatibility (langalex)
5
10
  * couch potato objects now behave correctly when used as keys in Hashes (langalex)
data/CREDITS ADDED
@@ -0,0 +1,6 @@
1
+ Parts of this are taken or inspired by Geoffrey Grosenbach's travel_app which is part of his CouchDB screencast.
2
+
3
+ Jan Lehnardt - got me started on doing this.
4
+ Brian Candler - contributed performance patches
5
+
6
+ see CHANGES.md for all the committers
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in couch_potato.gemspec
4
+ gemspec
data/README.md CHANGED
@@ -48,18 +48,13 @@ Or with authentication
48
48
 
49
49
  CouchPotato::Config.database_name = "http://username:password@example.com:5984/name_of_the_db"
50
50
 
51
- Optionally you can configure which framework you want to use for validations (either validatable or ActiveModel)
51
+ Optionally you can configure which framework you want to use for validations (either validatable or ActiveModel (default))
52
52
 
53
53
  CouchPotato::Config.validation_framework = :validatable | :active_model
54
54
 
55
55
  #### Using with Rails
56
56
 
57
- Add to your config/environment.rb:
58
-
59
- config.gem 'couch_potato', :source => 'http://gemcutter.org'
60
- config.frameworks -= [:active_record] # if you switch completely
61
-
62
- Then create a config/couchdb.yml:
57
+ Create a config/couchdb.yml:
63
58
 
64
59
  default: &default
65
60
  validation_framework: :active_model #optional
@@ -74,6 +69,24 @@ Then create a config/couchdb.yml:
74
69
  <<: *default
75
70
  database: <%= ENV['DB_NAME'] %>
76
71
 
72
+ #### Rails 2.x
73
+
74
+ Add to your _config/environment.rb_:
75
+
76
+ config.gem 'couch_potato', :source => 'http://gemcutter.org'
77
+ config.frameworks -= [:active_record] # if you switch completely
78
+
79
+ #### Rails 3.x
80
+
81
+ Add to your _Gemfile_:
82
+
83
+ # gem 'rails' # we don't want to load activerecord so we can't require rails
84
+ gem 'railties'
85
+ gem 'actionpack'
86
+ gem 'actionmailer'
87
+ gem 'activemodel'
88
+ gem "couch_potato"
89
+
77
90
  Note: please make sure that when you run `Date.today.as_json` in the Rails console it returns something like `2010/12/10` and not `2010-12-10` - if it does another gem has overwritten Couch Potato's Date patches - in this case move Couch Potato further down in your Gemfile or whereever you load it.
78
91
 
79
92
  ### Introduction
@@ -180,7 +193,7 @@ You can also force a dirty state:
180
193
 
181
194
  #### Object validations
182
195
 
183
- Couch Potato uses the validatable library for validation (http://validatable.rubyforge.org/)\
196
+ Couch Potato by default uses ActiveModel for validation
184
197
 
185
198
  class User
186
199
  property :name
@@ -189,7 +202,9 @@ Couch Potato uses the validatable library for validation (http://validatable.rub
189
202
 
190
203
  user = User.new
191
204
  user.valid? # => false
192
- user.errors.on(:name) # => [:name, 'can't be blank']
205
+ user.errors[:name] # => ['can't be blank']
206
+
207
+ If you want you can use [Validatable](http://validatable.rubyforge.org/) by setting `CouchPotato::Config.validation(http://validatable.rubyforge.org/)\_framework = :validatable`
193
208
 
194
209
  #### Finding stuff / views / lists
195
210
 
data/Rakefile ADDED
@@ -0,0 +1,82 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rake'
5
+ require "rspec/core/rake_task"
6
+ require 'rake/rdoctask'
7
+
8
+ def with_validatable(&block)
9
+ begin
10
+ require 'validatable'
11
+
12
+ ENV['VALIDATION_FRAMEWORK'] = 'validatable'
13
+ puts "Running task with Validatable validation framework."
14
+ yield block
15
+ rescue LoadError
16
+ STDERR.puts "WARNING: Validatable not available, skipping task."
17
+ end
18
+ end
19
+
20
+ def with_active_model(&block)
21
+ begin
22
+ require 'active_model'
23
+
24
+ ENV['VALIDATION_FRAMEWORK'] = 'active_model'
25
+ puts "Running task with ActiveModel validation framework."
26
+ yield block
27
+ rescue LoadError
28
+ STDERR.puts "WARNING: ActiveModel not available, skipping task."
29
+ end
30
+ end
31
+
32
+ task :default => :spec
33
+
34
+ task :spec_functional_validatable do
35
+ with_validatable { Rake::Task['spec_functional_default'].execute }
36
+ end
37
+
38
+ task :spec_functional_active_model do
39
+ with_active_model { Rake::Task['spec_functional_default'].execute }
40
+ end
41
+
42
+ task :spec_unit_validatable do
43
+ with_validatable { Rake::Task['spec_unit_default'].execute }
44
+ end
45
+
46
+ task :spec_unit_active_model do
47
+ with_active_model { Rake::Task['spec_unit_default'].execute }
48
+ end
49
+
50
+ desc "Run functional specs with default validation framework, override with VALIDATION_FRAMEWORK"
51
+ RSpec::Core::RakeTask.new(:spec_functional_default) do |spec|
52
+ spec.pattern = 'spec/*_spec.rb'
53
+ spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
54
+ end
55
+
56
+ desc "Run unit specs with default validation framework, override with VALIDATION_FRAMEWORK"
57
+ RSpec::Core::RakeTask.new(:spec_unit_default) do |spec|
58
+ spec.pattern = 'spec/unit/*_spec.rb'
59
+ spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
60
+ end
61
+
62
+ desc "Run functional specs with all validation frameworks"
63
+ task :spec_functional => [:spec_functional_validatable, :spec_functional_active_model] do
64
+ end
65
+
66
+ desc "Run unit specs with all validation frameworks"
67
+ task :spec_unit => [:spec_unit_validatable, :spec_unit_active_model] do
68
+ end
69
+
70
+ desc "Run all specs"
71
+ task :spec => [:spec_unit, :spec_functional] do
72
+ end
73
+
74
+ desc 'Generate documentation'
75
+ Rake::RDocTask.new(:rdoc) do |rdoc|
76
+ rdoc.rdoc_dir = 'rdoc'
77
+ rdoc.title = 'Couch Potato'
78
+ rdoc.options << '--line-numbers' << '--inline-source'
79
+ rdoc.rdoc_files.include('README.md')
80
+ rdoc.rdoc_files.include('lib/couch_potato.rb')
81
+ rdoc.rdoc_files.include('lib/couch_potato/**/*.rb')
82
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "couch_potato/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "couch_potato"
7
+ s.summary = %Q{Ruby persistence layer for CouchDB}
8
+ s.email = "alex@upstre.am"
9
+ s.homepage = "http://github.com/langalex/couch_potato"
10
+ s.description = "Ruby persistence layer for CouchDB"
11
+ s.authors = ["Alexander Lang"]
12
+ s.version = CouchPotato::VERSION
13
+ s.platform = Gem::Platform::RUBY
14
+
15
+ s.add_dependency 'json'
16
+ s.add_dependency 'couchrest', '>=1.0.1'
17
+ s.add_dependency 'activemodel'
18
+
19
+ s.add_development_dependency 'rspec', '>=2.0'
20
+ s.add_development_dependency 'timecop'
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+ end
data/lib/core_ext/time.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'active_support/time'
2
+
1
3
  class Time
2
4
  def to_json(*a)
3
5
  %("#{as_json}")
@@ -10,6 +12,12 @@ class Time
10
12
  def self.json_create string
11
13
  return nil if string.nil?
12
14
  d = DateTime.parse(string).new_offset
13
- self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec)
15
+ self.utc(d.year, d.month, d.day, d.hour, d.min, d.sec).in_time_zone
14
16
  end
15
17
  end
18
+
19
+ ActiveSupport::TimeWithZone.class_eval do
20
+ def as_json(*args)
21
+ utc.as_json
22
+ end
23
+ end
@@ -12,7 +12,6 @@ module CouchPotato
12
12
 
13
13
  def initialize(attributes = {})
14
14
  super
15
- # assign_attribute_copies_for_dirty_tracking
16
15
  end
17
16
 
18
17
  # returns true if a model has dirty attributes, i.e. their value has changed since the last save
@@ -1,20 +1,5 @@
1
1
  module CouchPotato
2
2
  module GhostAttributes #:nodoc:
3
- def self.included(base)
4
- base.class_eval do
5
- attr_accessor :_document
6
- def self.json_create_with_ghost(json)
7
- instance = json_create_without_ghost(json)
8
- instance._document = json if json
9
- instance
10
- end
11
-
12
- class << self
13
- alias_method_chain :json_create, :ghost
14
- end
15
- end
16
- end
17
-
18
3
  def method_missing(name, *args)
19
4
  if(value = _document && _document[name.to_s])
20
5
  value
@@ -2,7 +2,10 @@ module CouchPotato
2
2
  module Persistence
3
3
  module Json
4
4
  def self.included(base) #:nodoc:
5
- base.extend ClassMethods
5
+ base.class_eval do
6
+ extend ClassMethods
7
+ attr_accessor :_document
8
+ end
6
9
  end
7
10
 
8
11
  # returns a JSON representation of a model in order to store it in CouchDB
@@ -35,12 +38,7 @@ module CouchPotato
35
38
  instance = self.new
36
39
  instance._id = json[:_id] || json['_id']
37
40
  instance._rev = json[:_rev] || json['_rev']
38
- instance.instance_variable_set('@skip_dirty_tracking', true)
39
- properties.each do |property|
40
- property.build(instance, json)
41
- end
42
- instance.instance_variable_set('@skip_dirty_tracking', false)
43
- # instance.instance_variable_get("@changed_attributes").clear if instance.instance_variable_get("@changed_attributes")
41
+ instance._document = HashWithIndifferentAccess.new(json)
44
42
  instance
45
43
  end
46
44
  end
@@ -1,3 +1,5 @@
1
+ require 'active_support/time'
2
+
1
3
  module CouchPotato
2
4
  module MagicTimestamps #:nodoc:
3
5
  def self.included(base)
@@ -6,13 +8,13 @@ module CouchPotato
6
8
  property :updated_at, :type => Time
7
9
 
8
10
  before_create lambda {|model|
9
- model.created_at ||= Time.now
11
+ model.created_at ||= (Time.zone || Time).now
10
12
  @changed_attributes.delete 'created_at'
11
- model.updated_at ||= Time.now
13
+ model.updated_at ||= (Time.zone || Time).now
12
14
  @changed_attributes.delete 'updated_at'
13
15
  }
14
16
  before_update lambda {|model|
15
- model.updated_at = Time.now
17
+ model.updated_at = (Time.zone || Time).now
16
18
  @changed_attributes.delete 'updated_at'
17
19
  }
18
20
  end
@@ -1,5 +1,19 @@
1
1
  module CouchPotato
2
2
  module Persistence
3
+ module PropertyMethods
4
+ private
5
+
6
+ def load_attribute_from_document(name)
7
+ if (_document || {}).has_key?(name.to_s)
8
+ property = self.class.properties.find{|property| property.name == name}
9
+ @skip_dirty_tracking = true
10
+ value = property.build(self, _document)
11
+ @skip_dirty_tracking = false
12
+ value
13
+ end
14
+ end
15
+ end
16
+
3
17
  class SimpleProperty #:nodoc:
4
18
  attr_accessor :name, :type
5
19
 
@@ -7,6 +21,7 @@ module CouchPotato
7
21
  self.name = name
8
22
  self.type = options[:type]
9
23
  @type_caster = TypeCaster.new
24
+ owner_clazz.send :include, PropertyMethods unless owner_clazz.ancestors.include?(PropertyMethods)
10
25
 
11
26
  define_accessors accessors_module_for(owner_clazz), name, options
12
27
  end
@@ -37,8 +52,11 @@ module CouchPotato
37
52
 
38
53
  def define_accessors(base, name, options)
39
54
  base.class_eval do
55
+ include PropertyMethods
56
+
40
57
  define_method "#{name}" do
41
- value = self.instance_variable_get("@#{name}")
58
+ load_attribute_from_document(name) unless instance_variable_defined?("@#{name}")
59
+ value = instance_variable_get("@#{name}")
42
60
  if value.nil? && options[:default]
43
61
  default = clone_attribute(options[:default])
44
62
  self.instance_variable_set("@#{name}", default)
@@ -17,7 +17,7 @@ require 'couch_potato/rspec/matchers/map_to_matcher'
17
17
  require 'couch_potato/rspec/matchers/reduce_to_matcher'
18
18
  require 'couch_potato/rspec/matchers/list_as_matcher'
19
19
 
20
- module Spec
20
+ module RSpec
21
21
  module Matchers
22
22
  def map(document)
23
23
  CouchPotato::RSpec::MapToProxy.new(document)
@@ -14,7 +14,7 @@ module CouchPotato::RSpec
14
14
  end
15
15
 
16
16
  def and_return(return_value)
17
- view_stub = Spec::Mocks::Mock.new("#{@clazz}.#{@view}(#{@args.try(:join, ', ')}) view")
17
+ view_stub = RSpec::Mocks::Mock.new("#{@clazz}.#{@view}(#{@args.try(:join, ', ')}) view")
18
18
  _stub = @clazz.stub(@view)
19
19
  _stub.with(*@args) if @args
20
20
  _stub.and_return(view_stub)
@@ -37,7 +37,7 @@ module CouchPotato::RSpec
37
37
  end
38
38
  end
39
39
 
40
- module Spec
40
+ module RSpec
41
41
  module Mocks
42
42
  module ExampleMethods
43
43
  include CouchPotato::RSpec::StubDb
@@ -0,0 +1,3 @@
1
+ module CouchPotato
2
+ VERSION = "0.5.0"
3
+ end
data/lib/couch_potato.rb CHANGED
@@ -7,30 +7,28 @@ require 'ostruct'
7
7
 
8
8
  JSON.create_id = 'ruby_class'
9
9
 
10
- unless defined?(CouchPotato)
11
- module CouchPotato
12
- Config = Struct.new(:database_name, :validation_framework).new
13
- Config.validation_framework = :validatable # default to the validatable gem for validations
14
-
15
- # Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
16
- def self.database
17
- @@__database ||= Database.new(self.couchrest_database)
18
- end
10
+ module CouchPotato
11
+ Config = Struct.new(:database_name, :validation_framework).new
12
+ Config.validation_framework = :active_model
19
13
 
20
- # Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
21
- def self.couchrest_database
22
- @@__couchrest_database ||= CouchRest.database(full_url_to_database)
23
- end
14
+ # Returns a database instance which you can then use to create objects and query views. You have to set the CouchPotato::Config.database_name before this works.
15
+ def self.database
16
+ @@__database ||= Database.new(self.couchrest_database)
17
+ end
18
+
19
+ # Returns the underlying CouchRest database object if you want low level access to your CouchDB. You have to set the CouchPotato::Config.database_name before this works.
20
+ def self.couchrest_database
21
+ @@__couchrest_database ||= CouchRest.database(full_url_to_database)
22
+ end
24
23
 
25
- private
24
+ private
26
25
 
27
- def self.full_url_to_database
28
- raise('No Database configured. Set CouchPotato::Config.database_name') unless CouchPotato::Config.database_name
29
- if CouchPotato::Config.database_name.match(%r{https?://})
30
- CouchPotato::Config.database_name
31
- else
32
- "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
33
- end
26
+ def self.full_url_to_database
27
+ raise('No Database configured. Set CouchPotato::Config.database_name') unless CouchPotato::Config.database_name
28
+ if CouchPotato::Config.database_name.match(%r{https?://})
29
+ CouchPotato::Config.database_name
30
+ else
31
+ "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
34
32
  end
35
33
  end
36
34
  end
data/spec/create_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "create" do
4
- before(:all) do
4
+ before(:each) do
5
5
  recreate_db
6
6
  end
7
7
  describe "succeeds" do
@@ -23,6 +23,7 @@ describe "create" do
23
23
  CouchPotato.couchrest_database.get(@comment.id).updated_at.should == Time.parse('2010-01-02 12:34:48 +0000')
24
24
  end
25
25
  end
26
+
26
27
  describe "fails" do
27
28
  it "should not store anything" do
28
29
  @comment = Comment.new
data/spec/railtie_spec.rb CHANGED
@@ -10,7 +10,7 @@ module Rails
10
10
  end
11
11
 
12
12
  def self.root
13
- Spec::Mocks::Mock.new :join => ''
13
+ RSpec::Mocks::Mock.new :join => ''
14
14
  end
15
15
  end
16
16
 
data/spec/spec.opts CHANGED
@@ -1,4 +1,2 @@
1
1
  --colour
2
2
  --format progress
3
- --loadby mtime
4
- --reverse
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'rubygems'
2
- require 'spec'
2
+ require 'rspec'
3
3
  require 'time'
4
+ require 'active_support'
5
+ require 'timecop'
4
6
 
5
7
  $:.unshift(File.dirname(__FILE__) + '/../lib')
6
8
 
@@ -41,7 +43,7 @@ def recreate_db
41
43
  end
42
44
  recreate_db
43
45
 
44
- Spec::Matchers.define :string_matching do |regex|
46
+ RSpec::Matchers.define :string_matching do |regex|
45
47
  match do |string|
46
48
  string =~ regex
47
49
  end
@@ -4,24 +4,35 @@ describe "create" do
4
4
 
5
5
  describe "succeeds" do
6
6
  before(:each) do
7
- @comment = Comment.new :title => 'my_title'
8
- CouchPotato::Database.new(stub('database', :save_doc => {'rev' => '123', 'id' => '456'}, :info => nil)).save_document!(@comment)
7
+ Time.zone = nil
8
+ end
9
+
10
+ def create_comment
11
+ comment = Comment.new :title => 'my_title'
12
+ CouchPotato::Database.new(stub('database', :save_doc => {'rev' => '123', 'id' => '456'}, :info => nil)).save_document!(comment)
13
+ comment
9
14
  end
10
15
 
11
16
  it "should assign the id" do
12
- @comment._id.should == '456'
17
+ create_comment._id.should == '456'
13
18
  end
14
19
 
15
20
  it "should assign the revision" do
16
- @comment._rev.should == '123'
21
+ create_comment._rev.should == '123'
17
22
  end
18
23
 
19
- it "should set created at" do
20
- @comment.created_at.should >= Time.now - 10
24
+ it "should set created at in the current time zone" do
25
+ Time.zone = 'Europe/Berlin'
26
+ Timecop.travel 2010, 1, 1, 12 do
27
+ create_comment.created_at.to_s.should == '2010-01-01 12:00:00 +0100'
28
+ end
21
29
  end
22
30
 
23
- it "should set updated at" do
24
- @comment.updated_at.should >= Time.now - 10
31
+ it "should set updated at in the current time zone" do
32
+ Time.zone = 'Europe/Berlin'
33
+ Timecop.travel 2010, 1, 1, 12 do
34
+ create_comment.updated_at.to_s.should == '2010-01-01 12:00:00 +0100'
35
+ end
25
36
  end
26
37
  end
27
38
 
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  class DbTestUser
4
+ include CouchPotato::Persistence
4
5
  end
5
6
 
6
7
  # namespaced model
@@ -52,7 +53,7 @@ describe CouchPotato::Database, 'load' do
52
53
  end
53
54
 
54
55
  it "should set itself on the model" do
55
- user = mock 'user'
56
+ user = mock('user').as_null_object
56
57
  DbTestUser.stub!(:new).and_return(user)
57
58
  db = CouchPotato::Database.new(stub('couchrest db', :info => nil, :get => DbTestUser.json_create({JSON.create_id => 'DbTestUser'})))
58
59
  user.should_receive(:database=).with(db)
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ class Drink
4
+ include CouchPotato::Persistence
5
+
6
+ property :alcohol
7
+ end
8
+
9
+ describe CouchPotato::Persistence::Json do
10
+ context '#to_hash' do
11
+ it "should inject JSON.create_id into the hash representation of a persistent object" do
12
+ sake = Drink.new(:alcohol => "18%")
13
+ sake.to_hash[JSON.create_id].should eql("Drink")
14
+ end
15
+ end
16
+
17
+ context '.json_create' do
18
+ it 'should assign the _document' do
19
+ sake = Drink.json_create({"alcohol" => "18%"})
20
+ sake._document.should == {"alcohol" => "18%"}
21
+ end
22
+ end
23
+
24
+ end
@@ -10,7 +10,7 @@ end
10
10
  describe "stubbing the db" do
11
11
  it "should replace CouchPotato.database with a stub" do
12
12
  stub_db
13
- CouchPotato.database.should be_a(Spec::Mocks::Mock)
13
+ CouchPotato.database.should be_a(RSpec::Mocks::Mock)
14
14
  end
15
15
 
16
16
  it "should return the stub" do
@@ -26,7 +26,7 @@ describe "stubbing a view" do
26
26
  end
27
27
 
28
28
  it "should stub the view to return a stub" do
29
- WithStubbedView.stubbed_view('123').should be_a(Spec::Mocks::Mock)
29
+ WithStubbedView.stubbed_view('123').should be_a(RSpec::Mocks::Mock)
30
30
  end
31
31
 
32
32
  it "should stub the database to return fake results when called with the stub" do
@@ -13,10 +13,3 @@ describe Time, 'as_json' do
13
13
  time.as_json.should == "2009/01/01 09:12:23 +0000"
14
14
  end
15
15
  end
16
-
17
- describe Time, 'to_s' do
18
- it "should leave the original to_s untouched" do
19
- time = Time.parse('2009-01-01 10:12:23 +0100').getutc
20
- time.to_s.should include("09:12:23")
21
- end
22
- end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couch_potato
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 4
8
- - 0
9
- version: 0.4.0
4
+ prerelease:
5
+ version: 0.5.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Alexander Lang
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-12-10 00:00:00 +01:00
13
+ date: 2011-04-09 00:00:00 +02:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,8 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ">="
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
24
  version: "0"
31
25
  type: :runtime
32
26
  version_requirements: *id001
@@ -38,10 +32,6 @@ dependencies:
38
32
  requirements:
39
33
  - - ">="
40
34
  - !ruby/object:Gem::Version
41
- segments:
42
- - 1
43
- - 0
44
- - 1
45
35
  version: 1.0.1
46
36
  type: :runtime
47
37
  version_requirements: *id002
@@ -53,24 +43,49 @@ dependencies:
53
43
  requirements:
54
44
  - - ">="
55
45
  - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
46
  version: "0"
59
47
  type: :runtime
60
48
  version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: rspec
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "2.0"
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: timecop
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "0"
69
+ type: :development
70
+ version_requirements: *id005
61
71
  description: Ruby persistence layer for CouchDB
62
- email: alex@upstream-berlin.com
72
+ email: alex@upstre.am
63
73
  executables: []
64
74
 
65
75
  extensions: []
66
76
 
67
- extra_rdoc_files:
68
- - README.md
77
+ extra_rdoc_files: []
78
+
69
79
  files:
80
+ - .gitignore
81
+ - .rvmrc
70
82
  - CHANGES.md
83
+ - CREDITS
84
+ - Gemfile
71
85
  - MIT-LICENSE.txt
72
86
  - README.md
73
- - VERSION.yml
87
+ - Rakefile
88
+ - couch_potato.gemspec
74
89
  - init.rb
75
90
  - lib/core_ext/date.rb
76
91
  - lib/core_ext/object.rb
@@ -102,6 +117,7 @@ files:
102
117
  - lib/couch_potato/validation.rb
103
118
  - lib/couch_potato/validation/with_active_model.rb
104
119
  - lib/couch_potato/validation/with_validatable.rb
120
+ - lib/couch_potato/version.rb
105
121
  - lib/couch_potato/view/base_view_spec.rb
106
122
  - lib/couch_potato/view/custom_view_spec.rb
107
123
  - lib/couch_potato/view/custom_views.rb
@@ -136,7 +152,7 @@ files:
136
152
  - spec/unit/date_spec.rb
137
153
  - spec/unit/dirty_attributes_spec.rb
138
154
  - spec/unit/initialize_spec.rb
139
- - spec/unit/json_create_id_spec.rb
155
+ - spec/unit/json_spec.rb
140
156
  - spec/unit/lists_spec.rb
141
157
  - spec/unit/model_view_spec_spec.rb
142
158
  - spec/unit/properties_view_spec_spec.rb
@@ -153,8 +169,8 @@ homepage: http://github.com/langalex/couch_potato
153
169
  licenses: []
154
170
 
155
171
  post_install_message:
156
- rdoc_options:
157
- - --charset=UTF-8
172
+ rdoc_options: []
173
+
158
174
  require_paths:
159
175
  - lib
160
176
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -162,21 +178,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
178
  requirements:
163
179
  - - ">="
164
180
  - !ruby/object:Gem::Version
165
- segments:
166
- - 0
167
181
  version: "0"
168
182
  required_rubygems_version: !ruby/object:Gem::Requirement
169
183
  none: false
170
184
  requirements:
171
185
  - - ">="
172
186
  - !ruby/object:Gem::Version
173
- segments:
174
- - 0
175
187
  version: "0"
176
188
  requirements: []
177
189
 
178
190
  rubyforge_project:
179
- rubygems_version: 1.3.7
191
+ rubygems_version: 1.6.2
180
192
  signing_key:
181
193
  specification_version: 3
182
194
  summary: Ruby persistence layer for CouchDB
@@ -192,6 +204,7 @@ test_files:
192
204
  - spec/property_spec.rb
193
205
  - spec/rails_spec.rb
194
206
  - spec/railtie_spec.rb
207
+ - spec/spec.opts
195
208
  - spec/spec_helper.rb
196
209
  - spec/unit/active_model_compliance_spec.rb
197
210
  - spec/unit/attributes_spec.rb
@@ -204,7 +217,7 @@ test_files:
204
217
  - spec/unit/date_spec.rb
205
218
  - spec/unit/dirty_attributes_spec.rb
206
219
  - spec/unit/initialize_spec.rb
207
- - spec/unit/json_create_id_spec.rb
220
+ - spec/unit/json_spec.rb
208
221
  - spec/unit/lists_spec.rb
209
222
  - spec/unit/model_view_spec_spec.rb
210
223
  - spec/unit/properties_view_spec_spec.rb
data/VERSION.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 0
3
- :minor: 4
4
- :patch: 0
5
- :build:
@@ -1,14 +0,0 @@
1
- require 'spec_helper'
2
-
3
- class Drink
4
- include CouchPotato::Persistence
5
-
6
- property :alcohol
7
- end
8
-
9
- describe "json module" do
10
- it "should inject JSON.create_id into hash representation of a persistence object" do
11
- sake = Drink.new(:alcohol => "18%")
12
- sake.to_hash[JSON.create_id].should eql("Drink")
13
- end
14
- end