Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Prothero 414 posts 1222 karma points c-trib
    Jul 23, 2014 @ 18:26
    Jason Prothero
    0

    Command-line interface?

    Is there any command line interface or automation around this tool (like uSync) for working within a Continuous Integration environment?

     

    Thanks,
    Jason

  • Kenn Jacobsen 133 posts 791 karma points MVP c-trib
    Jul 24, 2014 @ 07:48
    Kenn Jacobsen
    0

    Hi!

    Not at the moment, no. I'm considering creating something with the Web API at some point, to support export, analysis and import, but to be honest, I haven't had the time to work on this project in a while.

    The Umport API is all public, tho', so you can roll one on your own. Here's an example of what it could look like:

    using Umport;
    
    namespace ContinuousIntegration {
    
        public class ContinuousIntegrationHandler {
    
            public bool Import() {
                var log = Import(true);
                if (log.HasError) {
                    // do some error handling
                    return false;
                }
                if (log.HasWarning) {
                    // do some warning handling
                    return false;
                }
                return true;
            }
    
            private Logger Import(bool deleteItems) {
                var log = new Logger();
                if (Importer.Ready(log) == false) {
                    return log;
                }
    
                log.Information("Importing data types...");
                var result = Importer.ImportDataTypeDefinitions(log, deleteItems);
                if (result == false) {
                    return log;
                }
                Umport.Analyzer.
                log.Information("Importing templates...");
                result = Importer.ImportTemplates(log, deleteItems);
                if (result == false) {
                    return log;
                }
    
                log.Information("Importing document types...");
                result = Importer.ImportDocumentTypes(log, deleteItems);
                if (result == false) {
                    return log;
                }
    
                log.Information("Importing macros...");
                result = Importer.ImportMacros(log, deleteItems);
                if (result == false) {
                    return log;
                }
    
                log.Information("Importing media types...");
                result = Importer.ImportMediaTypes(log, deleteItems);
                if (result == false) {
                    return log;
                }
    
                log.Information("Importing member types...");
                result = Importer.ImportMemberTypes(log, deleteItems);
                if (result == false) {
                    return log;
                }
    
                log.Information("Importing member group...");
                Importer.ImportMemberGroups(log, deleteItems);
    
                return log;
            }
        }
    }
    

    Of course this requires that you've copied your XML files to the target environment prior to running the import.

    The analyzer (Umport.Analyzer) works in a similar way, if you want to play around with that.

Please Sign in or register to post replies

Write your reply to:

Draft