ShyCouch 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +4 -3
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/ShyCouch.rb +274 -198
- data/lib/ShyCouch/data.rb +445 -243
- data/readme.md +117 -0
- data/test/test_ShyCouch.rb +17 -25
- data/test/test_couch_document.rb +171 -7
- data/test/test_couchdb_api.rb +45 -6
- data/test/test_couchdb_factory.rb +3 -3
- data/test/test_design_documents.rb +150 -129
- data/test/test_document_validation.rb +85 -0
- data/test/test_fields.rb +12 -12
- data/test/test_views.rb +129 -33
- metadata +49 -42
- data/.document +0 -5
- data/Gemfile.lock +0 -36
- data/README +0 -117
- data/ShyCouch.gemspec +0 -83
- data/design_notes.rb +0 -39
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: ShyCouch
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.7.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -11,11 +11,11 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2011- | 
| 14 | 
            +
            date: 2011-10-22 00:00:00.000000000Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 | 
            -
              name:  | 
| 18 | 
            -
              requirement: & | 
| 17 | 
            +
              name: rest-client
         | 
| 18 | 
            +
              requirement: &70333812928800 !ruby/object:Gem::Requirement
         | 
| 19 19 | 
             
                none: false
         | 
| 20 20 | 
             
                requirements:
         | 
| 21 21 | 
             
                - - ! '>='
         | 
| @@ -23,54 +23,54 @@ dependencies: | |
| 23 23 | 
             
                    version: '0'
         | 
| 24 24 | 
             
              type: :runtime
         | 
| 25 25 | 
             
              prerelease: false
         | 
| 26 | 
            -
              version_requirements: * | 
| 26 | 
            +
              version_requirements: *70333812928800
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            -
              name:  | 
| 29 | 
            -
              requirement: & | 
| 28 | 
            +
              name: sourcify
         | 
| 29 | 
            +
              requirement: &70333812928320 !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                none: false
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 32 | 
             
                - - ~>
         | 
| 33 33 | 
             
                  - !ruby/object:Gem::Version
         | 
| 34 | 
            -
                    version:  | 
| 35 | 
            -
              type: : | 
| 34 | 
            +
                    version: 0.5.0
         | 
| 35 | 
            +
              type: :runtime
         | 
| 36 36 | 
             
              prerelease: false
         | 
| 37 | 
            -
              version_requirements: * | 
| 37 | 
            +
              version_requirements: *70333812928320
         | 
| 38 38 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 39 | 
            -
              name:  | 
| 40 | 
            -
              requirement: & | 
| 39 | 
            +
              name: ShyRubyJS
         | 
| 40 | 
            +
              requirement: &70333812927840 !ruby/object:Gem::Requirement
         | 
| 41 41 | 
             
                none: false
         | 
| 42 42 | 
             
                requirements:
         | 
| 43 | 
            -
                - -  | 
| 43 | 
            +
                - - ! '>='
         | 
| 44 44 | 
             
                  - !ruby/object:Gem::Version
         | 
| 45 | 
            -
                    version:  | 
| 46 | 
            -
              type: : | 
| 45 | 
            +
                    version: 0.2.0
         | 
| 46 | 
            +
              type: :runtime
         | 
| 47 47 | 
             
              prerelease: false
         | 
| 48 | 
            -
              version_requirements: * | 
| 48 | 
            +
              version_requirements: *70333812927840
         | 
| 49 49 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 50 | 
            -
              name:  | 
| 51 | 
            -
              requirement: & | 
| 50 | 
            +
              name: bundler
         | 
| 51 | 
            +
              requirement: &70333812927360 !ruby/object:Gem::Requirement
         | 
| 52 52 | 
             
                none: false
         | 
| 53 53 | 
             
                requirements:
         | 
| 54 | 
            -
                - -  | 
| 54 | 
            +
                - - ~>
         | 
| 55 55 | 
             
                  - !ruby/object:Gem::Version
         | 
