Sha256: e68955349dcd5b573ceb70dd61aa40b5cd93433ed1b0e029b6393dd68f3cd54c

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

# frozen_string_literal: true

usage 'compile [options]'
summary 'compile items of this site'
description <<~EOS
  Compile all items of the current site.
EOS
flag nil, :diff, 'generate diff'

module Nanoc::CLI::Commands
  class Compile < ::Nanoc::CLI::CommandRunner
    attr_accessor :listener_classes

    def run
      time_before = Time.now

      @site = load_site

      puts 'Compiling siteā€¦'
      compiler = Nanoc::Int::Compiler.new_for(@site)
      listener = Nanoc::CLI::Commands::CompileListeners::Aggregate.new(
        command_runner: self,
        site: @site,
        compiler: compiler,
      )
      listener.run_while do
        compiler.run_until_end
      end

      time_after = Time.now
      puts
      puts "Site compiled in #{format('%.2f', time_after - time_before)}s."
    end
  end
end

runner Nanoc::CLI::Commands::Compile

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nanoc-4.8.12 lib/nanoc/cli/commands/compile.rb
nanoc-4.8.11 lib/nanoc/cli/commands/compile.rb
nanoc-4.8.10 lib/nanoc/cli/commands/compile.rb