From 949c7c17e2d2c2f1172a15d1ab366e66fac15263 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 29 Sep 2011 14:25:30 -0400 Subject: [PATCH] add basic readme, mess w/ logging some more --- README.md | 7 +++++++ lib/guard/lacquer.rb | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..41d5a9f --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +Using [Varnish](https://www.varnish-cache.org/) with your app? Want to test your caching goodness locally first? Don't want to deal with +craaaazy global VCLs or manually restarting things? `guard-lacquer` is what you want! + +It wraps up the server running parts of Lacquer, abstracts out their Rails-isms, and starts and stops them just like any other Guard! +If you don't have a `config/config.vcl.erb` file in your app for use with Lacquer, it copies that over for you, too. + + diff --git a/lib/guard/lacquer.rb b/lib/guard/lacquer.rb index 3513a03..ce4cfb6 100644 --- a/lib/guard/lacquer.rb +++ b/lib/guard/lacquer.rb @@ -32,8 +32,8 @@ module Guard ) end - @frontend = Varnishd.new(@options) - @logger = VarnishNCSA.new(@options) + @runners = [ Varnishd.new(@options) ] + @runners << VarnishNCSA.new(@options) if @options[:log_dir] if !File.file?(varnish_erb = 'config/varnish.vcl.erb') UI.info "No config/varnish.vcl.erb found, copying default from Lacquer..." @@ -44,7 +44,7 @@ module Guard end def start - [ @frontend, @logger ].each do |which| + @runners.each do |which| which.stop if which.running? which.start end @@ -53,7 +53,7 @@ module Guard end def stop - [ @frontend, @logger ].each(&:stop) + @runners.each(&:stop) notify "Until next time..." end