Sha256: 90901b6d046dc6fddd9640f03c6743759bf3f5ebce60b4c02343816816ad02af

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
require File.expand_path(File.dirname(__FILE__)) + '/../lib/couchrest'

options = {
  :loud => true,
}

opts = OptionParser.new do |opts|
  opts.banner = "Usage: #$0 [options] (push|pull|generate)"
  opts.on('-q', '--quiet', "Omit extra debug info") do
    options[:loud] = false
  end
  opts.on_tail('-h', '--help', "Display detailed help and exit") do
    puts opts
    exit
  end
end

opts.parse!(ARGV)

case ARGV.shift
when /generate/
  appname = ARGV.shift
  current = Dir.getwd 
  appdir = File.join(current, appname)
  puts "generating couchapp in #{appdir}"
  CouchRest::FileManager.generate_app(appdir)
  
when /push/
  dirname = ARGV.shift
  current = Dir.getwd 
  dir = File.expand_path(File.join(current, dirname))
  dirapp = File.split(dir).last
  if ARGV.length == 2
    appname = ARGV.shift
    dbstring = ARGV.shift
  elsif ARGV.length == 1
    appname = dirapp
    dbstring = ARGV.shift    
  else
    puts opts
    puts "push dirname [appname] database"
    exit(0)
  end
  dbspec = CouchRest.parse(dbstring)
  fm = CouchRest::FileManager.new(dbspec[:database], dbspec[:host])
  fm.push_app(dir, appname)
when /pull/

else
  puts opts
  puts "please specify a command"
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jchris-couchrest-0.9.10 bin/couchapp
jchris-couchrest-0.9.11 bin/couchapp
jchris-couchrest-0.9.12 bin/couchapp
jchris-couchrest-0.9.8 bin/couchapp
jchris-couchrest-0.9.9 bin/couchapp