[Bps-public-commit] rt-extension-assets-import-csv branch, master, updated. 1.1-1-g89be455

Alex Vandiver alexmv at bestpractical.com
Wed Feb 26 11:33:03 EST 2014


The branch, master has been updated
       via  89be455c17c50d64cf518571a2d9312667d42395 (commit)
      from  0e2d1378046a400b3794e71d83aebae6e94bf73e (commit)

Summary of changes:
 bin/rt-assets-import-csv.in | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 89be455c17c50d64cf518571a2d9312667d42395
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Feb 26 11:32:49 2014 -0500

    Allow rt-assets-import-csv to take an explicit config file, for greater flexibility

diff --git a/bin/rt-assets-import-csv.in b/bin/rt-assets-import-csv.in
index ddf9ccb..6a2da03 100755
--- a/bin/rt-assets-import-csv.in
+++ b/bin/rt-assets-import-csv.in
@@ -9,7 +9,7 @@ use lib qw(/opt/rt4/local/lib /opt/rt4/lib);
 
 use Getopt::Long;
 my %opt;
-GetOptions( \%opt, 'help|h', 'update|u', 'insert|i', 'debug|d', 'mdy', 'dmy' );
+GetOptions( \%opt, 'help|h', 'update|u', 'insert|i', 'debug|d', 'mdy', 'dmy', 'config|c=s' );
 my $file = shift @ARGV;
 
 if ( $opt{help} || !$file ) {
@@ -27,6 +27,13 @@ use RT;
 use RT::Interface::CLI qw(CleanEnv GetCurrentUser);
 
 CleanEnv();
+if ($opt{config}) {
+    die "Can't find configuration file $opt{config}" unless -f $opt{config};
+    no warnings 'redefine';
+    require RT::Config;
+    my $old = \&RT::Config::Configs;
+    *RT::Config::Configs = sub { return ($opt{config}, $old->(@_)) };
+}
 
 RT->LoadConfig();
 RT->Config->Set( LogToSTDERR => $opt{debug} ? 'debug' : 'warning' );
@@ -76,6 +83,16 @@ L<RT::Extension::Assets::Import::CSV> for configuration.
 
 =over
 
+=item C<--config> I<file> or C<-c> I<file>
+
+Provides an explicit extra configuration file which is loaded before any
+other configuration files.  This is useful to provide per-import
+C<AssetsImportUniqueCF> and C<AssetsImportFieldMapping> settings if you
+are importing from multiple sources with differing columns.  If this
+option is used, F<RT_SiteConfig.pm> should B<not> contain a setting for
+C<AssetsImportFieldMapping> -- otherwise the two hashes will be merged,
+which will produce unexpected behavior.
+
 =item C<--update>
 
 Without this option, existing assets (as determined by matching

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list