Example #1
0
        private bool FromFolderToZip()
        {
            var package        = new DirectoryBoilerplate(_source, _ignoreExpression, _skipExtensions);
            var tempFolderName = PathHelper.GetTempName();

            Directory.CreateDirectory(tempFolderName);
            if (package.BuildScaffold(tempFolderName, _replacements, _logger))
            {
                try
                {
                    _logger(LogItem.Info("packing scaffold..."));
                    if (_overwrite && File.Exists(_target))
                    {
                        File.Delete(_target);
                    }
                    ZipFile.CreateFromDirectory(tempFolderName, _target);
                    return(true);
                }
                finally
                {
                    try
                    {
                        Directory.Delete(tempFolderName, true);
                    }
                    catch { }
                }
            }
            return(false);
        }
Example #2
0
        private bool FromFolderToFolder()
        {
            var package = new DirectoryBoilerplate(_source, _ignoreExpression, _skipExtensions);

            return(package.BuildScaffold(_target, _replacements, _logger));
        }