Sha256: 7a91c1ca60b8a9bc12c3a6f157c7a316885427cc130a9c9949f3a16e7430a760

Contents?: true

Size: 1.82 KB

Versions: 7

Compression:

Stored size: 1.82 KB

Contents

#!/usr/bin/env ruby
path = File.expand_path("../lib", File.dirname(__FILE__))
$LOAD_PATH.unshift path unless $LOAD_PATH.include?(path)

require "vanity"
require "optparse"

playground = Vanity.playground
options = Struct.new(:output).new
opts = OptionParser.new("", 24, "  ") do |opts|
  opts.banner = "Usage: #{File.basename($0)} [options] command\n"
  opts.banner << "Commands:\n"
  opts.banner << "  report  Report on all running experiments"

  opts.separator ""
  opts.separator "General options:"
  opts.on("--path PATH", "Path to experiments directory (default: #{playground.load_path})")  { |v| playground.load_path = v }
  opts.on("--output FILE", "Write report to this file (default: stdout)")                     { |v| options.output = v }

  opts.separator ""
  opts.separator "Redis options:"
  opts.on("--host HOST", "Redis server host (default: #{playground.host})")       { |v| playground.host = v }
  opts.on("--port PORT", "Redis server port (default: #{playground.port})")       { |v| playground.port = v }
  opts.on("--db DB", "Redis database (default: #{playground.db})")                { |v| playground.db = v }
  opts.on("--password PWD", "Redis database password")                            { |v| playground.password = v }
  opts.on("--namespace NS", "Redis namespace (default: #{playground.namespace})") { |v| playground.namespace = v }

  opts.separator ""
  opts.separator "Common options:"
  opts.on_tail "-h", "-H", "--help", "Show this message" do
    puts opts.to_s.gsub(/^.*DEPRECATED.*$/s, '')
    exit
  end
  opts.on_tail "-v", "--version", "Show version"  do
    puts "Vanity #{Vanity::Version::STRING}"
    exit
  end
end

opts.parse!(ARGV)
if ARGV.empty?
  puts opts.banner
  exit
end

ARGV.each do |cmd|
  case cmd
  when "report"
    Vanity::Commands.report options.output
  else fail "No such command: #{cmd}"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vanity-1.2.0 bin/vanity
vanity-1.1.1 bin/vanity
vanity-1.1.0 bin/vanity
vanity-1.0.0 bin/vanity
vanity-0.4.0 bin/vanity
vanity-0.3.1 bin/vanity
vanity-0.3.0 bin/vanity