Exemplo n.º 1
0
        private static async Task <string> HandleHugoBinary(Config config)
        {
            // Take the local one if there is one - no matter the version
            var localHugoPath = GetLocalHugoPath();

            if (File.Exists(localHugoPath))
            {
                return(localHugoPath);
            }

            // If there is no local binary then download the latest or the given one by the user
            var downloader = new HugoDownloader();

            return(await downloader.Download(config.HugoVersion));
        }
Exemplo n.º 2
0
        static async Task Main(string[] args)
        {
            if (args != null && args.Length == 2 && args[0] == "download") // download x.y.z
            {
                var downloader = new HugoDownloader();
                await downloader.Download(args[1], GetLocalHugoPath());

                return; // Exit as this may be executed as part of a docker build
            }

            // This is the part for drone
            var config   = Config.Load();
            var hugoPath = await HandleHugoBinary(config);

            if (config.Validate)
            {
                await DoValidation(config, hugoPath);
            }

            await DoBuild(config, hugoPath);
        }