| 56 | 
            -
                    version:  | 
| 56 | 
            +
                    version: 1.0.0
         | 
| 57 57 | 
             
              type: :development
         | 
| 58 58 | 
             
              prerelease: false
         | 
| 59 | 
            -
              version_requirements: * | 
| 59 | 
            +
              version_requirements: *70333812927360
         | 
| 60 60 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 61 | 
            -
              name:  | 
| 62 | 
            -
              requirement: & | 
| 61 | 
            +
              name: jeweler
         | 
| 62 | 
            +
              requirement: &70333812926880 !ruby/object:Gem::Requirement
         | 
| 63 63 | 
             
                none: false
         | 
| 64 64 | 
             
                requirements:
         | 
| 65 65 | 
             
                - - ~>
         | 
| 66 66 | 
             
                  - !ruby/object:Gem::Version
         | 
| 67 | 
            -
                    version:  | 
| 67 | 
            +
                    version: 1.6.4
         | 
| 68 68 | 
             
              type: :development
         | 
| 69 69 | 
             
              prerelease: false
         | 
| 70 | 
            -
              version_requirements: * | 
| 70 | 
            +
              version_requirements: *70333812926880
         | 
| 71 71 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 72 | 
            -
              name:  | 
| 73 | 
            -
              requirement: & | 
| 72 | 
            +
              name: rcov
         | 
| 73 | 
            +
              requirement: &70333812926400 !ruby/object:Gem::Requirement
         | 
| 74 74 | 
             
                none: false
         | 
| 75 75 | 
             
                requirements:
         | 
| 76 76 | 
             
                - - ! '>='
         | 
| @@ -78,21 +78,21 @@ dependencies: | |
| 78 78 | 
             
                    version: '0'
         | 
| 79 79 | 
             
              type: :development
         | 
| 80 80 | 
             
              prerelease: false
         | 
| 81 | 
            -
              version_requirements: * | 
| 81 | 
            +
              version_requirements: *70333812926400
         | 
| 82 82 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 83 83 | 
             
              name: ShyRubyJS
         | 
| 84 | 
            -
              requirement: & | 
| 84 | 
            +
              requirement: &70333812925920 !ruby/object:Gem::Requirement
         | 
| 85 85 | 
             
                none: false
         | 
| 86 86 | 
             
                requirements:
         | 
| 87 87 | 
             
                - - ! '>='
         | 
| 88 88 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version:  | 
| 89 | 
            +
                    version: 0.2.0
         | 
| 90 90 | 
             
              type: :runtime
         | 
| 91 91 | 
             
              prerelease: false
         | 
| 92 | 
            -
              version_requirements: * | 
| 92 | 
            +
              version_requirements: *70333812925920
         | 
| 93 93 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 94 94 | 
             
              name: rest-client
         | 
| 95 | 
            -
              requirement: & | 
| 95 | 
            +
              requirement: &70333812925440 !ruby/object:Gem::Requirement
         | 
| 96 96 | 
             
                none: false
         | 
| 97 97 | 
             
                requirements:
         | 
| 98 98 | 
             
                - - ! '>='
         | 
| @@ -100,10 +100,21 @@ dependencies: | |
| 100 100 | 
             
                    version: 1.6.7
         | 
| 101 101 | 
             
              type: :runtime
         | 
| 102 102 | 
             
              prerelease: false
         | 
| 103 | 
            -
              version_requirements: * | 
| 103 | 
            +
              version_requirements: *70333812925440
         | 
| 104 104 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 105 105 | 
             
              name: sourcify
         | 
| 106 | 
            -
              requirement: & | 
| 106 | 
            +
              requirement: &70333812924960 !ruby/object:Gem::Requirement
         | 
| 107 | 
            +
                none: false
         | 
| 108 | 
            +
                requirements:
         | 
| 109 | 
            +
                - - ! '>='
         | 
