コード例 #1
0
        public static void Main(string[] args)
        {
            try
            {
                // ============================================================
                // Parses the arguments using the CommandLine Parsing Library
                // ============================================================
                DeployerOptions options = new DeployerOptions();

                if (CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    // -------------------------------------------------
                    // Gets the credentials based on the arguments
                    // -------------------------------------------------
                    ICredentials credentials = GetAuthenticationCredentials(options.Environment, options.PromptCredentials);


                    // -------------------------------------------------
                    // Tokenizes the deployer's working directory
                    // -------------------------------------------------
                    logger.Section("Tokenizing working directory", LogLevel.Info);
                    Tokenizer tokenizer = new Tokenizer(Path.Combine(options.WorkingDirectory, ConfigurationManager.AppSettings[APP_SETTING_TOKENS_FILE]));
                    string    tokenizedWorkingDirectory = tokenizer.TokenizeFolder(options.WorkingDirectory);


                    // -------------------------------------------------
                    // Initializes the deployer
                    // -------------------------------------------------
                    logger.Section("Initializing deployer", LogLevel.Info);
                    Deployer deployer = new Deployer(tokenizedWorkingDirectory, options.Environment, credentials);


                    // -------------------------------------------------
                    // Starts the deployment
                    // -------------------------------------------------
                    logger.Section("Launching deployer", LogLevel.Info);
                    deployer.Launch();

                    Environment.Exit((int)ExitCode.Success);
                }
            }
            catch (Exception e)
            {
                logger.Error(e, e.Message);
                Environment.Exit((int)ExitCode.Failure);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: PaoloPia/PnP
        public static void Main(string[] args)
        {
            try
            {
                // ============================================================
                // Parses the arguments using the CommandLine Parsing Library
                // ============================================================
                DeployerOptions options = new DeployerOptions();

                if (CommandLine.Parser.Default.ParseArguments(args, options))
                {
                    // -------------------------------------------------
                    // Gets the credentials based on the arguments
                    // -------------------------------------------------
                    ICredentials credentials = GetAuthenticationCredentials(options.Environment, options.PromptCredentials);

                    // -------------------------------------------------
                    // Tokenizes the deployer's working directory
                    // -------------------------------------------------
                    logger.Section("Tokenizing working directory", LogLevel.Info);
                    Tokenizer tokenizer = new Tokenizer(Path.Combine(options.WorkingDirectory, ConfigurationManager.AppSettings[APP_SETTING_TOKENS_FILE]));
                    string tokenizedWorkingDirectory = tokenizer.TokenizeFolder(options.WorkingDirectory);

                    // -------------------------------------------------
                    // Initializes the deployer
                    // -------------------------------------------------
                    logger.Section("Initializing deployer", LogLevel.Info);
                    Deployer deployer = new Deployer(tokenizedWorkingDirectory, options.Environment, credentials);

                    // -------------------------------------------------
                    // Starts the deployment
                    // -------------------------------------------------
                    logger.Section("Launching deployer", LogLevel.Info);
                    deployer.Launch();

                    Environment.Exit((int)ExitCode.Success);
                }
            }
            catch (Exception e)
            {
                logger.Error(e, e.Message);
                Environment.Exit((int)ExitCode.Failure);
            }
        }