Exemple #1
0
        public void Push(BuildItem nupkgFile, Action <PushArgs> config)
        {
            using (_tracer.StartTask("Nuget - Push"))
            {
                var args = new PushArgs();
                if (config != null)
                {
                    config(args);
                }

                _tracer.Info("Pushing '{0}' to '{1}'.", nupkgFile, args.Source);
                ExecNuget(
                    GetExecutable(args.ToolPath),
                    "push \"{0}\" ".F(nupkgFile) + GetArguments(args),
                    args.Timeout);
            }
        }
Exemple #2
0
        private string GetArguments(PushArgs args)
        {
            var list = GetBaseArguments(args);

            if (args.ApiKey != null)
            {
                list.Add(args.ApiKey);
            }

            if (args.Source != null)
            {
                list.Add("-Source \"{0}\"".F(args.Source));
            }

            if (args.Timeout.HasValue)
            {
                list.Add("-Timeout {0}".F(args.Timeout.Value.Seconds));
                args.Timeout = null; // timeout handled by nuget...
            }

            return(string.Join(" ", list));
        }