| 110 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 111 | 
            +
                    version: '0'
         | 
| 112 | 
            +
              type: :runtime
         | 
| 113 | 
            +
              prerelease: false
         | 
| 114 | 
            +
              version_requirements: *70333812924960
         | 
| 115 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 116 | 
            +
              name: mime-types
         | 
| 117 | 
            +
              requirement: &70333812924480 !ruby/object:Gem::Requirement
         | 
| 107 118 | 
             
                none: false
         | 
| 108 119 | 
             
                requirements:
         | 
| 109 120 | 
             
                - - ! '>='
         | 
| @@ -111,33 +122,29 @@ dependencies: | |
| 111 122 | 
             
                    version: '0'
         | 
| 112 123 | 
             
              type: :runtime
         | 
| 113 124 | 
             
              prerelease: false
         | 
| 114 | 
            -
              version_requirements: * | 
| 125 | 
            +
              version_requirements: *70333812924480
         | 
| 115 126 | 
             
            description: Ruby API for CouchDB, designed to work with the Camping micro-framework.
         | 
| 116 127 | 
             
            email: danbryan@gmail.com
         | 
| 117 128 | 
             
            executables: []
         | 
| 118 129 | 
             
            extensions: []
         | 
| 119 130 | 
             
            extra_rdoc_files:
         | 
| 120 131 | 
             
            - LICENSE.txt
         | 
| 121 | 
            -
            - README
         | 
| 122 132 | 
             
            files:
         | 
| 123 | 
            -
            - .document
         | 
| 124 133 | 
             
            - Gemfile
         | 
| 125 | 
            -
            - Gemfile.lock
         | 
| 126 134 | 
             
            - LICENSE.txt
         | 
| 127 | 
            -
            - README
         | 
| 128 135 | 
             
            - Rakefile
         | 
| 129 | 
            -
            - ShyCouch.gemspec
         | 
| 130 136 | 
             
            - VERSION
         | 
| 131 | 
            -
            - design_notes.rb
         | 
| 132 137 | 
             
            - lib/ShyCouch.rb
         | 
| 133 138 | 
             
            - lib/ShyCouch/data.rb
         | 
| 134 139 | 
             
            - lib/ShyCouch/fields.rb
         | 
| 140 | 
            +
            - readme.md
         | 
| 135 141 | 
             
            - test/helper.rb
         | 
| 136 142 | 
             
            - test/test_ShyCouch.rb
         | 
| 137 143 | 
             
            - test/test_couch_document.rb
         | 
| 138 144 | 
             
            - test/test_couchdb_api.rb
         | 
| 139 145 | 
             
            - test/test_couchdb_factory.rb
         | 
| 140 146 | 
             
            - test/test_design_documents.rb
         | 
| 147 | 
            +
            - test/test_document_validation.rb
         | 
| 141 148 | 
             
            - test/test_fields.rb
         | 
| 142 149 | 
             
            - test/test_views.rb
         | 
| 143 150 | 
             
            homepage: http://github.com/Cerales/ShyCouch
         | 
| @@ -155,7 +162,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 155 162 | 
             
                  version: '0'
         | 
| 156 163 | 
             
                  segments:
         | 
| 157 164 | 
             
                  - 0
         | 
| 158 | 
            -
                  hash:  | 
| 165 | 
            +
                  hash: 704426327804299502
         | 
| 159 166 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 160 167 | 
             
              none: false
         | 
| 161 168 | 
             
              requirements:
         | 
    
        data/.document
    DELETED
    
    
    
        data/Gemfile.lock
    DELETED
    
    | @@ -1,36 +0,0 @@ | |
| 1 | 
            -
            GEM
         | 
| 2 | 
            -
              remote: http://rubygems.org/
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                ShyRubyJS (0.0.1)
         | 
| 5 | 
            -
                  sourcify (~> 0)
         | 
| 6 | 
            -
                file-tail (1.0.6)
         | 
