示例#1
0
        /// <summary>
        /// Specifies one or more configuration file(s) instead of using `_config.yml` automatically.
        /// Settings in later files override settings in earlier files.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="configurationFilePaths">One or more custom configuration file(s).</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="configurationFilePaths"/> provided.</returns>
        public static JekyllCleanSettings WithConfiguration(this JekyllCleanSettings settings, params FilePath[] configurationFilePaths)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Configuration = configurationFilePaths;

            return(settings);
        }
示例#2
0
        /// <summary>
        /// Sets the Site Source directory, the directory where Jekyll will read files (defaults to `./`).
        /// -s, --source DIR
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="sourceDirectoryPath">The source directory (defaults to `./`).</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="sourceDirectoryPath"/> provided.</returns>
        public static JekyllCleanSettings SetSource(this JekyllCleanSettings settings, DirectoryPath sourceDirectoryPath)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Source = sourceDirectoryPath;

            return(settings);
        }
示例#3
0
        /// <summary>
        /// Sets the log level which should be used to run the Jekyll command.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="logLevel">Log level which should be used to run the Jekyll command.</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="logLevel"/> provided.</returns>
        public static JekyllCleanSettings SetLogLevel(this JekyllCleanSettings settings, JekyllLogLevel?logLevel)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.LogLevel = logLevel;

            return(settings);
        }
示例#4
0
        /// <summary>
        /// Specifies if Bundler should not be used to execute Jekyll.
        /// `jekyll` instead of `bundle exec`...
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="enable"><see langword="true"/> to use Bundler to execute Jekyll, otherwise <see langword="false"/>.</param>
        /// <exception cref="ArgumentNullException"/>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllSettings.DoNotUseBundler"/> property updated with the value provided in <paramref name="enable"/>.</returns>
        public static JekyllCleanSettings DoNotUseBundler(this JekyllCleanSettings settings, bool?enable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.DoNotUseBundler = enable;

            return(settings);
        }
示例#5
0
        /// <summary>
        /// Sets the layout directory instead of using `_layouts/` automatically
        /// --layouts DIR
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="layoutsDirectory">The layouts directory (defaults to ./_layouts).</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="layoutsDirectory"/> provided.</returns>
        public static JekyllCleanSettings SetLayouts(this JekyllCleanSettings settings, DirectoryPath layoutsDirectory)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Layouts = layoutsDirectory;

            return(settings);
        }
示例#6
0
        /// <summary>
        /// Sets if the full backtrace should be shown when an error occurs.
        /// -t, --trace
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="enable"><see langword="true"/> to show the full backtrace when an error occurs, otherwise <see langword="false"/>.</param>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllCleanSettings.Trace"/> property updated with the value provided in <paramref name="enable"/>.</returns>
        public static JekyllCleanSettings EnableTrace(this JekyllCleanSettings settings, bool enable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Trace = enable;

            return(settings);
        }
示例#7
0
        /// <summary>
        /// Sets if the build should fail if there is a YAML syntax error in a page's front matter.
        /// --strict_front_matter
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="enable"><see langword="true"/> to fail if errors are present in front matter, otherwise <see langword="false"/>.</param>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllCleanSettings.StrictFrontMatter"/> property updated with the value provided in <paramref name="enable"/>.</returns>
        public static JekyllCleanSettings UseStrictFrontMatter(this JekyllCleanSettings settings, bool enable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.StrictFrontMatter = enable;

            return(settings);
        }
示例#8
0
        /// <summary>
        /// Sets the Plugins directory instead of using `_plugins/` automatically.
        /// -p, --plugins DIR1[,DIR2,...]
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="pluginDirectoryPaths">One or more plugin directory path(s).</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="pluginDirectoryPaths"/> provided.</returns>
        public static JekyllCleanSettings WithPlugins(this JekyllCleanSettings settings, params DirectoryPath[] pluginDirectoryPaths)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Plugins = pluginDirectoryPaths;

            return(settings);
        }
