Пример #1
0
        public static bool SetVersionTag(this ICakeContext context, DirectoryPath repositoryPath, VersionVariables variables)
        {
            #region Arguments check (DupFinder Exclusion)
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (repositoryPath == null)
            {
                throw new ArgumentNullException(nameof(repositoryPath));
            }
            #endregion

            var path = repositoryPath.MakeAbsolute(context.Environment);

            using (context.AddLoggers())
                using (var repository = new Repository(path.FullPath))
                {
                    var version        = SemanticVersion.Parse(variables.FullSemVer);
                    var versionContext = new HgVersionContext((HgRepository)repository);

                    if (versionContext.IsCurrentCommitTagged && version <= versionContext.CurrentCommitTaggedVersion)
                    {
                        return(false);
                    }

                    var commit  = versionContext.CurrentCommit.Hash;
                    var command = new TagCommand()
                                  .WithName(variables.SemVer)
                                  .WithRevision(commit);

                    repository.Tag(command);
                    return(true);
                }
        }
Пример #2
0
        public void TestEnumToString()
        {
            // should escape http urls

            TagCommand command    = TagCommand.SetExclusive;
            string     commandStr = Api.GetCloudinaryParam <TagCommand>(command);

            Assert.AreEqual(commandStr, "set_exclusive");
        }
Пример #3
0
        public void SetUp(int a, int b)
        {
            _mediaId = new MediaInfoCommand(_database).Add(TestConstants.AudioFile).Id;

            _cmd = new TagCommand(_database);

            var reader = _cmd.Select();

            while (reader.Read())
            {
                _cmd.Delete(reader.Current.Id);
            }

            _tagId = _cmd.Insert(Name).Id;
            _cmd.AddMedia(_tagId, _mediaId);
        }
Пример #4
0
        static int Main(string[] args)
        {
            var options = Options.Parse(args);

            if (options.ShowHelp)
            {
                Console.WriteLine(options.PrintHelp());
                return(1);
            }

            var      code    = 0;
            ICommand command = null;

            if (options.ShowAssemblyVersion)
            {
                command = new ShowAssemblyVersionCommand();
            }
            else if (options.Verb == "init")
            {
                command = new InitConfigCommand();
            }
            else if (options.Verb == "major")
            {
                command = new BumpMajorVersionCommand();
            }
            else if (options.Verb == "minor")
            {
                command = new BumpMinorVersionCommand();
            }
            else if (options.Verb == "tag")
            {
                command = new TagCommand();
            }
            else
            {
                command = new DisplayVersionCommand();
            }

            code = command?.Execute(options) ?? -1;

            return(code);
        }