| 7 | 
            -
                  spruz (~> 0.2)
         | 
| 8 | 
            -
                git (1.2.5)
         | 
| 9 | 
            -
                jeweler (1.6.4)
         | 
| 10 | 
            -
                  bundler (~> 1.0)
         | 
| 11 | 
            -
                  git (>= 1.2.5)
         | 
| 12 | 
            -
                  rake
         | 
| 13 | 
            -
                rake (0.9.2)
         | 
| 14 | 
            -
                rcov (0.9.10)
         | 
| 15 | 
            -
                ruby2ruby (1.2.5)
         | 
| 16 | 
            -
                  ruby_parser (~> 2.0)
         | 
| 17 | 
            -
                  sexp_processor (~> 3.0)
         | 
| 18 | 
            -
                ruby_parser (2.0.6)
         | 
| 19 | 
            -
                  sexp_processor (~> 3.0)
         | 
| 20 | 
            -
                sexp_processor (3.0.5)
         | 
| 21 | 
            -
                sourcify (0.5.0)
         | 
| 22 | 
            -
                  file-tail (>= 1.0.5)
         | 
| 23 | 
            -
                  ruby2ruby (>= 1.2.5)
         | 
| 24 | 
            -
                  ruby_parser (>= 2.0.5)
         | 
| 25 | 
            -
                  sexp_processor (>= 3.0.5)
         | 
| 26 | 
            -
                spruz (0.2.12)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            PLATFORMS
         | 
| 29 | 
            -
              ruby
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            DEPENDENCIES
         | 
| 32 | 
            -
              ShyRubyJS
         | 
| 33 | 
            -
              bundler (~> 1.0.0)
         | 
| 34 | 
            -
              jeweler (~> 1.6.4)
         | 
| 35 | 
            -
              rcov
         | 
| 36 | 
            -
              sourcify (~> 0.5.0)
         | 
    
        data/README
    DELETED
    
    | @@ -1,117 +0,0 @@ | |
| 1 | 
            -
            = ShyCouch
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            ShyCouch is a Ruby library for CouchDB. It's a data persistence layer that uses native objects and lets you write native Ruby blocks that'll be parsed into MapReduce JavaScript functions.
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            The structure is a bit of a mess, but essentially it provides:
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            - a database object
         | 
| 8 | 
            -
            - a CouchDocument object, which is a glorified hash
         | 
| 9 | 
            -
            - a Design object representing the Design document for an app in CouchDB
         | 
| 10 | 
            -
             | 
| 11 | 
            -
            At the moment, all views have to be written manually. I'm currently evaluating the wisdom of building a query language to dynamically write views and cache them in Couch.
         | 
| 12 | 
            -
             | 
| 13 | 
            -
            = Usage
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            	require 'shycouch'
         | 
| 16 | 
            -
            	settings = {
         | 
| 17 | 
            -
            	  "db"=> {
         | 
| 18 | 
            -
            	      "host" => "ramponeau.local",
         | 
| 19 | 
            -
            	      "port" => 5984,
         | 
| 20 | 
            -
            	      "name" => "food",
         | 
| 21 | 
            -
            	      "user" => "cerales",
         | 
| 22 | 
            -
            	      "password" => "password"
         | 
| 23 | 
            -
            	    },
         | 
| 24 | 
            -
            	}
         | 
| 25 | 
            -
            	db = ShyCouch::CouchDatabase()
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            == Models
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            You don't need to define entity relationships or anything. Your models can just look like this:
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            	module Food::Models
         | 
| 32 | 
            -
            	  class Recipe < CouchDocument; end
         | 
| 33 | 
            -
            	end
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            You can do a bit more if you want:
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            	module Food::Models
         | 
| 38 | 
            -
            	  class Recipe < CouchDocument
         | 
| 39 | 
            -
            	    needs :ingredients
         | 
| 40 | 
            -
            	    needs :directions
         | 
| 41 | 
            -
            	    suggests :cost
         | 
