From 651dbd366d104c25b241c21b74d7642dfd4f369c Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 16 Oct 2012 19:06:08 +0200 Subject: [PATCH] add back guard for @svenfuchs --- Guardfile | 7 +++++++ Guardfile.phantom | 6 ++++++ lib/guard/assets.rb | 41 +++++++++++++++++++++++++++++++++++++++++ lib/guard/specs.rb | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 Guardfile create mode 100644 Guardfile.phantom create mode 100644 lib/guard/assets.rb create mode 100644 lib/guard/specs.rb diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..7d9e087e --- /dev/null +++ b/Guardfile @@ -0,0 +1,7 @@ +$: << 'lib' + +guard 'assets' do + watch(%r(^Assetfile)) + watch(%r(^assets)) +end + diff --git a/Guardfile.phantom b/Guardfile.phantom new file mode 100644 index 00000000..504f0dc6 --- /dev/null +++ b/Guardfile.phantom @@ -0,0 +1,6 @@ +$: << 'lib' + +guard 'specs' do + watch(%r(^public)) +end + diff --git a/lib/guard/assets.rb b/lib/guard/assets.rb new file mode 100644 index 00000000..ea0d20f0 --- /dev/null +++ b/lib/guard/assets.rb @@ -0,0 +1,41 @@ +$stdout.sync = true + +require 'guard' +require 'guard/guard' +require 'rake-pipeline' + +module Guard + class Assets < Guard + def start + UI.info "Guard::Assets is running." + run + end + + def run_all + run + end + + def reload + run + end + + def run_on_change(paths) + puts "change: #{paths.inspect}" + run + end + + private + + def run + started = Time.now + print 'Compiling ... ' + project.invoke_clean + puts "done (#{(Time.now - started).round(2)}s)." + end + + def project + @project ||= Rake::Pipeline::Project.new('./Assetfile') + end + end +end + diff --git a/lib/guard/specs.rb b/lib/guard/specs.rb new file mode 100644 index 00000000..a2282274 --- /dev/null +++ b/lib/guard/specs.rb @@ -0,0 +1,35 @@ +$stdout.sync = true + +require 'guard' +require 'guard/guard' + +module Guard + class Specs < Guard + def start + UI.info "Guard::Specs is running." + run + end + + def run_all + run + end + + def reload + run + end + + def run_on_change(paths) + puts "change: #{paths.inspect}" + run + end + + private + + def run + system './run_jasmine.coffee public/spec.html' + end + end +end + + +