++ed by:
ARPI ADAMJS TMUELLER OVID KATE

11 PAUSE users
14 non-PAUSE users.

David E. Wheeler

Name

App::Sqitch - Sane database change management

Synopsis

  use App::Sqitch;
  exit App::Sqitch->go;

Description

This module provides the implementation for sqitch. You probably want to read its documentation, or the tutorial. Unless you want to hack on Sqitch itself, or provide support for a new engine or command. In which case, you will find this API documentation useful.

Interface

Class Methods

go

  App::Sqitch->go;

Called from sqitch, this class method parses command-line options and arguments in @ARGV, parses the configuration file, constructs an App::Sqitch object, constructs a command object, and runs it.

Constructor

new

  my $sqitch = App::Sqitch->new(\%params);

Constructs and returns a new Sqitch object. The supported parameters include:

plan_file
engine
client
db_name
username
host
port
top_dir
deploy_dir
revert_dir
test_dir
extension
editor
verbosity

Accessors

plan_file

engine

client

db_name

username

host

port

top_dir

deploy_dir

revert_dir

test_dir

extension

editor

config

  my $config = $sqitch->config;

Returns the full configuration, combined from the project, user, and system configuration files.

verbosity

Instance Methods

run

  $sqitch->run('echo hello');

Runs a system command and waits for it to finish. Throws an exception on error.

capture

  my @files = $sqitch->capture(qw(ls -lah));

Runs a system command and captures its output to STDOUT. Returns the output lines in list context and the concatenation of the lines in scalar context. Throws an exception on error.

probe

  my $git_version = $sqitch->capture(qw(git --version));

Like capture, but returns just the chomped first line of output.

spool

  $sqitch->spool($sql_file_handle, 'sqlite3', 'my.db');

Like run, but spools the contents of a file handle to the standard input the system command. Returns true on success and throws an exception on failure.

trace

  $sqitch->trace('About to fuzzle the wuzzle.');

Send trace information to STDOUT if the verbosity level is 3 or higher. Trace messages will have trace: prefixed to every line. If it's lower than 3, nothing will be output.

debug

  $sqitch->debug('Found snuggle in the crib.');

Send debug information to STDOUT if the verbosity level is 2 or higher. Debug messages will have debug: prefixed to every line. If it's lower than 2, nothing will be output.

info

  $sqitch->info('Nothing to deploy (up-to-date)');

Send informational message to STDOUT if the verbosity level is 1 or higher, which, by default, it is. Should be used for normal messages the user would normally want to see. If verbosity is lower than 1, nothing will be output.

comment

  $sqitch->comment('On database flipr_test');

Send comments to STDOUT if the verbosity level is 1 or higher, which, by default, it is. Comments have # prefixed to every line. If verbosity is lower than 1, nothing will be output.

emit

  $sqitch->emit('core.editor=emacs');

Send a message to STDOUT, without regard to the verbosity. Should be used only if the user explicitly asks for output, such as for sqitch config --get core.editor.

vent

  $sqitch->vent('core.editor=emacs');

Send a message to STDERR, without regard to the verbosity. Should be used only for error messages to be printed before exiting with an error, such as when reverting failed changes.

warn

  $sqitch->warn('Could not find nerble; using nobble instead.');

Send a warning messages to STDERR. Warnings will have warning: prefixed to every line. Use if something unexpected happened but you can recover from it.

To Do

  • Eliminate use of fail() and localize messages.

  • Add support for ^ and other shortcuts when specifying changes.

  • Add an empty line after a new tag in Plan::tag().

Author

David E. Wheeler <david@justatheory.com>

License

Copyright (c) 2012 iovation Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.