Sha256: 170096b84f3b179eb5c6c25628b2a6f7232ce451a59ce7a589a60422b75f85f1

Contents?: true

Size: 1.74 KB

Versions: 13

Compression:

Stored size: 1.74 KB

Contents

require "pathname"
require "metanorma/cli/site_generator"
require "metanorma/cli/thor_with_config"

module Metanorma
  module Cli
    module Commands
      class Site < ThorWithConfig
        SITE_OUTPUT_DIRNAME = "_site".freeze

        desc "generate [SOURCE_PATH]", "Generate site from collection"
        option :config, aliases: "-c", desc: "Metanorma configuration file"
        option(
          :output_dir,
          aliases: "-o",
          default: Pathname.new(Dir.pwd).join(SITE_OUTPUT_DIRNAME).to_s,
          desc: "Output directory for generated site",
        )
        option :agree_to_terms, type: :boolean, desc: "Agree / Disagree with all third-party licensing terms "\
                                                      "presented (WARNING: do know what you are agreeing with!)"
        option :install_fonts, type: :boolean, default: true, desc: "Install required fonts"
        option :continue_without_fonts, type: :boolean, desc: "Continue processing even when fonts are missing"
        option :stylesheet, alias: "-s", desc: "Stylesheet file path for rendering HTML page"
        option :template_dir, alias: "-t", desc: "Liquid template directory to render site design"
        option(
          :strict,
          aliases: "-S",
          type: :boolean,
          desc: "Strict compilation: abort if there are any errors",
        )

        def generate(source_path = Dir.pwd)
          Cli::SiteGenerator.generate(
            source_path,
            options,
            filter_compile_options(options),
          )
          UI.say("Site has been generated at #{options[:output_dir]}")
        rescue Cli::Errors::InvalidManifestFileError
          UI.error("Invalid data in: #{options[:config]}")
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
metanorma-cli-1.11.1 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.11.0 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.11 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.10 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.9 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.8 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.7 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.6 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.5 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.3 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.2 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.1 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.10.0 lib/metanorma/cli/commands/site.rb