| 42 | 
            -
            	  end
         | 
| 43 | 
            -
            	end
         | 
| 44 | 
            -
            	
         | 
| 45 | 
            -
            == Helpers
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            You define your map & reduce functions - your Couch views - in your Helpers (not entiiiirely working yet)
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            	module Food::Helpers
         | 
| 50 | 
            -
             | 
| 51 | 
            -
            	  design do
         | 
| 52 | 
            -
            	    view all_recipes do
         | 
| 53 | 
            -
            	      map do
         | 
| 54 | 
            -
            	        def function(doc)
         | 
| 55 | 
            -
            	          if doc.kind == "recipe"
         | 
| 56 | 
            -
            	            emit(doc)
         | 
| 57 | 
            -
              	        end
         | 
| 58 | 
            -
            	      end
         | 
| 59 | 
            -
                
         | 
| 60 | 
            -
            	     reduce do
         | 
| 61 | 
            -
            	        # whatever
         | 
| 62 | 
            -
            	      end
         | 
| 63 | 
            -
             | 
| 64 | 
            -
            	    end
         | 
| 65 | 
            -
             | 
| 66 | 
            -
            	    view ingredients do
         | 
| 67 | 
            -
            	      # a different view
         | 
| 68 | 
            -
            	    end
         | 
| 69 | 
            -
            	  end
         | 
| 70 | 
            -
            	end
         | 
| 71 | 
            -
             | 
| 72 | 
            -
            You can then call your views by name in your controllers:
         | 
| 73 | 
            -
             | 
| 74 | 
            -
            	module Food::Controllers
         | 
| 75 | 
            -
            	  class Recipes < R '/recipes/'
         | 
| 76 | 
            -
            	    @recipes = View.all_recipes
         | 
| 77 | 
            -
            	    render :recipes
         | 
| 78 | 
            -
            	  end
         | 
| 79 | 
            -
            	end
         | 
| 80 | 
            -
            	
         | 
| 81 | 
            -
            Views give you back a special JSON hash where you can treat the keys as object attributes and all that:
         | 
| 82 | 
            -
            	
         | 
| 83 | 
            -
            	module Food::Views
         | 
| 84 | 
            -
            	  def recipes
         | 
| 85 | 
            -
            	    recipes.each do |recipe|
         | 
| 86 | 
            -
            	      h2 recipe.title
         | 
| 87 | 
            -
            	      recipe.ingredients.each do |ingredient|
         | 
| 88 | 
            -
            	        p "#{ingredient.name}: #{ingredient.quantity}"
         | 
| 89 | 
            -
            	      end
         | 
| 90 | 
            -
            	    end
         | 
| 91 | 
            -
            	  end
         | 
| 92 | 
            -
            	end
         | 
| 93 | 
            -
             | 
| 94 | 
            -
            = Map/Reduce
         | 
| 95 | 
            -
             | 
| 96 | 
            -
            ShyCouch uses the related ShyRubyJS library to parse Ruby blocks as JavaScript. This means you can do this:
         | 
| 97 | 
            -
             | 
| 98 | 
            -
            	map do
         | 
| 99 | 
            -
            	  def function(doc)
         | 
| 100 | 
            -
            	    if doc.kind == "post" and !doc.hidden
         | 
| 101 | 
            -
            	      emit(doc)
         | 
| 102 | 
            -
            	  end
         | 
| 103 | 
            -
            	end
         | 
| 104 | 
            -
             | 
| 105 | 
            -
            and you'll get this:
         | 
| 106 | 
            -
             | 
| 107 | 
            -
            	function ( doc ) { 
         | 
| 108 | 
            -
            	  if( doc.kind.==("post") && !doc.hidden ) {
         | 
| 109 | 
            -
            	    emit(doc)
         | 
| 110 | 
            -
            	  } 
         | 
| 111 | 
            -
            	}
         | 
| 112 | 
            -
             | 
