I have been using my couch_docs gem quite a bit while working through my second chain and I must say, it is getting on my nerves. A short list of improvements that I would like includes:
- Better command line experience.
- Should default to current directory.
- Should print help without args / better format
- Should use the bulk docs
- Should support the !json and !code macros from couchapp
- Should support a flag to only work on design docs (mostly for export).
- Should create the DB if it doesn't already exist
cstrom@whitefall:~/repos/couch_docs$ couch-docsBah! That's much too much junk. Even when I ask for help, I get too much path information:
/home/cstrom/.gem/ruby/1.8/gems/couch_docs-1.0.0/lib/couch_docs/command_line.rb:24:in `run': Unknown command (ArgumentError)
from /home/cstrom/.gem/ruby/1.8/gems/couch_docs-1.0.0/lib/couch_docs/command_line.rb:4:in `run'
from /home/cstrom/.gem/ruby/1.8/gems/couch_docs-1.0.0/bin/couch-docs:8
from /home/cstrom/.gem/ruby/1.8/bin/couch-docs:19:in `load'
from /home/cstrom/.gem/ruby/1.8/bin/couch-docs:19
cstrom@whitefall:~/repos/couch_docs$ ./bin/couch-docs -hGetting just the basename is trivial as is displaying help info with no command line options:
/home/cstrom/.gem/ruby/1.8/bin/couch-docs load dir couchdb_uri
/home/cstrom/.gem/ruby/1.8/bin/couch-docs dump couchdb_uri dir
when "help", "--help", "-h", nilThat makes for much better output:
puts "#{File.basename($0)} load <dir> <couchdb_uri>"
puts "#{File.basename($0)} dump <couchdb_uri> <dir>"
cstrom@whitefall:~/repos/couch_docs$ ./bin/couch-docsAs I have been using couch_docs, I have always loaded from or dumped documents to the current working directory:
couch-docs load <dir> <couchdb_uri>
couch-docs dump <couchdb_uri> <dir>
cstrom@whitefall:~/tmp/seed$ ./bin/couch-docs dump http://localhost:5984/eee .Maybe it is silly, but I would just as soon not have to type the dot. Besides, after using couchapp for a while, I have gotten used to not having to type this. It is easy enough to add the current working directory to the options:
def initialize(args)
@command = args.shift
@options = args
@options.push('.') if @options.size == 1
end
An Unexpected Tangent
I have long since forgotten what I meant to do next, but at some point I tried runningrake -T
only to be told:cstrom@whitefall:~/repos/couch_docs$ rake -TI installed bones (which I used to create couch_docs in the first place):
(in /home/cstrom/repos/couch_docs)
rake aborted!
### please install the "bones" gem ###
/home/cstrom/repos/couch_docs/Rakefile:12
(See full trace by running task with --trace)
cstrom@whitefall:~/repos/couch_docs$ gem install bonesWhen I run
WARNING: Installing to ~/.gem since /var/lib/gems/1.8 and
/var/lib/gems/1.8/bin aren't both writable.
--------------------------
Keep rattlin' dem bones!
--------------------------
Successfully installed rake-0.8.7
Successfully installed little-plugger-1.1.2
Successfully installed loquacious-1.4.2
Successfully installed bones-3.2.1
4 gems installed
rake -T
now, I find:cstrom@whitefall:~/repos/couch_docs$ rake -TAt first I suspected a
(in /home/cstrom/repos/couch_docs)
rake aborted!
### please install the "bones" gem ###
/home/cstrom/repos/couch_docs/Rakefile:12
(See full trace by running task with --trace)
require 'rubygems'
problem, but the rake task that I am using does require rubygems:cstrom@whitefall:~/repos/couch_docs$ which rakeI eventually trace this back to the wrong version of the bones gem:
/home/cstrom/.gem/ruby/1.8/bin/rake
cstrom@whitefall:~/repos/couch_docs$ cat /home/cstrom/.gem/ruby/1.8/bin/rake
#!/usr/bin/ruby1.8
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'rake', version
load Gem.bin_path('rake', 'rake', version)
cstrom@whitefall:~/repos/couch_docs$ gem list | grep bonesI had originally used version 2.5 of bones to build my gem. After uninstalling the latest version of bones and installing 2.5, the problem goes away. I am not sure why it is not possible to require 'bones' in version 3.2.1. Something to investigate tomorrow. Maybe.
bones (3.2.1)
Day #27
No comments:
Post a Comment