[Bps-public-commit] Prophet branch, config-gitlike, updated. a1316914f448020702470436298912aebc683132
spang at bestpractical.com
spang at bestpractical.com
Thu Jun 25 07:43:54 EDT 2009
The branch, config-gitlike has been updated
via a1316914f448020702470436298912aebc683132 (commit)
via a2fc3bb4c194e6eedca05e870201173f0b7aebce (commit)
via 6b13137a8ae91d0d444a1e000f1a25149699321b (commit)
from f66404963e5310b5916c94b9c3b43a0d09a4cce9 (commit)
Summary of changes:
lib/Prophet/CLI/Command/Config.pm | 6 +++++-
lib/Prophet/Config.pm | 2 +-
t/aliases.t | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 6b13137a8ae91d0d444a1e000f1a25149699321b
Author: Christine Spang <spang at mit.edu>
Date: Thu Jun 25 14:35:15 2009 +0300
Don't bring up editor if the user can't edit the given config file (us. happens with global files).
diff --git a/lib/Prophet/CLI/Command/Config.pm b/lib/Prophet/CLI/Command/Config.pm
index 64072af..2b57b62 100644
--- a/lib/Prophet/CLI/Command/Config.pm
+++ b/lib/Prophet/CLI/Command/Config.pm
@@ -68,6 +68,9 @@ sub run {
elsif ( $self->has_arg('edit') ) {
my $done = 0;
+ die "You don't have write permissions on "
+ .$self->config_filename.", can't edit!\n"
+ if ! -w $self->config_filename;
my $template = $self->make_template;
while ( !$done ) {
commit a2fc3bb4c194e6eedca05e870201173f0b7aebce
Author: Christine Spang <spang at mit.edu>
Date: Thu Jun 25 14:37:51 2009 +0300
Allow editing aliases/config files even if they don't already exist.
diff --git a/lib/Prophet/CLI/Command/Config.pm b/lib/Prophet/CLI/Command/Config.pm
index 2b57b62..d109840 100644
--- a/lib/Prophet/CLI/Command/Config.pm
+++ b/lib/Prophet/CLI/Command/Config.pm
@@ -96,7 +96,8 @@ sub run {
sub make_template {
my $self = shift;
- return Prophet::Util->slurp($self->config_filename);
+ return -f $self->config_filename
+ ? Prophet::Util->slurp( $self->config_filename ) : '';
}
sub process_template {
diff --git a/lib/Prophet/Config.pm b/lib/Prophet/Config.pm
index fbeff1b..2f6bfa3 100644
--- a/lib/Prophet/Config.pm
+++ b/lib/Prophet/Config.pm
@@ -54,7 +54,7 @@ sub aliases {
if ( $file ) {
# parse the given config file with parse_content and use the
# callbacks to add to an array
- my $content = Prophet::Util->slurp( $file );
+ my $content = -f $file ? Prophet::Util->slurp( $file ) : '';
$self->parse_content(
content => $content,
callback => sub {
commit a1316914f448020702470436298912aebc683132
Author: Christine Spang <spang at mit.edu>
Date: Thu Jun 25 14:38:10 2009 +0300
Test one other syntax rather than the same syntax twice.
diff --git a/t/aliases.t b/t/aliases.t
index f627413..6328184 100644
--- a/t/aliases.t
+++ b/t/aliases.t
@@ -116,7 +116,7 @@ my @cmds = (
comment => 'deleted alias no longer exists',
},
{
- cmd => [ 'set', 'foo', 'bar', '=', 'bar baz'],
+ cmd => [ 'set', 'foo bar', '=', 'bar baz'],
output => qr//,
comment => 'set alias again with different syntax',
},
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list