Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use bundler instead of jeweler to manage gem

  • Loading branch information...
commit d4f9a4d2701db1e5aaddfe462c29602e82516346 1 parent 150ac7f
anna authored
View
6 .gitignore
@@ -1,3 +1,5 @@
+*.gem
+.bundle
+Gemfile.lock
+pkg/*
couch_potato_js_runner.js
-pkg
-.rvmrc
View
1  .rvmrc
@@ -0,0 +1 @@
+rvm 1.9.2@couch_potato
View
4 Gemfile
@@ -0,0 +1,4 @@
+source "http://rubygems.org"
+
+# Specify your gem's dependencies in couch_potato.gemspec
+gemspec
View
36 Rakefile
@@ -1,5 +1,8 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
+
require 'rake'
-require 'spec/rake/spectask'
+require "rspec/core/rake_task"
require 'rake/rdoctask'
def with_validatable(&block)
@@ -45,15 +48,15 @@ task :spec_unit_active_model do
end
desc "Run functional specs with default validation framework, override with VALIDATION_FRAMEWORK"
-Spec::Rake::SpecTask.new(:spec_functional_default) do |t|
- t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
- t.spec_files = FileList['spec/*_spec.rb']
+RSpec::Core::RakeTask.new(:spec_functional_default) do |spec|
+ spec.pattern = 'spec/*_spec.rb'
+ spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
end
desc "Run unit specs with default validation framework, override with VALIDATION_FRAMEWORK"
-Spec::Rake::SpecTask.new(:spec_unit_default) do |t|
- t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
- t.spec_files = FileList['spec/unit/*_spec.rb']
+RSpec::Core::RakeTask.new(:spec_unit_default) do |spec|
+ spec.pattern = 'spec/unit/*_spec.rb'
+ spec.rspec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
end
desc "Run functional specs with all validation frameworks"
@@ -77,22 +80,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/couch_potato.rb')
rdoc.rdoc_files.include('lib/couch_potato/**/*.rb')
end
-
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |s|
- s.name = "couch_potato"
- s.summary = %Q{Ruby persistence layer for CouchDB}
- s.email = "alex@upstream-berlin.com"
- s.homepage = "http://github.com/langalex/couch_potato"
- s.description = "Ruby persistence layer for CouchDB"
- s.authors = ["Alexander Lang"]
- s.files = FileList["[A-Z]*.*", "{lib,spec,rails}/**/*", "init.rb"]
- s.add_dependency 'json'
- s.add_dependency 'couchrest', '>=1.0.1'
- s.add_dependency 'activemodel'
- end
-rescue LoadError
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
-end
View
5 VERSION.yml
@@ -1,5 +0,0 @@
----
-:major: 0
-:minor: 4
-:patch: 0
-:build:
View
176 couch_potato.gemspec
@@ -1,163 +1,25 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "couch_potato/version"
Gem::Specification.new do |s|
- s.name = %q{couch_potato}
- s.version = "0.4.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.name = "couch_potato"
+ s.summary = %Q{Ruby persistence layer for CouchDB}
+ s.email = "alex@upstre.am"
+ s.homepage = "http://github.com/langalex/couch_potato"
+ s.description = "Ruby persistence layer for CouchDB"
s.authors = ["Alexander Lang"]
- s.date = %q{2010-12-10}
- s.description = %q{Ruby persistence layer for CouchDB}
- s.email = %q{alex@upstream-berlin.com}
- s.extra_rdoc_files = [
- "README.md"
- ]
- s.files = [
- "CHANGES.md",
- "MIT-LICENSE.txt",
- "README.md",
- "VERSION.yml",
- "init.rb",
- "lib/core_ext/date.rb",
- "lib/core_ext/object.rb",
- "lib/core_ext/string.rb",
- "lib/core_ext/symbol.rb",
- "lib/core_ext/time.rb",
- "lib/couch_potato.rb",
- "lib/couch_potato/database.rb",
- "lib/couch_potato/persistence.rb",
- "lib/couch_potato/persistence/active_model_compliance.rb",
- "lib/couch_potato/persistence/attachments.rb",
- "lib/couch_potato/persistence/callbacks.rb",
- "lib/couch_potato/persistence/dirty_attributes.rb",
- "lib/couch_potato/persistence/ghost_attributes.rb",
- "lib/couch_potato/persistence/json.rb",
- "lib/couch_potato/persistence/magic_timestamps.rb",
- "lib/couch_potato/persistence/properties.rb",
- "lib/couch_potato/persistence/simple_property.rb",
- "lib/couch_potato/persistence/type_caster.rb",
- "lib/couch_potato/railtie.rb",
- "lib/couch_potato/rspec.rb",
- "lib/couch_potato/rspec/matchers.rb",
- "lib/couch_potato/rspec/matchers/json2.js",
- "lib/couch_potato/rspec/matchers/list_as_matcher.rb",
- "lib/couch_potato/rspec/matchers/map_to_matcher.rb",
- "lib/couch_potato/rspec/matchers/print_r.js",
- "lib/couch_potato/rspec/matchers/reduce_to_matcher.rb",
- "lib/couch_potato/rspec/stub_db.rb",
- "lib/couch_potato/validation.rb",
- "lib/couch_potato/validation/with_active_model.rb",
- "lib/couch_potato/validation/with_validatable.rb",
- "lib/couch_potato/view/base_view_spec.rb",
- "lib/couch_potato/view/custom_view_spec.rb",
- "lib/couch_potato/view/custom_views.rb",
- "lib/couch_potato/view/lists.rb",
- "lib/couch_potato/view/model_view_spec.rb",
- "lib/couch_potato/view/properties_view_spec.rb",
- "lib/couch_potato/view/raw_view_spec.rb",
- "lib/couch_potato/view/view_query.rb",
- "rails/init.rb",
- "rails/reload_classes.rb",
- "spec/attachments_spec.rb",
- "spec/callbacks_spec.rb",
- "spec/create_spec.rb",
- "spec/custom_view_spec.rb",
- "spec/default_property_spec.rb",
- "spec/destroy_spec.rb",
- "spec/fixtures/address.rb",
- "spec/fixtures/person.rb",
- "spec/property_spec.rb",
- "spec/rails_spec.rb",
- "spec/railtie_spec.rb",
- "spec/spec.opts",
- "spec/spec_helper.rb",
- "spec/unit/active_model_compliance_spec.rb",
- "spec/unit/attributes_spec.rb",
- "spec/unit/base_view_spec_spec.rb",
- "spec/unit/callbacks_spec.rb",
- "spec/unit/couch_potato_spec.rb",
- "spec/unit/create_spec.rb",
- "spec/unit/custom_views_spec.rb",
- "spec/unit/database_spec.rb",
- "spec/unit/date_spec.rb",
- "spec/unit/dirty_attributes_spec.rb",
- "spec/unit/initialize_spec.rb",
- "spec/unit/json_create_id_spec.rb",
- "spec/unit/lists_spec.rb",
- "spec/unit/model_view_spec_spec.rb",
- "spec/unit/properties_view_spec_spec.rb",
- "spec/unit/rspec_matchers_spec.rb",
- "spec/unit/rspec_stub_db_spec.rb",
- "spec/unit/string_spec.rb",
- "spec/unit/time_spec.rb",
- "spec/unit/validation_spec.rb",
- "spec/unit/view_query_spec.rb",
- "spec/update_spec.rb",
- "spec/view_updates_spec.rb"
- ]
- s.homepage = %q{http://github.com/langalex/couch_potato}
- s.rdoc_options = ["--charset=UTF-8"]
+ s.version = CouchPotato::VERSION
+ s.platform = Gem::Platform::RUBY
+
+ s.add_dependency 'json'
+ s.add_dependency 'couchrest', '>=1.0.1'
+ s.add_dependency 'activemodel'
+
+ s.add_development_dependency 'rspec', '>=2.0'
+
+ 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.rubygems_version = %q{1.3.7}
- s.summary = %q{Ruby persistence layer for CouchDB}
- s.test_files = [
- "spec/attachments_spec.rb",
- "spec/callbacks_spec.rb",
- "spec/create_spec.rb",
- "spec/custom_view_spec.rb",
- "spec/default_property_spec.rb",
- "spec/destroy_spec.rb",
- "spec/fixtures/address.rb",
- "spec/fixtures/person.rb",
- "spec/property_spec.rb",
- "spec/rails_spec.rb",
- "spec/railtie_spec.rb",
- "spec/spec_helper.rb",
- "spec/unit/active_model_compliance_spec.rb",
- "spec/unit/attributes_spec.rb",
- "spec/unit/base_view_spec_spec.rb",
- "spec/unit/callbacks_spec.rb",
- "spec/unit/couch_potato_spec.rb",
- "spec/unit/create_spec.rb",
- "spec/unit/custom_views_spec.rb",
- "spec/unit/database_spec.rb",
- "spec/unit/date_spec.rb",
- "spec/unit/dirty_attributes_spec.rb",
- "spec/unit/initialize_spec.rb",
- "spec/unit/json_create_id_spec.rb",
- "spec/unit/lists_spec.rb",
- "spec/unit/model_view_spec_spec.rb",
- "spec/unit/properties_view_spec_spec.rb",
- "spec/unit/rspec_matchers_spec.rb",
- "spec/unit/rspec_stub_db_spec.rb",
- "spec/unit/string_spec.rb",
- "spec/unit/time_spec.rb",
- "spec/unit/validation_spec.rb",
- "spec/unit/view_query_spec.rb",
- "spec/update_spec.rb",
- "spec/view_updates_spec.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<json>, [">= 0"])
- s.add_runtime_dependency(%q<couchrest>, [">= 1.0.1"])
- s.add_runtime_dependency(%q<activemodel>, [">= 0"])
- else
- s.add_dependency(%q<json>, [">= 0"])
- s.add_dependency(%q<couchrest>, [">= 1.0.1"])
- s.add_dependency(%q<activemodel>, [">= 0"])
- end
- else
- s.add_dependency(%q<json>, [">= 0"])
- s.add_dependency(%q<couchrest>, [">= 1.0.1"])
- s.add_dependency(%q<activemodel>, [">= 0"])
- end
end
-
View
40 lib/couch_potato.rb
@@ -7,30 +7,28 @@
JSON.create_id = 'ruby_class'
-unless defined?(CouchPotato)
- module CouchPotato
- Config = Struct.new(:database_name, :validation_framework).new
- Config.validation_framework = :active_model
-
- # 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.
- def self.database
- @@__database ||= Database.new(self.couchrest_database)
- end
+module CouchPotato
+ Config = Struct.new(:database_name, :validation_framework).new
+ Config.validation_framework = :active_model
- # 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.
- def self.couchrest_database
- @@__couchrest_database ||= CouchRest.database(full_url_to_database)
- end
+ # 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.
+ def self.database
+ @@__database ||= Database.new(self.couchrest_database)
+ end
+
+ # 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.
+ def self.couchrest_database
+ @@__couchrest_database ||= CouchRest.database(full_url_to_database)
+ end
- private
+ private
- def self.full_url_to_database
- raise('No Database configured. Set CouchPotato::Config.database_name') unless CouchPotato::Config.database_name
- if CouchPotato::Config.database_name.match(%r{https?://})
- CouchPotato::Config.database_name
- else
- "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
- end
+ def self.full_url_to_database
+ raise('No Database configured. Set CouchPotato::Config.database_name') unless CouchPotato::Config.database_name
+ if CouchPotato::Config.database_name.match(%r{https?://})
+ CouchPotato::Config.database_name
+ else
+ "http://127.0.0.1:5984/#{CouchPotato::Config.database_name}"
end
end
end
View
2  lib/couch_potato/rspec/matchers.rb
@@ -17,7 +17,7 @@ def run_js(js)
require 'couch_potato/rspec/matchers/reduce_to_matcher'
require 'couch_potato/rspec/matchers/list_as_matcher'
-module Spec
+module RSpec
module Matchers
def map(document)
CouchPotato::RSpec::MapToProxy.new(document)
View
4 lib/couch_potato/rspec/stub_db.rb
@@ -14,7 +14,7 @@ def with(*args)
end
def and_return(return_value)
- view_stub = Spec::Mocks::Mock.new("#{@clazz}.#{@view}(#{@args.try(:join, ', ')}) view")
+ view_stub = RSpec::Mocks::Mock.new("#{@clazz}.#{@view}(#{@args.try(:join, ', ')}) view")
_stub = @clazz.stub(@view)
_stub.with(*@args) if @args
_stub.and_return(view_stub)
@@ -37,7 +37,7 @@ def stub_db(options = {})
end
end
-module Spec
+module RSpec
module Mocks
module ExampleMethods
include CouchPotato::RSpec::StubDb
View
3  lib/couch_potato/version.rb
@@ -0,0 +1,3 @@
+module CouchPotato
+ VERSION = "0.4.0"
+end
View
3  spec/create_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
describe "create" do
- before(:all) do
+ before(:each) do
recreate_db
end
describe "succeeds" do
@@ -23,6 +23,7 @@
CouchPotato.couchrest_database.get(@comment.id).updated_at.should == Time.parse('2010-01-02 12:34:48 +0000')
end
end
+
describe "fails" do
it "should not store anything" do
@comment = Comment.new
View
2  spec/railtie_spec.rb
@@ -10,7 +10,7 @@ def self.initializer(*args)
end
def self.root
- Spec::Mocks::Mock.new :join => ''
+ RSpec::Mocks::Mock.new :join => ''
end
end
View
2  spec/spec.opts
@@ -1,4 +1,2 @@
--colour
--format progress
---loadby mtime
---reverse
View
4 spec/spec_helper.rb
@@ -1,5 +1,5 @@
require 'rubygems'
-require 'spec'
+require 'rspec'
require 'time'
$:.unshift(File.dirname(__FILE__) + '/../lib')
@@ -41,7 +41,7 @@ def recreate_db
end
recreate_db
-Spec::Matchers.define :string_matching do |regex|
+RSpec::Matchers.define :string_matching do |regex|
match do |string|
string =~ regex
end
View
3  spec/unit/database_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
class DbTestUser
+ include CouchPotato::Persistence
end
# namespaced model
@@ -52,7 +53,7 @@ class Child
end
it "should set itself on the model" do
- user = mock 'user'
+ user = mock('user').as_null_object
DbTestUser.stub!(:new).and_return(user)
db = CouchPotato::Database.new(stub('couchrest db', :info => nil, :get => DbTestUser.json_create({JSON.create_id => 'DbTestUser'})))
user.should_receive(:database=).with(db)
View
4 spec/unit/rspec_stub_db_spec.rb
@@ -10,7 +10,7 @@ class WithStubbedView
describe "stubbing the db" do
it "should replace CouchPotato.database with a stub" do
stub_db
- CouchPotato.database.should be_a(Spec::Mocks::Mock)
+ CouchPotato.database.should be_a(RSpec::Mocks::Mock)
end
it "should return the stub" do
@@ -26,7 +26,7 @@ class WithStubbedView
end
it "should stub the view to return a stub" do
- WithStubbedView.stubbed_view('123').should be_a(Spec::Mocks::Mock)
+ WithStubbedView.stubbed_view('123').should be_a(RSpec::Mocks::Mock)
end
it "should stub the database to return fake results when called with the stub" do
Please sign in to comment.
Something went wrong with that request. Please try again.