Giter Club home page Giter Club logo

dolly's Introduction

Dolly3

The thing you move your couch with...

example workflow

Installation

Add this line to your application's Gemfile:

gem 'dolly3'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dolly3

Usage

TODO: Write usage instructions here

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dolly3.

## Migrating from couch 1.x to 2.x

Official docs

You will need to uninstall the couchdb service with brew

brew services stop couchdb brew services uninstall couchdb

Download the application from the following source

http://couchdb.apache.org/#download

launch fauxton and check your installation

Copy this file into your filesystem

make it executable

chmod +x couchup.py

and run it

./couchup.py -h

You might need to install python 3 and pip3 and the following libs

pip3 install requests progressbar2

move your .couch files into the specified database_dir in your fauxton config

$ ./couchup list           # Shows your unmigrated 1.x databases
$ ./couchup replicate -a   # Replicates your 1.x DBs to 2.x
$ ./couchup rebuild -a     # Optional; starts rebuilding your views
$ ./couchup delete -a      # Deletes your 1.x DBs (careful!)
$ ./couchup list           # Should show no remaining databases!

dolly's People

Contributors

erickfabian avatar javierg avatar alejandrodevs avatar dependabot[bot] avatar

Stargazers

Clint Bettiga avatar  avatar Matt Petty avatar Ryan Rauh avatar Gaston Morixe avatar Sean Cook avatar Cristian A Monterroza avatar Abimael Martell avatar

Watchers

Jin Lee avatar Ruben Ascencio avatar Enrique De Leon avatar  avatar Andrey avatar Adam Yanalunas avatar AMCO avatar James Cloos avatar Eduardo Arenas avatar Maos avatar Mayela avatar Eduardo Guillen avatar  avatar Jesús Urias avatar  avatar Philip Smerud avatar David Quon avatar Brian L avatar Pedro Perafán avatar Clint Bettiga avatar  avatar ArmandoSarmina avatar Sean Cook avatar  avatar Ulises García avatar Osvaldo Perez avatar Valeriy Lapin avatar  avatar  avatar Luis Hernandez avatar  avatar Gabriel Duprat avatar  avatar Miguel Bertaud avatar Rick Chatham avatar  avatar Gerardo Ayala avatar Diego Negrete avatar Hector Stivalet avatar Eddy Roberto Morales Perez avatar Gerardo Hernández avatar  avatar  avatar  avatar

dolly's Issues

Wrong initialize signature in request.rb when calling Bulk Document

From @javierg in testing something else

+++ b/lib/dolly/request.rb
@@ -19,7 +19,7 @@ module Dolly
       @password      = options["password"]
       @protocol      = options["protocol"]

-      @bulk_document = Dolly::BulkDocument.new []
+      @bulk_document = Dolly::BulkDocument.new self, []
       self.class.base_uri "#{protocol}://#{host}:#{port}"
     end

Implement PATCH request

We can achive this thorugh Update Handlers It will require some convention on how to create the handler functions... as doing them dynamically is too costly, they will need to be created ahead. Here is were a generater might work.

What's the division between Base and Document?

Seems a little arbitrary at the moment, and before I start hacking around I'm wondering if there's an existing design decision on what belongs where?

I actually expected that the model would inherit from Document, and then I look in Base and I see things like property and I'm not sure why that's there and not in Document.

Timestamps don't work

There's a passing test for timestamps, but they don't actually work.

The test is using a mock, Imho we should use a Factory instead, because that would be failing.

It's possible that #32 might help the issue, because its a date/time related situation.

Add Persisted? Method

We have implemented persisted? in WS using the presence of _rev, we could probably implement it directly into Dolly.

def persisted?
  doc['_rev'].present?
end

Add reload method

This method will set all the values, specially the rev id with what is on the remote document

Nested Attributes Should Be Accessible by String or Symbol

If you have a nested attribute:

'sender': {
  type: 'mysql',
  id: 1
}

doc['sender'] works, but doc['sender']['id'] doesn't work, you have to do doc['sender'][:id]. There's some weird inconsistencies, sometimes you need strings, sometimes symbols.

View generator and/or migration-based generation

One thing I was thinking is that you could actually have just a single view for all the ID-based lookups, as long as you stick to that "type/id" format for the _ids.

(d) ->
  if ti = d._id.split "/"
    emit ti

And then your view queries need to include that composite key, eg.

/foo/_design/dolly/_view/id?key=["User", "[email protected]"]

default values don't get saved properly

Please see https://github.com/amco/ab/pull/693

I believe this is due to the differences between the property method and what is stored in doc

Steps to reproduce:

  1. Create a dolly document with the following: property :foo, class_name: Hash, default: {}
  2. in couch directly save an instance of this document, and make sure foo is not included (i.e foo should not be a key anywhere in the document)
  3. load the document via find. set document.foo = { 'bar' => 'baz' } and save.
  4. In couch, the data will be foo: null and NOT foo: { 'bar' : 'baz' }

Allow setting a custom method/property as the primary key (_id)

Currently, there are a couple of ways of achieving this, either by overriding the id method entirely, or by using a callback (e.g. before_save).

It'd be better if we could do something like:
Option A)

class Product < Dolly::Document
  property :sku, primary: true
end

Option B)

class Product < Dolly::Document
  property :sku

  primary :sku
end
p = Product.new
p.sku = "sau101"
p.id # "product/sau101"

It should work with either document propertys or arbitrary instance methods.

Failing Tests/FakeWeb Passthrough

Real internet connections are disabled in the test suite, but it looks like they should be allowed to localhost.

There are 9 tests that are erroring because they aren't allowed to hit the database. If you allow localhost, then there's 5 failing.

Default Should Populate Attribute Before Save (maybe?)

Given this line:
property :created_at, class_name: Time, default: Time.now

It appears that default is only run at the time the attribute is read.

It would be really cool if default actually populated the attribut before save, then it could be used for timestamps and all kinds of other fun defaulty type stuff.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.