示例#9
0
        /// <summary>
        /// Sets if caching to disk in non-safe mode should be disabled.
        /// --disable-disk-cache
        ///
        /// Disable caching of content to disk in order to skip creating a `.jekyll-cache` or similar
        /// directory at the source to avoid interference with virtual environments and third-party
        /// directory watchers. Caching to disk is always disabled in safe mode.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="disable"><see langword="true"/> to disable caching to disk in non-safe mode, otherwise <see langword="false"/>.</param>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllCleanSettings.DisableDiskCache"/> property updated with the value provided in <paramref name="disable"/>.</returns>
        public static JekyllCleanSettings DisableDiskCache(this JekyllCleanSettings settings, bool disable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.DisableDiskCache = disable;

            return(settings);
        }
示例#10
0
        /// <summary>
        /// Sets if posts that were marked as unpublished should be rendered.
        /// --unpublished
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="enable"><see langword="true"/> to render posts that were marked as unpublished, otherwise <see langword="false"/>.</param>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllCleanSettings.Unpublished"/> property updated with the value provided in <paramref name="enable"/>.</returns>
        public static JekyllCleanSettings RenderUnpublished(this JekyllCleanSettings settings, bool enable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Unpublished = enable;

            return(settings);
        }
示例#11
0
        /// <summary>
        /// Sets if polling should be used when watching for changes.
        /// --force_polling
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="enable"><see langword="true"/> to force polling when watching for changes, otherwise <see langword="false"/>.</param>
        /// <returns>The <paramref name="settings"/> instance with the <see cref="JekyllCleanSettings.ForcePolling"/> property updated with the value provided in <paramref name="enable"/>.</returns>
        public static JekyllCleanSettings ForcePolling(this JekyllCleanSettings settings, bool enable = true)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.ForcePolling = enable;

            return(settings);
        }
示例#12
0
        /// <summary>
        /// Sets the base URL to serve the website from.
        /// -b, --baseurl URL
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="baseUrl">The base URL to serve the website from.</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="baseUrl"/> provided.</returns>
        public static JekyllCleanSettings SetBaseUrl(this JekyllCleanSettings settings, string baseUrl)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.BaseUrl = baseUrl;

            return(settings);
        }
示例#13
0
        /// <summary>
        /// Sets a limit to the number of posts to parse and publish.
        /// --limit_posts NUM
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="maxPosts">The maximum number of posts to parse and publish.</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="maxPosts"/> provided.</returns>
        public static JekyllCleanSettings LimitPosts(this JekyllCleanSettings settings, int?maxPosts)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.LimitPosts = maxPosts;

            return(settings);
        }
示例#14
0
        /// <summary>
        /// Sets the Site Destination directory (defaults to `./_site`).
        /// -d, --destination DIR
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="destinationDirectoryPath">The destination directory (defaults to `./_site`).</param>
        /// <returns>The <paramref name="settings"/> instance with updated with the <paramref name="destinationDirectoryPath"/> provided.</returns>
        public static JekyllCleanSettings SetDestination(this JekyllCleanSettings settings, DirectoryPath destinationDirectoryPath)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            settings.Destination = destinationDirectoryPath;

            return(settings);
        }
示例#15
0
        /// <summary>
        /// Sets the working directory which should be used to run the Jekyll command.
        /// </summary>
        /// <param name="settings">The settings.</param>
        /// <param name="path">Working directory which should be used to run the Jekyll command.</param>
        /// <exception cref="ArgumentNullException"/>
        /// <returns>The <paramref name="settings"/> instance with <see cref="Cake.Core.Tooling.ToolSettings.WorkingDirectory"/> set to <paramref name="path"/>.</returns>
        public static JekyllCleanSettings SetWorkingDirectory(this JekyllCleanSettings settings, DirectoryPath path)
        {
            if (settings is null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (path is null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            settings.WorkingDirectory = path;

            return(settings);
        }