From 73e9fe84641d3e009aa94b21666e4a84a63a8e79 Mon Sep 17 00:00:00 2001 From: Masayuki Igawa Date: Thu, 20 Oct 2016 16:40:14 +0900 Subject: [PATCH] Add usage to README and make coverage file positional --- README.rst | 46 ++++++++++++++++++++++++++++++++++++++++++- coverage2sql/shell.py | 2 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 2419e1b..b6d1eca 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,51 @@ if your coverage rate is down. * Source: http://git.openstack.org/cgit/openstack/coverage2sql * Bugs: http://bugs.launchpad.net/coverage2sql +Usage +===== + +DB Setup +-------- + +The usage of coverage2sql is split into 2 stages. First you need to prepare a +database with the proper schema; coverage2sql-db-manage should be used to do +this. The utility requires db connection info which can be specified on the +command or with a config file. Obviously the sql connector type, user, +password, address, and database name should be specific to your environment. +coverage2sql-db-manage will use alembic to setup the db schema. You can run the +db migrations with the command:: + + coverage2sql-db-manage --database-connection mysql://coverage:pass@127.0.0.1/coverage upgrade head + +or with a config file:: + + coverage2sql-db-manage --config-file etc/coverage2sql.conf upgrade head + +This will bring the DB schema up to the latest version for coverage2sql. + +.. _coverage2sql: + +coverage2sql +------------ + +Once you have a database setup with the proper database schema you can then use +the coverage2sql command to populate the database with data from your test +coverage file. coverage2sql takes in a `.coverage file`_ through by passing it +file paths as positional arguments to the script at this moment. + +.. _.coverage file: http://coverage.readthedocs.io/en/latest/cmd.html#data-file + +There are several options for running coverage2sql, they can be listed with:: + + coverage2sql --help + +The only required option is --database-connection. The options can either be +used on the CLI, or put in a config file. If a config file is used you need to +specify the location on the CLI. + + + Features -------- -* TODO +* TODO: .coverage file through stdin diff --git a/coverage2sql/shell.py b/coverage2sql/shell.py index 48b5faa..5a01b7a 100644 --- a/coverage2sql/shell.py +++ b/coverage2sql/shell.py @@ -31,7 +31,7 @@ CONF.import_opt('verbose', 'coverage2sql.db.api') SHELL_OPTS = [ cfg.StrOpt('project_name', positional=True, required=True, help='project name of the coverage files'), - cfg.StrOpt('coverage_file', positional=False, + cfg.StrOpt('coverage_file', positional=True, help='A coverage file to put into the database'), cfg.StrOpt('connection'), ]