Class: Jekyll::Commands::Build

### Home Classes Methods

### In Files

- lib/jekyll/commands/build.rb

### Parent

Jekyll::Command

### Methods

- ::build
- ::process
- ::watch

### Files

- LICENSE

### Class/Module Index

Quicksearch

- Jekyll
- Jekyll::Command
- Jekyll::Commands
- Jekyll::Commands::Build
- Jekyll::Commands::Doctor
- Jekyll::Commands::New
- Jekyll::Commands::Serve
- Jekyll::Configuration
- Jekyll::Converter
- Jekyll::Converters
- Jekyll::Converters::Identity
- Jekyll::Converters::Markdown
- Jekyll::Converters::Markdown::KramdownParser
- Jekyll::Converters::Markdown::MarukuParser
- Jekyll::Converters::Markdown::RDiscountParser
- Jekyll::Converters::Markdown::RedcarpetParser
- Jekyll::Converters::Markdown::RedcarpetParser::CommonMethods
- Jekyll::Converters::Markdown::RedcarpetParser::WithPygments
- Jekyll::Converters::Markdown::RedcarpetParser::WithoutPygments
- Jekyll::Converters::Textile
- Jekyll::Convertible
- Jekyll::Deprecator
- Jekyll::Draft
- Jekyll::Excerpt
- Jekyll::FatalException
- Jekyll::Filters
- Jekyll::Generator
- Jekyll::Generators
- Jekyll::Generators::Pagination
- Jekyll::GistTag
- Jekyll::Layout
- Jekyll::Page
- Jekyll::Pager
- Jekyll::Plugin
- Jekyll::Post
- Jekyll::RelatedPosts
- Jekyll::Site
- Jekyll::Site::Cleaner
- Jekyll::StaticFile
- Jekyll::Stevenson
- Jekyll::Tags
- Jekyll::Tags::HighlightBlock
- Jekyll::Tags::IncludeTag
- Jekyll::Tags::PostComparer
- Jekyll::Tags::PostUrl
- Jekyll::URL
- Date
- Enumerable
- Hash
- Object

No matching classes.

# Jekyll::Commands::Build

### Public Class Methods

build(site, options) click to toggle source

Private: Build the site from source into destination.

site - A Jekyll::Site instance options - A Hash of options passed to the command

Returns nothing.

    # File lib/jekyll/commands/build.rb, line 17
    def self.build(site, options)
      source = options['source']
      destination = options['destination']
      Jekyll.logger.info "Source:", source
      Jekyll.logger.info "Destination:", destination
      print Jekyll.logger.formatted_topic "Generating..."
      self.process_site(site)
      puts "done."
    end

process(options) click to toggle source

    # File lib/jekyll/commands/build.rb, line 4
    def self.process(options)
      site = Jekyll::Site.new(options)

      self.build(site, options)
      self.watch(site, options) if options['watch']
    end

watch(site, options) click to toggle source

Private: Watch for file changes and rebuild the site.

site - A Jekyll::Site instance options - A Hash of options passed to the command

Returns nothing.

    # File lib/jekyll/commands/build.rb, line 33
    def self.watch(site, options)
      require 'directory_watcher'

      source = options['source']
      destination = options['destination']

      Jekyll.logger.info "Auto-regeneration:", "enabled"

      dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
      dw.interval = 1

      dw.add_observer do |*args|
        t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
        print Jekyll.logger.formatted_topic("Regenerating:") + "#{args.size} files at #{t} "
        self.process_site(site)
        puts  "...done."
      end

      dw.start

      unless options['serving']
        trap("INT") do
          puts "     Halting auto-regeneration."
          exit 0
        end

        loop { sleep 1000 }
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.