Sha256: 9a97332afda0c46bedd2a9fc069281347464f4bd87f3cedec1ddaf59f81b7a40

Contents?: true

Size: 1.13 KB

Versions: 11

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'couchrest'

%w(generate push).each do |file|
  require File.dirname(__FILE__) + "/../lib/couchrest/commands/#{file}"
end

# Set defaults
options = {
  :loud => true,
}

opts = OptionParser.new do |opts|
  opts.banner = "Usage: #$0 [options] (push|generate) directory database"
  opts.on('-q', '--quiet', "Omit extra debug info") do
    options[:loud] = false
  end
  opts.on_tail('-h', '--help [push|generate]', "Display detailed help and exit") do |help_command|
    puts opts
    case help_command
    when "push"
      puts CouchRest::Commands::Push.help
    when "generate"
      puts CouchRest::Commands::Generate.help
    end
    exit
  end
end
opts.parse!(ARGV)

options[:command]       = ARGV.shift
options[:directory]     = ARGV.shift
options[:trailing_args] = ARGV

# There must be a better way to check for extra required args
unless (["push", "generate"].include?(options[:command]) && options[:directory] && options[:trailing_args])
  puts(opts)
  exit
end

case options[:command]
when "push"
  CouchRest::Commands::Push.run(options)
when "generate"
  CouchRest::Commands::Generate.run(options)
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
jchris-couchrest-0.9.10 bin/couchview
jchris-couchrest-0.9.11 bin/couchview
jchris-couchrest-0.9.12 bin/couchview
jchris-couchrest-0.9.4 bin/couchview
jchris-couchrest-0.9.5 bin/couchview
jchris-couchrest-0.9.6 bin/couchview
jchris-couchrest-0.9.7 bin/couchview
jchris-couchrest-0.9.8 bin/couchview
jchris-couchrest-0.9.9 bin/couchview
juozasg-couchrest-0.10.1 bin/couchview
topfunky-couchrest-0.9.4 bin/couchview