Sha256: a9743c51d4906b59be2430b42f04e4b097dc755296a51e16d88ca78e112b1d3b

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

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

module Metanorma
  module Cli
    module Commands
      class Site < ThorWithConfig
        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").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 :no_install_fonts, type: :boolean, desc: "Skip the font installation process"
        option :continue_without_fonts, type: :boolean, desc: "Continue processing even when fonts are missing"

        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

4 entries across 4 versions & 1 rubygems

Version Path
metanorma-cli-1.4.5 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.4.5pre lib/metanorma/cli/commands/site.rb
metanorma-cli-1.4.4 lib/metanorma/cli/commands/site.rb
metanorma-cli-1.4.4pre lib/metanorma/cli/commands/site.rb