Feature - #296 Setting configuration variables in .taskrc

- Now supports 'task config name value', 'task config name ""', and
  'task config name' to directly modify the .taskrc file.
- Updated man page.
- Added unit tests.
- Modified existing config command to also display configuration
  variables that have no values.
This commit is contained in:
Paul Beckingham 2010-01-17 00:02:17 -05:00
parent c82469fa2c
commit 229a3d309c
7 changed files with 149 additions and 12 deletions

View file

@ -29,7 +29,7 @@
use strict;
use warnings;
use File::Path;
use Test::More tests => 8;
use Test::More tests => 12;
# Create the rc file, using rc.name:value.
unlink 'foo.rc';
@ -51,6 +51,23 @@ qx{echo 'y'|../task rc:foo.rc rc.data.location:foo};
ok (-r 'foo.rc', 'Created default rc file');
ok (-d 'foo', 'Created default data directory');
# Add a setting.
qx{echo 'y'|../task rc:foo.rc config must_be_unique old};
my $output = qx{../task rc:foo.rc config};
like ($output, qr/^must_be_unique\s+old$/ms, 'config setting a new value');
qx{echo 'y'|../task rc:foo.rc config must_be_unique new};
$output = qx{../task rc:foo.rc config};
like ($output, qr/^must_be_unique\s+new$/ms, 'config overwriting an existing value');
qx{echo 'y'|../task rc:foo.rc config must_be_unique ''};
$output = qx{../task rc:foo.rc config};
like ($output, qr/^must_be_unique$/ms, 'config setting a blank value');
qx{echo 'y'|../task rc:foo.rc config must_be_unique};
$output = qx{../task rc:foo.rc config};
unlike ($output, qr/^must_be_unique/ms, 'config removing a value');
rmtree 'foo', 0, 0;
ok (!-r 'foo', 'Removed foo');