eee-c / couch_docs Goto Github PK
View Code? Open in Web Editor NEWProvides a mapping between CouchDB documents and the file system.
Provides a mapping between CouchDB documents and the file system.
When pushing without -R, the executable will silently fail.
Rather than mime-encoding attachments inline in JSON, it would be nice to dump/load them directly on the filesystem.
Currently the put! method will delete then recreate the document. It should be easy enough to use put and not upload if revisions are the same.
Some design doc keys have more complex JSON values than simply a string of Javascript for e.g. map / reduce functions. For example, it's nice to have couch_docs manage keeping your rewrite definitions up-to-date, which are defined in an array.
So e.g. it would be nice to have (on the filesystem):
db/_design/myapp/rewrites.json
.. and get a design doc like:
{ "_id": "_design/myapp", "rewrites": [ { "from": "/this", "to": "that" } ] }
Hello,
In the README file, you're saying :
couch-docs load "http://localhost:5984/db" path/to/dump_dir/
However the appropriate command is the following :
couch-docs load path/to/dump_dir/ "http://localhost:5984/db"
Perhaps a rescue in CouchDocs::put_design_dir would do the trick.
Hi, I see that it's trying to compile json-1.4.6 but when I do gem install json
the newest is 1.8.something
~/.rvm$ gem install couch_docs --no-rdoc --no-ri
Fetching: json-1.4.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing couch_docs:
ERROR: Failed to build gem native extension.
/home/hosiplan/.rvm/rubies/ruby-2.0.0-p451/bin/ruby extconf.rb
checking for re.h... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling parser.c
In file included from /home/hosiplan/.rvm/rubies/ruby-2.0.0-p451/include/ruby-2.0.0/ruby.h:33:0,
from parser.h:4,
from parser.rl:1:
parser.rl: In function ‘JSON_parse_object’:
/home/hosiplan/.rvm/rubies/ruby-2.0.0-p451/include/ruby-2.0.0/ruby/ruby.h:445:18: error: expected ‘(’ before ‘!’ token
#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
^
parser.rl:165:20: note: in expansion of macro ‘RTEST’
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
/home/hosiplan/.rvm/rubies/ruby-2.0.0-p451/include/ruby-2.0.0/ruby/ruby.h:445:18: warning: value computed is not used [-Wunused-value]
#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
^
parser.rl:165:20: note: in expansion of macro ‘RTEST’
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
parser.rl:165:68: error: expected ‘;’ before ‘{’ token
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
make: *** [parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/hosiplan/.rvm/gems/ruby-2.0.0-p451/gems/json-1.4.6 for inspection.
Results logged to /home/hosiplan/.rvm/gems/ruby-2.0.0-p451/extensions/x86_64-linux/2.0.0/json-1.4.6/gem_make.out
When using the -R switch to couch-docs, it sends a DELETE with a "rev" param to the DB being written to. This results in an HTTP 400 / bad request, causing the update to fail.
When writing design documents, it might be nice to use coffeescript.
Added the gem to a rails 3 project, immediately started getting errors like:
undefined method deep_merge' for "%Y-%m-%d":String undefined method
deep_merge' for ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]:Array
I haven't look into this too much, but the deep_merge patch in design_directory.rb is creating conflicts.
$ ./bin/couch-docs push -R localhost:5984/test3 /tmp/test2
/home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:209:in process_result': HTTP status code 400 (RestClient::RequestFailed) from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:139:in
transmit'
from /home/cstrom/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/1.8/net/http.rb:543:in start' from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:137:in
transmit'
from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:60:in execute_inner' from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:50:in
execute'
from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient/request.rb:28:in execute' from /home/cstrom/.rvm/gems/ruby-1.8.7-p302@couch_docs/gems/rest-client-1.1.0/lib/restclient.rb:79:in
delete'
from /home/cstrom/repos/couch_docs/lib/couch_docs/store.rb:58:in delete' from /home/cstrom/repos/couch_docs/lib/couch_docs/store.rb:39:in
delete_and_put'
from /home/cstrom/repos/couch_docs/lib/couch_docs/store.rb:35:in put!' from /home/cstrom/repos/couch_docs/lib/couch_docs.rb:80:in
destructive_database_create'
from /home/cstrom/repos/couch_docs/lib/couch_docs/command_line.rb:30:in run' from /home/cstrom/repos/couch_docs/lib/couch_docs/command_line.rb:13:in
run'
from ./bin/couch-docs:10
Hi,
I am testing out couch-docs, and want to try to dump the design and standard docs from a DB with about 90mm records in it.
I first tried to dump just the design docs and hit a brick wall.
root:/tmp/couch_dump# couch-docs dump -d "http://localhost:5984/searchlight_production"
/usr/local/lib/ruby/gems/1.8/gems/json-1.2.3/lib/json/common.rb:128:in `initialize': can't convert RestClient::Response into String (TypeError)
from /usr/local/lib/ruby/gems/1.8/gems/json-1.2.3/lib/json/common.rb:128:in `new'
from /usr/local/lib/ruby/gems/1.8/gems/json-1.2.3/lib/json/common.rb:128:in `parse'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs/store.rb:62:in `get'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs/store.rb:68:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs.rb:63:in `map'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs.rb:63:in `dump'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs/command_line.rb:23:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/lib/couch_docs/command_line.rb:11:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/couch_docs-1.1.0/bin/couch-docs:10
from /usr/local/bin/couch-docs:19:in `load'
from /usr/local/bin/couch-docs:19
Here is my Ruby info (Running Ruby Enterprise Edition):
root:/tmp/couch_dump# ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 20090928
And here is a link to the gems installed and my 'gem env' if thats helpful.
If I run dump with '-D' to dump all docs, it does nothing visible. But I killed it before it had a chance perhaps to really do any work on such a large DB?
Thoughts? Thank you.
Apparently "Bones.setup" disappeared in v3:
{dan@ledog ~/src/couch_docs}$ rake (in /Users/dan/src/couch_docs) rake aborted! undefined method `setup' for Bones:Module /Users/dan/src/couch_docs/Rakefile:7 (See full trace by running task with --trace) {dan@ledog ~/src/couch_docs}$ gem list | grep bones bones (3.4.1)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.