[Bps-public-commit] SD branch, config-gitlike, updated. 7300f47adf0fa6c709105a4e6a76e658180c4362
spang at bestpractical.com
spang at bestpractical.com
Mon Jun 29 11:31:19 EDT 2009
The branch, config-gitlike has been updated
via 7300f47adf0fa6c709105a4e6a76e658180c4362 (commit)
via 3554472eecd44ea3799b23dda09eb438ec81cca0 (commit)
from 395333503b67d565e0f6611a2a61436b6723fe15 (commit)
Summary of changes:
lib/App/SD.pm | 4 +-
lib/App/SD/CLI/Command/Help/Aliases.pm | 5 ++++
lib/App/SD/Config.pm | 37 ++++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
create mode 100644 lib/App/SD/Config.pm
- Log -----------------------------------------------------------------
commit 3554472eecd44ea3799b23dda09eb438ec81cca0
Author: Christine Spang <spang at bestpractical.com>
Date: Mon Jun 29 15:42:16 2009 +0300
Resurrect App::SD::Config for backcompat purposes.
diff --git a/lib/App/SD.pm b/lib/App/SD.pm
index 9e9c834..a4ed331 100644
--- a/lib/App/SD.pm
+++ b/lib/App/SD.pm
@@ -1,6 +1,6 @@
package App::SD;
use Any::Moose;
-use Prophet::Config;
+use App::SD::Config;
extends 'Prophet::App';
@@ -10,7 +10,7 @@ has '+config' => (
default => sub {
my $self = shift;
$ENV{PROPHET_APP_CONFIG} = $ENV{SD_CONFIG} if defined $ENV{SD_CONFIG};
- return Prophet::Config->new( app_handle => $self, confname => 'sdrc' );
+ return App::SD::Config->new( app_handle => $self, confname => 'sdrc' );
}
);
diff --git a/lib/App/SD/Config.pm b/lib/App/SD/Config.pm
new file mode 100644
index 0000000..a05b37b
--- /dev/null
+++ b/lib/App/SD/Config.pm
@@ -0,0 +1,37 @@
+package App::SD::Config;
+use Any::Moose;
+use File::Spec;
+
+extends 'Prophet::Config';
+
+### XXX This class is for BACKCOMPAT ONLY! Eventually, we want to kill it
+### completely.
+
+override _old_app_config_file => sub {
+ my $self = shift;
+
+ # The order of preference for (OLD!) config files is:
+ # $ENV{SD_CONFIG} > fs_root/config > fs_root/prophetrc (for backcompat)
+ # $HOME/.sdrc > $ENV{PROPHET_APP_CONFIG} > $HOME/.prophetrc
+
+ # if we set PROPHET_APP_CONFIG here, it will mess up legit uses of the
+ # new config file setup
+ $ENV{'OLD_PROPHET_APP_CONFIG'}
+ = $self->_file_if_exists($ENV{'SD_CONFIG'})
+ || $self->_file_if_exists(
+ File::Spec->catfile($self->app_handle->handle->fs_root => 'config'))
+ || $self->_file_if_exists(
+ # backcompat
+ File::Spec->catfile($self->app_handle->handle->fs_root => 'prophetrc'))
+ || $self->_file_if_exists(
+ File::Spec->catfile($ENV{'HOME'}.'/.sdrc'))
+ || $ENV{'PROPHET_APP_CONFIG'} # don't overwrite with nothing
+ || ''; # don't write undef
+ $self->SUPER::_old_app_config_file(@_,
+ config_env_var => 'OLD_PROPHET_APP_CONFIG');
+};
+
+__PACKAGE__->meta->make_immutable;
+no Any::Moose;
+
+1;
commit 7300f47adf0fa6c709105a4e6a76e658180c4362
Author: Christine Spang <spang at bestpractical.com>
Date: Mon Jun 29 17:48:28 2009 +0300
Doc using $1 etc. for args in aliases.
diff --git a/lib/App/SD/CLI/Command/Help/Aliases.pm b/lib/App/SD/CLI/Command/Help/Aliases.pm
index 9e83a00..0cca740 100644
--- a/lib/App/SD/CLI/Command/Help/Aliases.pm
+++ b/lib/App/SD/CLI/Command/Help/Aliases.pm
@@ -20,6 +20,11 @@ to you with the alias 'mine':
mine = ticket list -- owner=you\@domain.com status !~closed|rejected
+To create aliases that take additional arguments, use the argument
+number prefixed with a '\$' to refer to them, like this:
+
+ ts = ticket show \$1
+
SD also provides a command for managing aliases: '${cmd}aliases'. If
given no arguments, the aliases command will print the active aliases
for the current repository (including all non-overridden user-wide
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list