Sha256: 51894f1f147031a1dc2d74cc54f7919efac8756b334cc9251c824248e4ef46b9

Contents?: true

Size: 998 Bytes

Versions: 2

Compression:

Stored size: 998 Bytes

Contents

require 'jekyll'

require 'guard/jekyll_plus/config'

require 'guard/jekyll_plus/builder/modifier'
require 'guard/jekyll_plus/builder/adder'
require 'guard/jekyll_plus/builder/remover'
require 'guard/jekyll_plus/builder/rebuilder'

module Guard
  class JekyllPlus < Plugin
    class Builder
      def initialize(config)
        @config = config
        reload
      end

      def reload
        Jekyll.logger.log_level = :error
        @site = ::Jekyll::Site.new(@config.jekyll_config)
        Jekyll.logger.log_level = :info

        @adder = Adder.new(@config, @site)
        @modifier = Modifier.new(@config, @site)
        @remover = Remover.new(@config, @site)
        @rebuilder = Rebuilder.new(@config, @site)
      end

      def build
        @rebuilder.update
      end

      def added(paths)
        @adder.update(paths)
      end

      def modified(paths)
        @modifier.update(paths)
      end

      def removed(paths)
        @remover.update(paths)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guard-jekyll-plus-2.0.2 lib/guard/jekyll_plus/builder.rb
guard-jekyll-plus-2.0.1 lib/guard/jekyll_plus/builder.rb