Exemplo n.º 1
0
 public CommandExecutorInteractive(
     CommandArguments args,
     IScriptProvider scriptProvider,
     IFlubuSession flubuSession,
     IScriptProperties scriptProperties,
     ILogger <CommandExecutorInteractive> log)
 {
     _args             = args;
     _scriptProvider   = scriptProvider;
     _flubuSession     = flubuSession;
     _scriptProperties = scriptProperties;
     _log = log;
 }
 public CommandExecutorInteractive(
     CommandArguments args,
     IScriptProvider scriptProvider,
     IFlubuSession flubuSession,
     IScriptProperties scriptProperties,
     ILogger <CommandExecutorInteractive> log,
     IFlubuTemplateTasksExecutor flubuTemplateTasksExecutor)
     : base(flubuSession, args, flubuTemplateTasksExecutor)
 {
     _scriptProvider   = scriptProvider;
     _flubuSession     = flubuSession;
     _scriptProperties = scriptProperties;
     _log = log;
 }
        public ScriptPropertiesSetterTests()
        {
            _scriptProperties = new ScriptProperties();

            var sp = new ServiceCollection().AddTransient <ITarget, TargetFluentInterface>()
                     .AddTransient <ICoreTaskFluentInterface, CoreTaskFluentInterface>()
                     .AddTransient <ITaskFluentInterface, TaskFluentInterface>()
                     .AddTransient <ILinuxTaskFluentInterface, LinuxTaskFluentInterface>()
                     .AddTransient <IIisTaskFluentInterface, IisTaskFluentInterface>()
                     .AddTransient <IWebApiFluentInterface, WebApiFluentInterface>()
                     .AddSingleton <IHttpClientFactory, HttpClientFactory>()

                     .BuildServiceProvider();

            _flubuSession = new FlubuSession(new Mock <ILogger <FlubuSession> >().Object, new TargetTree(null, null), new CommandArguments(), new ScriptFactory(sp), new Mock <ITaskFactory>().Object, new FluentInterfaceFactory(sp), null, null);
        }
Exemplo n.º 4
0
 public CommandExecutorInteractive(
     CommandArguments args,
     IScriptProvider scriptProvider,
     IFlubuSession flubuSession,
     IScriptProperties scriptProperties,
     IFlubuCommandParser parser,
     IFileWrapper fileWrapper,
     IBuildScriptLocator buildScriptLocator,
     ILogger <CommandExecutorInteractive> log)
 {
     _args               = args;
     _scriptProvider     = scriptProvider;
     _flubuSession       = flubuSession;
     _scriptProperties   = scriptProperties;
     _parser             = parser;
     _fileWrapper        = fileWrapper;
     _buildScriptLocator = buildScriptLocator;
     _log = log;
 }
Exemplo n.º 5
0
        public int Run(IFlubuSession flubuSession)
        {
            _flubuSession     = flubuSession;
            _scriptProperties = flubuSession.ScriptFactory.CreateScriptProperties();
            _targetCreator    = flubuSession.ScriptFactory.CreateTargetCreator();

            try
            {
                ConfigureDefaultProps(flubuSession);
                BeforeBuildExecution(flubuSession);
                RunBuild(flubuSession);
                flubuSession.Complete();
                AfterBuildExecution(flubuSession);
                return(0);
            }
            catch (TargetNotFoundException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);
                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                flubuSession.LogError($"{Environment.NewLine}{e.Message}");
                return(3);
            }
            catch (WebApiException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);
                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(1);
            }
            catch (FlubuException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);

                if (!flubuSession.Args.RethrowOnException)
                {
#if !NETSTANDARD1_6
                    flubuSession.LogError($"ERROR: {e.Message}", Color.Red);
#else
                    flubuSession.LogError($"error: {e.Message}");
#endif
                }

                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(1);
            }
            catch (Exception e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);

                if (!flubuSession.Args.RethrowOnException)
                {
#if !NETSTANDARD1_6
                    flubuSession.LogError($"ERROR: {e}", Color.Red);
#else
                    flubuSession.LogError($"error: {e}");
#endif
                }

                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(2);
            }
        }
Exemplo n.º 6
0
        public int Run(IFlubuSession flubuSession)
        {
            _flubuSession       = flubuSession;
            _scriptProperties   = flubuSession.ScriptServiceProvider.GetScriptProperties();
            _targetCreator      = flubuSession.ScriptServiceProvider.GetTargetCreator();
            _flubuConfiguration = flubuSession.ScriptServiceProvider.GetFlubuConfiguration();

            try
            {
                ConfigureDefaultProps(flubuSession);
                BeforeBuildExecution(flubuSession);
                RunBuild(flubuSession);
                flubuSession.Complete();
                AfterBuildExecution(flubuSession);
                return(0);
            }
            catch (TargetNotFoundException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);
                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                flubuSession.LogError($"{Environment.NewLine}{e.Message}");
                return(3);
            }
            catch (WebApiException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);
                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(1);
            }
            catch (FlubuException e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);

                if (!flubuSession.Args.RethrowOnException)
                {
                    flubuSession.LogError($"ERROR: {e.Message}", Color.Red);
                }

                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(1);
            }
            catch (Exception e)
            {
                flubuSession.ResetDepth();
                OnBuildFailed(flubuSession, e);

                if (!flubuSession.Args.RethrowOnException)
                {
                    flubuSession.LogError($"ERROR: {e}", Color.Red);
                }

                AfterBuildExecution(flubuSession);
                if (flubuSession.Args.RethrowOnException)
                {
                    throw;
                }

                return(2);
            }
        }