Sha256: bc3dff29846617b79fe35b34bcb44766c6ed5bd63b13f19699c856eabe9cb749

Contents?: true

Size: 1.94 KB

Versions: 10

Compression:

Stored size: 1.94 KB

Contents

#!/usr/bin/env ruby

require 'optparse'
begin
  require 'scenarios/Scenario_db.rb'
rescue LoadError
  require 'rubygems'
  require 'scenarios/scenario_db.rb'
end

options = {}
opt_parser = OptionParser.new do |opts|

  options[:setup] = false
  opts.on('--setup', 'Setup the scenario db') do |g|
    options[:setup] = g
  end

  options[:testdb] = false
  opts.on('--testdb', 'database filename') do |t|
    options[:testdb] = t
  end

  options[:add_scenario] = []
  opts.on('--add-scenario name', Array, 'Add a scenario to the database') do |a|
    options[:add_scenario] = a
  end

  options[:delete_scenario] = nil
  opts.on('--delete-scenario id', Integer, 'Delete a scenario from the database with a given row id') do |b|
    options[:delete_scenario] = b
  end

  options[:add_route] = []
  opts.on('--add-route route_type, path, fixture, scenario_id', Array, 'Add a route to a scenario') do |c|
    options[:add_route] = c
  end

  options[:delete_route] = nil
  opts.on('--delete-route id', Integer, "Delete a route from the database with a given row id") do |d|
    options[:delete_route] = d
  end

  options[:add_testdata] = []
  opts.on('--add-testdata name,value,scenario_id', Array, "Add a testdata value to a scenario") do |e|
    options[:add_testdata] = e
  end

  options[:delete_testdata] = nil
  opts.on('--delete-testdata id', Integer, "Delete a testdata from the database with a given row id") do |f|
    options[:delete_route] = f
  end

  options[:scenarios] = false
  opts.on('--scenarios', 'List the scenarios in the database') do |h|
    options[:scenarios] = h
  end

  options[:routes] = false
  opts.on('--routes', 'List the routes in the database') do |i|
    options[:routes] = i
  end

  opts.on('-h', '--help', 'Display this screen') do
    puts opts
    exit
  end
end

begin
  opt_parser.parse!
rescue OptionParser::ParseError => error
  $stderr.puts error
  $stderr.puts '(-h or --help will show valid options)'
  exit 1
end

ScenarioDB.new(options)

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
scenario_server-0.1.3 bin/scenariosdb
scenario_server-0.1.2 bin/scenariosdb
scenario_server-0.1.1 bin/scenariosdb
scenario_server-0.1.0 bin/scenariosdb
scenario_server-0.0.7 bin/scenariosdb
scenario_server-0.0.6 bin/scenariosdb
scenario_server-0.0.4 bin/scenariosdb
scenario_server-0.0.3 bin/scenariosdb
scenario_server-0.0.2 bin/scenariosdb
scenario_server-0.0.1 bin/scenariosdb