| 113 | 
            -
            == Copyright
         | 
| 114 | 
            -
             | 
| 115 | 
            -
            Copyright (c) 2011 Cerales. See LICENSE.txt for
         | 
| 116 | 
            -
            further details.
         | 
| 117 | 
            -
             | 
    
        data/ShyCouch.gemspec
    DELETED
    
    | @@ -1,83 +0,0 @@ | |
| 1 | 
            -
            # Generated by jeweler
         | 
| 2 | 
            -
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            -
            # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 | 
            -
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Gem::Specification.new do |s|
         | 
| 7 | 
            -
              s.name = %q{ShyCouch}
         | 
| 8 | 
            -
              s.version = "0.6.0"
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            -
              s.authors = [%q{Shy Inc.}, %q{Daniel Bryan}, %q{Cerales}]
         | 
| 12 | 
            -
              s.date = %q{2011-09-24}
         | 
| 13 | 
            -
              s.description = %q{Ruby API for CouchDB, designed to work with the Camping micro-framework.}
         | 
| 14 | 
            -
              s.email = %q{danbryan@gmail.com}
         | 
| 15 | 
            -
              s.extra_rdoc_files = [
         | 
| 16 | 
            -
                "LICENSE.txt",
         | 
| 17 | 
            -
                "README"
         | 
| 18 | 
            -
              ]
         | 
| 19 | 
            -
              s.files = [
         | 
| 20 | 
            -
                ".document",
         | 
| 21 | 
            -
                "Gemfile",
         | 
| 22 | 
            -
                "Gemfile.lock",
         | 
| 23 | 
            -
                "LICENSE.txt",
         | 
| 24 | 
            -
                "README",
         | 
| 25 | 
            -
                "Rakefile",
         | 
| 26 | 
            -
                "ShyCouch.gemspec",
         | 
| 27 | 
            -
                "VERSION",
         | 
| 28 | 
            -
                "design_notes.rb",
         | 
| 29 | 
            -
                "lib/ShyCouch.rb",
         | 
| 30 | 
            -
                "lib/ShyCouch/data.rb",
         | 
| 31 | 
            -
                "lib/ShyCouch/fields.rb",
         | 
| 32 | 
            -
                "test/helper.rb",
         | 
| 33 | 
            -
                "test/test_ShyCouch.rb",
         | 
| 34 | 
            -
                "test/test_couch_document.rb",
         | 
| 35 | 
            -
                "test/test_couchdb_api.rb",
         | 
| 36 | 
            -
                "test/test_couchdb_factory.rb",
         | 
| 37 | 
            -
                "test/test_design_documents.rb",
         | 
| 38 | 
            -
                "test/test_fields.rb",
         | 
| 39 | 
            -
                "test/test_views.rb"
         | 
| 40 | 
            -
              ]
         | 
