From 04ad16a39688fa388ea1ea40d0a9fbe997c14507 Mon Sep 17 00:00:00 2001 From: Lucas Renan Date: Wed, 10 Nov 2010 22:33:46 -0200 Subject: [PATCH 01/11] adding functionality to list properties with values --- .gitignore | 2 ++ lib/couchrest/model/properties.rb | 7 +++++++ spec/couchrest/property_spec.rb | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index 70d807f..c00c3ee 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ Gemfile* .rvmrc .bundle couchdb.std* +*.*~ + diff --git a/lib/couchrest/model/properties.rb b/lib/couchrest/model/properties.rb index 4f5701f..1a7506b 100644 --- a/lib/couchrest/model/properties.rb +++ b/lib/couchrest/model/properties.rb @@ -23,6 +23,12 @@ module CouchRest self.class.properties end + def properties_with_values + props = {} + properties.each { |property| props[property.name] = read_attribute(property.name) } + props + end + def apply_all_property_defaults return if self.respond_to?(:new?) && (new? == false) # TODO: cache the default object @@ -105,3 +111,4 @@ module CouchRest end end end + diff --git a/spec/couchrest/property_spec.rb b/spec/couchrest/property_spec.rb index 7e59be1..802d7b2 100644 --- a/spec/couchrest/property_spec.rb +++ b/spec/couchrest/property_spec.rb @@ -36,6 +36,11 @@ describe "Model properties" do @card.properties.map{|p| p.name}.should include("first_name") end + it "should list object properties with values" do + @card.properties_with_values.should be_an_instance_of(Hash) + @card.properties_with_values["first_name"].should == "matt" + end + it "should let you access a property value (getter)" do @card.first_name.should == "matt" end @@ -838,3 +843,4 @@ describe "Property Class" do end end + From 3a1b27155898181a0e864ec92b519086f532287e Mon Sep 17 00:00:00 2001 From: Lucas Renan Date: Fri, 31 Dec 2010 18:59:57 -0200 Subject: [PATCH 02/11] add method 'last' to simplify queries --- lib/couchrest/model/class_proxy.rb | 6 ++++++ lib/couchrest/model/document_queries.rb | 16 ++++++++++++++++ spec/couchrest/class_proxy_spec.rb | 6 ++++++ spec/couchrest/view_spec.rb | 6 ++++++ 4 files changed, 34 insertions(+) diff --git a/lib/couchrest/model/class_proxy.rb b/lib/couchrest/model/class_proxy.rb index 36200f9..3f988b1 100644 --- a/lib/couchrest/model/class_proxy.rb +++ b/lib/couchrest/model/class_proxy.rb @@ -75,6 +75,12 @@ module CouchRest doc end + def last(opts = {}) + doc = @klass.last({:database => @database}.merge(opts)) + doc.database = @database if doc && doc.respond_to?(:database) + doc + end + def get(id) doc = @klass.get(id, @database) doc.database = @database if doc && doc.respond_to?(:database) diff --git a/lib/couchrest/model/document_queries.rb b/lib/couchrest/model/document_queries.rb index 48ec485..575a675 100644 --- a/lib/couchrest/model/document_queries.rb +++ b/lib/couchrest/model/document_queries.rb @@ -38,6 +38,22 @@ module CouchRest first_instance.empty? ? nil : first_instance.first end + # Load the last document that have the model_type_key's field equal to + # the name of the current class. + # It's similar to method first, just adds :descending => true + # + # ==== Returns + # Object:: The last object instance available + # or + # Nil:: if no instances available + # + # ==== Parameters + # opts:: + # View options, see CouchRest::Database#view options for more info. + def last(opts = {}) + first(opts.merge!(:descending => true)) + end + # Load a document from the database by id # No exceptions will be raised if the document isn't found # diff --git a/spec/couchrest/class_proxy_spec.rb b/spec/couchrest/class_proxy_spec.rb index cba0e38..fc89533 100644 --- a/spec/couchrest/class_proxy_spec.rb +++ b/spec/couchrest/class_proxy_spec.rb @@ -87,6 +87,12 @@ describe "Proxy Class" do u = @us.first u.title.should =~ /\A...\z/ end + + it "should get last" do + u = @us.last + u.title.should == "aaa" + end + it "should set database on first retreived document" do u = @us.first u.database.should === DB diff --git a/spec/couchrest/view_spec.rb b/spec/couchrest/view_spec.rb index 5f1ec64..59ab062 100644 --- a/spec/couchrest/view_spec.rb +++ b/spec/couchrest/view_spec.rb @@ -273,6 +273,12 @@ describe "Model views" do u = Unattached.first :database=>@db u.title.should =~ /\A...\z/ end + + it "should get last" do + u = Unattached.last :database=>@db + u.title.should == "aaa" + end + it "should barf on all_design_doc_versions if no database given" do lambda{Unattached.all_design_doc_versions}.should raise_error end From 3fb14782a205360cabe30e7ec43a4418cf28c7e5 Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:30:43 -0500 Subject: [PATCH 03/11] Updated Rakefile to make it possible to cleanly install the gem with jeweler's "rake install": -- rspec 2.0.0 or greater now required (no one should be using the beta release anymore) -- activemodel and railties ~> 3.0.0 (no one should be using the beta releases anymore) -- remove 'require "couchrest_model"' dependency: -- version now read from jeweler default VERSION file. -- removing this requirement allows you to now run "rake install", to actually test out if the gem installs cleanly locally before doing any kind of push. --- Rakefile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index 3d5b68f..e37ba47 100644 --- a/Rakefile +++ b/Rakefile @@ -1,9 +1,6 @@ require 'rake' require "rake/rdoctask" - -$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) -require 'couchrest_model' - + begin require 'rspec' require 'rspec/core/rake_task' @@ -29,11 +26,10 @@ begin gemspec.has_rdoc = true gemspec.add_dependency("couchrest", "~> 1.0.1") gemspec.add_dependency("mime-types", "~> 1.15") - gemspec.add_dependency("activemodel", "~> 3.0.0.rc") + gemspec.add_dependency("activemodel", "~> 3.0.0") gemspec.add_dependency("tzinfo", "~> 0.3.22") - gemspec.add_dependency('railties', "~> 3.0.0.rc") - gemspec.add_development_dependency('rspec', '~> 2.0.0.beta.19') - gemspec.version = CouchRest::Model::VERSION + gemspec.add_dependency('railties', "~> 3.0.0") + gemspec.add_development_dependency('rspec', '>= 2.0.0') gemspec.date = Time.now.strftime("%Y-%m-%d") gemspec.require_path = "lib" end @@ -43,13 +39,13 @@ end desc "Run all specs" Rspec::Core::RakeTask.new(:spec) do |spec| - spec.spec_opts = ["--color"] + spec.rspec_opts = ["--color"] spec.pattern = 'spec/**/*_spec.rb' end desc "Print specdocs" Rspec::Core::RakeTask.new(:doc) do |spec| - spec.spec_opts = ["--format", "specdoc"] + spec.rspec_opts = ["--format", "specdoc"] spec.pattern = 'spec/*_spec.rb' end From 7f2f6c8eba660dcb04d429aaae6a8d47aac928aa Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:34:56 -0500 Subject: [PATCH 04/11] version bump. --- VERSION | 1 + lib/couchrest/model.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..2bf2d5f --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0.beta9 diff --git a/lib/couchrest/model.rb b/lib/couchrest/model.rb index b81387d..b55c54f 100644 --- a/lib/couchrest/model.rb +++ b/lib/couchrest/model.rb @@ -3,7 +3,7 @@ module CouchRest module Model - VERSION = "1.0.0.beta8" + VERSION = "1.0.0.beta9" end From f7fe57ddaf429e7206279f2d4ad90009a9f87938 Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:36:57 -0500 Subject: [PATCH 05/11] removed the "gem , ''" lines: -- These were not in sync with the gemspec requirements (which probably also explains the gem's uninstallable state), and duplicated that functionality anyways. --- lib/couchrest_model.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/couchrest_model.rb b/lib/couchrest_model.rb index 181bb9c..93f4754 100644 --- a/lib/couchrest_model.rb +++ b/lib/couchrest_model.rb @@ -1,15 +1,8 @@ -gem 'couchrest', ">= 1.0.0" require 'couchrest' -gem "tzinfo", ">= 0.3.22" - -gem 'railties', ">= 3.0.0.rc" -gem "activesupport", ">= 3.0.0.rc" - require 'active_support/core_ext' require 'active_support/json' -gem "activemodel", ">= 3.0.0.rc" require 'active_model' require "active_model/callbacks" require "active_model/conversion" @@ -21,7 +14,6 @@ require "active_model/translation" require "active_model/validator" require "active_model/validations" -gem "mime-types", ">= 1.15" require 'mime/types' require "enumerator" require "time" From 5330087ed2bcaaf533b7307054ac2cb499a58cac Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:47:58 -0500 Subject: [PATCH 06/11] gemspec updated via "rake gemspec" --- couchrest_model.gemspec | 230 ++++++++++++++++++++-------------------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/couchrest_model.gemspec b/couchrest_model.gemspec index bae1e33..f80ba94 100644 --- a/couchrest_model.gemspec +++ b/couchrest_model.gemspec @@ -1,131 +1,131 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{couchrest_model} - s.version = "1.0.0.beta8" + s.version = "1.0.0.beta9" s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"] - s.date = %q{2010-10-23} + s.date = %q{2011-01-16} s.description = %q{CouchRest Model provides aditional features to the standard CouchRest Document class such as properties, view designs, associations, callbacks, typecasting and validations.} s.email = %q{jchris@apache.org} s.extra_rdoc_files = [ "LICENSE", - "README.md", - "THANKS.md" + "README.md", + "THANKS.md" ] s.files = [ "LICENSE", - "README.md", - "Rakefile", - "THANKS.md", - "history.txt", - "lib/couchrest/model.rb", - "lib/couchrest/model/associations.rb", - "lib/couchrest/model/base.rb", - "lib/couchrest/model/callbacks.rb", - "lib/couchrest/model/casted_array.rb", - "lib/couchrest/model/casted_model.rb", - "lib/couchrest/model/class_proxy.rb", - "lib/couchrest/model/collection.rb", - "lib/couchrest/model/configuration.rb", - "lib/couchrest/model/design_doc.rb", - "lib/couchrest/model/document_queries.rb", - "lib/couchrest/model/errors.rb", - "lib/couchrest/model/extended_attachments.rb", - "lib/couchrest/model/persistence.rb", - "lib/couchrest/model/properties.rb", - "lib/couchrest/model/property.rb", - "lib/couchrest/model/property_protection.rb", - "lib/couchrest/model/support/couchrest.rb", - "lib/couchrest/model/support/hash.rb", - "lib/couchrest/model/typecast.rb", - "lib/couchrest/model/validations.rb", - "lib/couchrest/model/validations/casted_model.rb", - "lib/couchrest/model/validations/locale/en.yml", - "lib/couchrest/model/validations/uniqueness.rb", - "lib/couchrest/model/views.rb", - "lib/couchrest/railtie.rb", - "lib/couchrest_model.rb", - "lib/rails/generators/couchrest_model.rb", - "lib/rails/generators/couchrest_model/model/model_generator.rb", - "lib/rails/generators/couchrest_model/model/templates/model.rb", - "spec/couchrest/assocations_spec.rb", - "spec/couchrest/attachment_spec.rb", - "spec/couchrest/base_spec.rb", - "spec/couchrest/casted_model_spec.rb", - "spec/couchrest/casted_spec.rb", - "spec/couchrest/class_proxy_spec.rb", - "spec/couchrest/configuration_spec.rb", - "spec/couchrest/inherited_spec.rb", - "spec/couchrest/persistence_spec.rb", - "spec/couchrest/property_protection_spec.rb", - "spec/couchrest/property_spec.rb", - "spec/couchrest/subclass_spec.rb", - "spec/couchrest/validations.rb", - "spec/couchrest/view_spec.rb", - "spec/fixtures/attachments/README", - "spec/fixtures/attachments/couchdb.png", - "spec/fixtures/attachments/test.html", - "spec/fixtures/base.rb", - "spec/fixtures/more/article.rb", - "spec/fixtures/more/card.rb", - "spec/fixtures/more/cat.rb", - "spec/fixtures/more/client.rb", - "spec/fixtures/more/course.rb", - "spec/fixtures/more/event.rb", - "spec/fixtures/more/invoice.rb", - "spec/fixtures/more/person.rb", - "spec/fixtures/more/question.rb", - "spec/fixtures/more/sale_entry.rb", - "spec/fixtures/more/sale_invoice.rb", - "spec/fixtures/more/service.rb", - "spec/fixtures/more/user.rb", - "spec/fixtures/views/lib.js", - "spec/fixtures/views/test_view/lib.js", - "spec/fixtures/views/test_view/only-map.js", - "spec/fixtures/views/test_view/test-map.js", - "spec/fixtures/views/test_view/test-reduce.js", - "spec/spec_helper.rb" + "README.md", + "Rakefile", + "THANKS.md", + "history.txt", + "lib/couchrest/model.rb", + "lib/couchrest/model/associations.rb", + "lib/couchrest/model/base.rb", + "lib/couchrest/model/callbacks.rb", + "lib/couchrest/model/casted_array.rb", + "lib/couchrest/model/casted_model.rb", + "lib/couchrest/model/class_proxy.rb", + "lib/couchrest/model/collection.rb", + "lib/couchrest/model/configuration.rb", + "lib/couchrest/model/design_doc.rb", + "lib/couchrest/model/document_queries.rb", + "lib/couchrest/model/errors.rb", + "lib/couchrest/model/extended_attachments.rb", + "lib/couchrest/model/persistence.rb", + "lib/couchrest/model/properties.rb", + "lib/couchrest/model/property.rb", + "lib/couchrest/model/property_protection.rb", + "lib/couchrest/model/support/couchrest.rb", + "lib/couchrest/model/support/hash.rb", + "lib/couchrest/model/typecast.rb", + "lib/couchrest/model/validations.rb", + "lib/couchrest/model/validations/casted_model.rb", + "lib/couchrest/model/validations/locale/en.yml", + "lib/couchrest/model/validations/uniqueness.rb", + "lib/couchrest/model/view.rb", + "lib/couchrest/model/views.rb", + "lib/couchrest/railtie.rb", + "lib/couchrest_model.rb", + "lib/rails/generators/couchrest_model.rb", + "lib/rails/generators/couchrest_model/model/model_generator.rb", + "lib/rails/generators/couchrest_model/model/templates/model.rb", + "spec/couchrest/assocations_spec.rb", + "spec/couchrest/attachment_spec.rb", + "spec/couchrest/base_spec.rb", + "spec/couchrest/casted_model_spec.rb", + "spec/couchrest/casted_spec.rb", + "spec/couchrest/class_proxy_spec.rb", + "spec/couchrest/configuration_spec.rb", + "spec/couchrest/inherited_spec.rb", + "spec/couchrest/persistence_spec.rb", + "spec/couchrest/property_protection_spec.rb", + "spec/couchrest/property_spec.rb", + "spec/couchrest/subclass_spec.rb", + "spec/couchrest/validations.rb", + "spec/couchrest/view_spec.rb", + "spec/fixtures/attachments/README", + "spec/fixtures/attachments/couchdb.png", + "spec/fixtures/attachments/test.html", + "spec/fixtures/base.rb", + "spec/fixtures/more/article.rb", + "spec/fixtures/more/card.rb", + "spec/fixtures/more/cat.rb", + "spec/fixtures/more/client.rb", + "spec/fixtures/more/course.rb", + "spec/fixtures/more/event.rb", + "spec/fixtures/more/invoice.rb", + "spec/fixtures/more/person.rb", + "spec/fixtures/more/question.rb", + "spec/fixtures/more/sale_entry.rb", + "spec/fixtures/more/sale_invoice.rb", + "spec/fixtures/more/service.rb", + "spec/fixtures/more/user.rb", + "spec/fixtures/views/lib.js", + "spec/fixtures/views/test_view/lib.js", + "spec/fixtures/views/test_view/only-map.js", + "spec/fixtures/views/test_view/test-map.js", + "spec/fixtures/views/test_view/test-reduce.js", + "spec/spec_helper.rb" ] s.homepage = %q{http://github.com/couchrest/couchrest_model} - s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} s.summary = %q{Extends the CouchRest Document for advanced modelling.} s.test_files = [ - "spec/spec_helper.rb", - "spec/couchrest/configuration_spec.rb", - "spec/couchrest/property_spec.rb", - "spec/couchrest/property_protection_spec.rb", - "spec/couchrest/casted_spec.rb", - "spec/couchrest/subclass_spec.rb", - "spec/couchrest/persistence_spec.rb", - "spec/couchrest/casted_model_spec.rb", - "spec/couchrest/assocations_spec.rb", - "spec/couchrest/validations.rb", - "spec/couchrest/view_spec.rb", - "spec/couchrest/inherited_spec.rb", - "spec/couchrest/attachment_spec.rb", - "spec/couchrest/class_proxy_spec.rb", - "spec/couchrest/base_spec.rb", - "spec/fixtures/base.rb", - "spec/fixtures/more/card.rb", - "spec/fixtures/more/event.rb", - "spec/fixtures/more/user.rb", - "spec/fixtures/more/sale_invoice.rb", - "spec/fixtures/more/article.rb", - "spec/fixtures/more/service.rb", - "spec/fixtures/more/invoice.rb", - "spec/fixtures/more/person.rb", - "spec/fixtures/more/question.rb", - "spec/fixtures/more/cat.rb", - "spec/fixtures/more/client.rb", - "spec/fixtures/more/sale_entry.rb", - "spec/fixtures/more/course.rb" + "spec/couchrest/assocations_spec.rb", + "spec/couchrest/attachment_spec.rb", + "spec/couchrest/base_spec.rb", + "spec/couchrest/casted_model_spec.rb", + "spec/couchrest/casted_spec.rb", + "spec/couchrest/class_proxy_spec.rb", + "spec/couchrest/configuration_spec.rb", + "spec/couchrest/inherited_spec.rb", + "spec/couchrest/persistence_spec.rb", + "spec/couchrest/property_protection_spec.rb", + "spec/couchrest/property_spec.rb", + "spec/couchrest/subclass_spec.rb", + "spec/couchrest/validations.rb", + "spec/couchrest/view_spec.rb", + "spec/fixtures/base.rb", + "spec/fixtures/more/article.rb", + "spec/fixtures/more/card.rb", + "spec/fixtures/more/cat.rb", + "spec/fixtures/more/client.rb", + "spec/fixtures/more/course.rb", + "spec/fixtures/more/event.rb", + "spec/fixtures/more/invoice.rb", + "spec/fixtures/more/person.rb", + "spec/fixtures/more/question.rb", + "spec/fixtures/more/sale_entry.rb", + "spec/fixtures/more/sale_invoice.rb", + "spec/fixtures/more/service.rb", + "spec/fixtures/more/user.rb", + "spec/spec_helper.rb" ] if s.respond_to? :specification_version then @@ -135,25 +135,25 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q, ["~> 1.0.1"]) s.add_runtime_dependency(%q, ["~> 1.15"]) - s.add_runtime_dependency(%q, ["~> 3.0.0.rc"]) + s.add_runtime_dependency(%q, ["~> 3.0.0"]) s.add_runtime_dependency(%q, ["~> 0.3.22"]) - s.add_runtime_dependency(%q, ["~> 3.0.0.rc"]) - s.add_development_dependency(%q, ["~> 2.0.0.beta.19"]) + s.add_runtime_dependency(%q, ["~> 3.0.0"]) + s.add_development_dependency(%q, [">= 2.0.0"]) else s.add_dependency(%q, ["~> 1.0.1"]) s.add_dependency(%q, ["~> 1.15"]) - s.add_dependency(%q, ["~> 3.0.0.rc"]) + s.add_dependency(%q, ["~> 3.0.0"]) s.add_dependency(%q, ["~> 0.3.22"]) - s.add_dependency(%q, ["~> 3.0.0.rc"]) - s.add_dependency(%q, ["~> 2.0.0.beta.19"]) + s.add_dependency(%q, ["~> 3.0.0"]) + s.add_dependency(%q, [">= 2.0.0"]) end else s.add_dependency(%q, ["~> 1.0.1"]) s.add_dependency(%q, ["~> 1.15"]) - s.add_dependency(%q, ["~> 3.0.0.rc"]) + s.add_dependency(%q, ["~> 3.0.0"]) s.add_dependency(%q, ["~> 0.3.22"]) - s.add_dependency(%q, ["~> 3.0.0.rc"]) - s.add_dependency(%q, ["~> 2.0.0.beta.19"]) + s.add_dependency(%q, ["~> 3.0.0"]) + s.add_dependency(%q, [">= 2.0.0"]) end end From cfdd3e7bfd78e138c303432a58d58a6db542f85f Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:57:26 -0500 Subject: [PATCH 07/11] set the CouchRest::Model::VERSION constant to the value of the VERSION file --- lib/couchrest/model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/couchrest/model.rb b/lib/couchrest/model.rb index b55c54f..693b3e3 100644 --- a/lib/couchrest/model.rb +++ b/lib/couchrest/model.rb @@ -3,7 +3,7 @@ module CouchRest module Model - VERSION = "1.0.0.beta9" + VERSION = File.read(File.expand_path('../../../VERSION', __FILE__)).strip end From 35286379ce755de0190131c5620ea5d9c353b064 Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 13:58:21 -0500 Subject: [PATCH 08/11] add the VERSION file to the gem --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index e37ba47..d14a28f 100644 --- a/Rakefile +++ b/Rakefile @@ -22,7 +22,7 @@ begin gemspec.homepage = "http://github.com/couchrest/couchrest_model" gemspec.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"] gemspec.extra_rdoc_files = %w( README.md LICENSE THANKS.md ) - gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec}/**/*"] - Dir["spec/tmp"] + gemspec.files = %w( VERSION LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec}/**/*"] - Dir["spec/tmp"] gemspec.has_rdoc = true gemspec.add_dependency("couchrest", "~> 1.0.1") gemspec.add_dependency("mime-types", "~> 1.15") From 534d29684c31788657c34a399cc368779a6df9d8 Mon Sep 17 00:00:00 2001 From: Matt Parker Date: Sun, 16 Jan 2011 14:01:48 -0500 Subject: [PATCH 09/11] updated gemspec via "rake gemspec" --- couchrest_model.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/couchrest_model.gemspec b/couchrest_model.gemspec index f80ba94..dfa0335 100644 --- a/couchrest_model.gemspec +++ b/couchrest_model.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |s| "README.md", "Rakefile", "THANKS.md", + "VERSION", "history.txt", "lib/couchrest/model.rb", "lib/couchrest/model/associations.rb", From b0b9add34dbc1c4ce9ff677e0cb9d105ac39a0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Tapaj=C3=B3s?= Date: Sun, 16 Jan 2011 22:43:07 -0200 Subject: [PATCH 10/11] Using bundler --- Rakefile | 28 +------- couchrest_model.gemspec | 153 ++++------------------------------------ spec/spec_helper.rb | 1 + 3 files changed, 18 insertions(+), 164 deletions(-) diff --git a/Rakefile b/Rakefile index d14a28f..d4abc8a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,6 @@ +require 'bundler' +Bundler::GemHelper.install_tasks + require 'rake' require "rake/rdoctask" @@ -12,31 +15,6 @@ EOS exit(0) end -begin - require 'jeweler' - Jeweler::Tasks.new do |gemspec| - gemspec.name = "couchrest_model" - gemspec.summary = "Extends the CouchRest Document for advanced modelling." - gemspec.description = "CouchRest Model provides aditional features to the standard CouchRest Document class such as properties, view designs, associations, callbacks, typecasting and validations." - gemspec.email = "jchris@apache.org" - gemspec.homepage = "http://github.com/couchrest/couchrest_model" - gemspec.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"] - gemspec.extra_rdoc_files = %w( README.md LICENSE THANKS.md ) - gemspec.files = %w( VERSION LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec}/**/*"] - Dir["spec/tmp"] - gemspec.has_rdoc = true - gemspec.add_dependency("couchrest", "~> 1.0.1") - gemspec.add_dependency("mime-types", "~> 1.15") - gemspec.add_dependency("activemodel", "~> 3.0.0") - gemspec.add_dependency("tzinfo", "~> 0.3.22") - gemspec.add_dependency('railties', "~> 3.0.0") - gemspec.add_development_dependency('rspec', '>= 2.0.0') - gemspec.date = Time.now.strftime("%Y-%m-%d") - gemspec.require_path = "lib" - end -rescue LoadError - puts "Jeweler not available. Install it with: gem install jeweler" -end - desc "Run all specs" Rspec::Core::RakeTask.new(:spec) do |spec| spec.rspec_opts = ["--color"] diff --git a/couchrest_model.gemspec b/couchrest_model.gemspec index dfa0335..b117cec 100644 --- a/couchrest_model.gemspec +++ b/couchrest_model.gemspec @@ -1,6 +1,3 @@ -# Generated by jeweler -# DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| @@ -17,144 +14,22 @@ Gem::Specification.new do |s| "README.md", "THANKS.md" ] - s.files = [ - "LICENSE", - "README.md", - "Rakefile", - "THANKS.md", - "VERSION", - "history.txt", - "lib/couchrest/model.rb", - "lib/couchrest/model/associations.rb", - "lib/couchrest/model/base.rb", - "lib/couchrest/model/callbacks.rb", - "lib/couchrest/model/casted_array.rb", - "lib/couchrest/model/casted_model.rb", - "lib/couchrest/model/class_proxy.rb", - "lib/couchrest/model/collection.rb", - "lib/couchrest/model/configuration.rb", - "lib/couchrest/model/design_doc.rb", - "lib/couchrest/model/document_queries.rb", - "lib/couchrest/model/errors.rb", - "lib/couchrest/model/extended_attachments.rb", - "lib/couchrest/model/persistence.rb", - "lib/couchrest/model/properties.rb", - "lib/couchrest/model/property.rb", - "lib/couchrest/model/property_protection.rb", - "lib/couchrest/model/support/couchrest.rb", - "lib/couchrest/model/support/hash.rb", - "lib/couchrest/model/typecast.rb", - "lib/couchrest/model/validations.rb", - "lib/couchrest/model/validations/casted_model.rb", - "lib/couchrest/model/validations/locale/en.yml", - "lib/couchrest/model/validations/uniqueness.rb", - "lib/couchrest/model/view.rb", - "lib/couchrest/model/views.rb", - "lib/couchrest/railtie.rb", - "lib/couchrest_model.rb", - "lib/rails/generators/couchrest_model.rb", - "lib/rails/generators/couchrest_model/model/model_generator.rb", - "lib/rails/generators/couchrest_model/model/templates/model.rb", - "spec/couchrest/assocations_spec.rb", - "spec/couchrest/attachment_spec.rb", - "spec/couchrest/base_spec.rb", - "spec/couchrest/casted_model_spec.rb", - "spec/couchrest/casted_spec.rb", - "spec/couchrest/class_proxy_spec.rb", - "spec/couchrest/configuration_spec.rb", - "spec/couchrest/inherited_spec.rb", - "spec/couchrest/persistence_spec.rb", - "spec/couchrest/property_protection_spec.rb", - "spec/couchrest/property_spec.rb", - "spec/couchrest/subclass_spec.rb", - "spec/couchrest/validations.rb", - "spec/couchrest/view_spec.rb", - "spec/fixtures/attachments/README", - "spec/fixtures/attachments/couchdb.png", - "spec/fixtures/attachments/test.html", - "spec/fixtures/base.rb", - "spec/fixtures/more/article.rb", - "spec/fixtures/more/card.rb", - "spec/fixtures/more/cat.rb", - "spec/fixtures/more/client.rb", - "spec/fixtures/more/course.rb", - "spec/fixtures/more/event.rb", - "spec/fixtures/more/invoice.rb", - "spec/fixtures/more/person.rb", - "spec/fixtures/more/question.rb", - "spec/fixtures/more/sale_entry.rb", - "spec/fixtures/more/sale_invoice.rb", - "spec/fixtures/more/service.rb", - "spec/fixtures/more/user.rb", - "spec/fixtures/views/lib.js", - "spec/fixtures/views/test_view/lib.js", - "spec/fixtures/views/test_view/only-map.js", - "spec/fixtures/views/test_view/test-map.js", - "spec/fixtures/views/test_view/test-reduce.js", - "spec/spec_helper.rb" - ] s.homepage = %q{http://github.com/couchrest/couchrest_model} - s.require_paths = ["lib"] s.rubygems_version = %q{1.3.7} s.summary = %q{Extends the CouchRest Document for advanced modelling.} - s.test_files = [ - "spec/couchrest/assocations_spec.rb", - "spec/couchrest/attachment_spec.rb", - "spec/couchrest/base_spec.rb", - "spec/couchrest/casted_model_spec.rb", - "spec/couchrest/casted_spec.rb", - "spec/couchrest/class_proxy_spec.rb", - "spec/couchrest/configuration_spec.rb", - "spec/couchrest/inherited_spec.rb", - "spec/couchrest/persistence_spec.rb", - "spec/couchrest/property_protection_spec.rb", - "spec/couchrest/property_spec.rb", - "spec/couchrest/subclass_spec.rb", - "spec/couchrest/validations.rb", - "spec/couchrest/view_spec.rb", - "spec/fixtures/base.rb", - "spec/fixtures/more/article.rb", - "spec/fixtures/more/card.rb", - "spec/fixtures/more/cat.rb", - "spec/fixtures/more/client.rb", - "spec/fixtures/more/course.rb", - "spec/fixtures/more/event.rb", - "spec/fixtures/more/invoice.rb", - "spec/fixtures/more/person.rb", - "spec/fixtures/more/question.rb", - "spec/fixtures/more/sale_entry.rb", - "spec/fixtures/more/sale_invoice.rb", - "spec/fixtures/more/service.rb", - "spec/fixtures/more/user.rb", - "spec/spec_helper.rb" - ] - - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 3 - - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 1.0.1"]) - s.add_runtime_dependency(%q, ["~> 1.15"]) - s.add_runtime_dependency(%q, ["~> 3.0.0"]) - s.add_runtime_dependency(%q, ["~> 0.3.22"]) - s.add_runtime_dependency(%q, ["~> 3.0.0"]) - s.add_development_dependency(%q, [">= 2.0.0"]) - else - s.add_dependency(%q, ["~> 1.0.1"]) - s.add_dependency(%q, ["~> 1.15"]) - s.add_dependency(%q, ["~> 3.0.0"]) - s.add_dependency(%q, ["~> 0.3.22"]) - s.add_dependency(%q, ["~> 3.0.0"]) - s.add_dependency(%q, [">= 2.0.0"]) - end - else - s.add_dependency(%q, ["~> 1.0.1"]) - s.add_dependency(%q, ["~> 1.15"]) - s.add_dependency(%q, ["~> 3.0.0"]) - s.add_dependency(%q, ["~> 0.3.22"]) - s.add_dependency(%q, ["~> 3.0.0"]) - s.add_dependency(%q, [">= 2.0.0"]) - end + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] + + s.add_dependency(%q, "~> 1.0.1") + s.add_dependency(%q, "~> 1.15") + s.add_dependency(%q, "~> 3.0.0") + s.add_dependency(%q, "~> 0.3.22") + s.add_dependency(%q, "~> 3.0.0") + s.add_dependency(%q, ">= 2.0.0") + s.add_development_dependency(%q, ">= 2.0.0") + s.add_development_dependency(%q, ">= 0.5.7") end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fdcadba..3a865b5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +require "bundler/setup" require "rubygems" require "rspec" # Satisfies Autotest and anyone else not using the Rake tasks From 5c6e807c5b05c182a7e338d43be602119a300d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Tapaj=C3=B3s?= Date: Sun, 16 Jan 2011 22:48:31 -0200 Subject: [PATCH 11/11] Remove from beta --- VERSION | 2 +- couchrest_model.gemspec | 2 +- history.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 2bf2d5f..3eefcb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0.beta9 +1.0.0 diff --git a/couchrest_model.gemspec b/couchrest_model.gemspec index b117cec..c27e6e1 100644 --- a/couchrest_model.gemspec +++ b/couchrest_model.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{couchrest_model} - s.version = "1.0.0.beta9" + s.version = "1.0.0" s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"] diff --git a/history.txt b/history.txt index 4f06656..dac561a 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,4 @@ -== Next Version +== CouchRest Model 1.0.0 * Major enhancements * Support for configuration module and "model_type_key" option for overriding model's type key