Browse files

Fix a bug where Guard cannot be shutted down.

This was because the stop method was not
retrieving true but nil instead.

This patch include that all method of the
interface now return true just in case...
  • Loading branch information...
1 parent 2f71371 commit fdabe4bc6babfebcc14485e2b48b2f5774b344df @oliamb oliamb committed Oct 26, 2010
Showing with 15 additions and 11 deletions.
  1. +8 −4 lib/guard/compass.rb
  2. +7 −7 spec/guard/compass_spec.rb
View
12 lib/guard/compass.rb
@@ -9,12 +9,11 @@ module Guard
class Compass < Guard
attr_reader :updater
- VERSION = '0.0.5'
+ VERSION = '0.0.6'
def initialize(watchers = [], options = {})
- @watchers, @options = watchers, options
super
- @options.merge!(:path => File.expand_path(File.dirname(".")) )
+ @options[:workdir] = File.expand_path(File.dirname("."))
end
# Guard Interface Implementation
@@ -23,30 +22,35 @@ def initialize(watchers = [], options = {})
def start
create_updater
UI.info "Guard::Compass is watching at your stylesheets."
+ true
end
def stop
@updater = nil
+ true
end
# Reload the configuration
def reload
create_updater
+ true
end
# Compile all the sass|scss stylesheets
def run_all
@updater.execute
+ true
end
# Compile the changed stylesheets
def run_on_change(paths)
@updater.execute
+ true
end
private
def create_updater
- @updater = ::Compass::Commands::UpdateProject.new(@options[:path], @options)
+ @updater = ::Compass::Commands::UpdateProject.new(@options[:workdir] , @options)
end
end
end
View
14 spec/guard/compass_spec.rb
@@ -12,7 +12,7 @@
describe "start" do
it "supports creation of the updater instance" do
subject.updater.should be_nil
- subject.start
+ subject.start.should be_true
subject.updater.should_not be_nil
end
@@ -23,8 +23,8 @@
describe "default options" do
it "should have a default path mathching the run location" do
- subject.options[:path].should == File.expand_path(".")
- subject.start
+ subject.options[:workdir].should == File.expand_path(".")
+ subject.start.should be_true
end
end
@@ -34,7 +34,7 @@
FileUtils.mkdir(TMP_PATH) if ! File.exists? TMP_PATH
@project_path = TMP_PATH + '/compass_prj'
FileUtils.cp_r FIXTURES_PATH + '/compass_prj', TMP_PATH
- subject.options.merge!(:path => @project_path)
+ subject.options.merge!(:workdir => @project_path)
subject.start
end
@@ -47,7 +47,7 @@
describe "stop" do
it "Stop remove the updater" do
subject.updater.should_not be_nil
- subject.stop
+ subject.stop.should be_true
subject.updater.should be_nil
end
end
@@ -56,7 +56,7 @@
it "rebuilds all scss files in compass path" do
File.exists?(@project_path + "/src/screen.scss").should(be_true)
File.exists?(@project_path + "/stylesheets/screen.css").should be_false
- subject.run_on_change(@project_path + "/src/screen.scss")
+ subject.run_on_change(@project_path + "/src/screen.scss").should be_true
File.exists?(@project_path + "/stylesheets/screen.css").should be_true
end
end
@@ -65,7 +65,7 @@
it "rebuilds all scss files in compass path" do
File.exists?(@project_path + "/src/screen.scss").should(be_true)
File.exists?(@project_path + "/stylesheets/screen.css").should be_false
- subject.run_all
+ subject.run_all.should be_true
File.exists?(@project_path + "/stylesheets/screen.css").should be_true
end
end

0 comments on commit fdabe4b

Please sign in to comment.