Sha256: 0232027aad8fb951fa16ae5cd966689138def7591e2c0c0e402387ca6e46026b

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

require 'guard'
require 'guard/guard'
require 'guard/watcher'

$:.unshift File.expand_path("..", File.dirname(__FILE__))
require 'octopress'

module Guard
  class Jekyll < Guard

    VERSION = '0.0.2'

    # Calls #run_all if the :all_on_start option is present.
    def start
      run_all if options[:all_on_start]
    end

    # Call #run_on_change for all files which match this guard.
    def run_all
      if Watcher.match_files(self, Dir.glob('{,**/}*{,.*}').uniq).size > 0
        Octopress.configurator.write_configs_for_generation
        system "jekyll build #{"--drafts" unless Octopress.env == 'production'}"
        Octopress.configurator.remove_configs_for_generation
      end
    end

    def run_on_changes(_)
      Octopress.configurator.write_configs_for_generation
      system "jekyll build #{"--drafts" unless Octopress.env == 'production'}"
      Octopress.configurator.remove_configs_for_generation
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octopress-3.0.0.alpha2 lib/guard/jekyll.rb
octopress-3.0.0.alpha1 lib/guard/jekyll.rb