| 41 | 
            -
              s.homepage = %q{http://github.com/Cerales/ShyCouch}
         | 
| 42 | 
            -
              s.licenses = [%q{MIT}]
         | 
| 43 | 
            -
              s.require_paths = [%q{lib}]
         | 
| 44 | 
            -
              s.rubygems_version = %q{1.8.6}
         | 
| 45 | 
            -
              s.summary = %q{Ruby API for CouchDB, designed to work with the Camping micro-framework.}
         | 
| 46 | 
            -
             | 
| 47 | 
            -
              if s.respond_to? :specification_version then
         | 
| 48 | 
            -
                s.specification_version = 3
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
         | 
| 51 | 
            -
                  s.add_runtime_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 52 | 
            -
                  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 53 | 
            -
                  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
         | 
| 54 | 
            -
                  s.add_development_dependency(%q<rcov>, [">= 0"])
         | 
| 55 | 
            -
                  s.add_development_dependency(%q<sourcify>, ["~> 0.5.0"])
         | 
| 56 | 
            -
                  s.add_development_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 57 | 
            -
                  s.add_runtime_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 58 | 
            -
                  s.add_runtime_dependency(%q<rest-client>, [">= 1.6.7"])
         | 
| 59 | 
            -
                  s.add_runtime_dependency(%q<sourcify>, [">= 0"])
         | 
| 60 | 
            -
                else
         | 
| 61 | 
            -
                  s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 62 | 
            -
                  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 63 | 
            -
                  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
         | 
| 64 | 
            -
                  s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 65 | 
            -
                  s.add_dependency(%q<sourcify>, ["~> 0.5.0"])
         | 
| 66 | 
            -
                  s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 67 | 
            -
                  s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 68 | 
            -
                  s.add_dependency(%q<rest-client>, [">= 1.6.7"])
         | 
| 69 | 
            -
                  s.add_dependency(%q<sourcify>, [">= 0"])
         | 
| 70 | 
            -
                end
         | 
| 71 | 
            -
              else
         | 
| 72 | 
            -
                s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 73 | 
            -
                s.add_dependency(%q<bundler>, ["~> 1.0.0"])
         | 
| 74 | 
            -
                s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
         | 
| 75 | 
            -
                s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 76 | 
            -
                s.add_dependency(%q<sourcify>, ["~> 0.5.0"])
         | 
| 77 | 
            -
                s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 78 | 
            -
                s.add_dependency(%q<ShyRubyJS>, [">= 0"])
         | 
| 79 | 
            -
                s.add_dependency(%q<rest-client>, [">= 1.6.7"])
         | 
| 80 | 
            -
                s.add_dependency(%q<sourcify>, [">= 0"])
         | 
| 81 | 
            -
              end
         | 
| 82 | 
            -
            end
         | 
| 83 | 
            -
             | 
    
        data/design_notes.rb
    DELETED
    
    | @@ -1,39 +0,0 @@ | |
| 1 | 
            -
            # just playing with possible syntax inspired by bluebie's implementation
         | 
| 2 | 
            -
            settings = {blah blah blah}
         | 
| 3 | 
            -
            db = ShyCouch.getDB(settings)
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            designs = db.getDesigns #should get a DocumentCollection thing
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            # long method of making a design
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            #defining a view w/ map
         | 
| 10 | 
            -
            view = ShyCouch::Data::View.new :rocks do
         | 
| 11 | 
            -
              map do
         | 
| 12 | 
            -
                emit(doc.id, null) if doc.kind == "rock"
         | 
| 13 | 
            -
              end
         | 
| 14 | 
            -
            end
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            #defining a view w/ reduce
         | 
| 17 | 
            -
            view2 = ShyCouch::Data::View.new :rock_weight_average
         | 
| 18 | 
            -
              map do
         | 
| 19 | 
            -
                emit(doc.id, doc.weight) if doc.kind == "rock"
         | 
| 20 | 
            -
              end
         | 
| 21 | 
            -
              reduce do
         | 
| 22 | 
            -
                # return the average
         | 
| 23 | 
            -
                return sum(values) / values.length
         | 
| 24 | 
            -
              end
         | 
| 25 | 
            -
            end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            #defining a view w/ literal JS instead of parsing
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            view3 = ShyCouch::Data::View.new :complicated
         | 
| 30 | 
            -
            view3.map = "function(doc) { emit(doc.id, doc.weirdThing); }"
         | 
| 31 | 
            -
            view3.reduce = "function(key, values, rereduce) { functiondfhs lambda calculs blahalahal; }"
         | 
| 32 | 
            -
             | 
| 33 | 
            -
            newDesign = ShyCouch::Data::Design.new
         | 
| 34 | 
            -
            # either:
         | 
| 35 | 
            -
            newDesign << view
         | 
| 36 | 
            -
            newDesign << view2
         | 
| 37 | 
            -
            # or:
         | 
| 38 | 
            -
            newDesign << view,view2
         | 
| 39 | 
            -
            # or both!
         |