Skip to content

Instantly share code, notes, and snippets.

@patrickward
Created January 15, 2012 14:17
Show Gist options
  • Select an option

  • Save patrickward/1615980 to your computer and use it in GitHub Desktop.

Select an option

Save patrickward/1615980 to your computer and use it in GitHub Desktop.
Using Guard programmatically
require 'guard/willow'
config = @global_config
options = Willow.configure(config)
paths = options[:paths]
source = File.expand_path(options[:source])
guardfile = <<-EOS
guard 'willow', :source => '#{source}' do
watch(%r{^#{paths[:assets]}/.*})
watch(%r{^#{paths[:pages]}/.*})
watch(%r{^#{paths[:posts]}/.*})
watch(%r{^#{paths[:public]}/.*})
watch(%r{^#{paths[:layouts]}/.*})
watch(%r{^#{paths[:plugins]}/.*})
end
EOS
# Guard.setup(watchdir: source)
# Guard::Dsl.evaluate_guardfile(guardfile_contents: guardfile)
# Guard::Dsl.evaluate_guardfile
Guard.start(guardfile_contents: guardfile, watchdir: source)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment