Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use :working_directory instead of :workdir

To look similar as :configuration_file option.
  • Loading branch information...
commit 74b527bc42e552585e84d6a12fc033b1c304ec4a 1 parent 26a9661
Olivier Amblet oliamb authored
2  README.textile
Source Rendered
@@ -33,7 +33,7 @@ end
33 33
34 34 the compass guard accept two options:
35 35
36   - * :workdir: all compass relative path will be computed from there
  36 + * :working_directory: all compass relative path will be computed from there
37 37 * :configuration_file: relative or absolute path to your compass configuration file
38 38
39 39 By default, the working directory is the folder where you run guard in and
12 lib/guard/compass.rb
@@ -17,7 +17,7 @@ class Compass < Guard
17 17 def initialize(watchers = [], options = {})
18 18 super
19 19 @reporter = Reporter.new
20   - @options[:workdir] ||= File.expand_path(File.dirname("."))
  20 + @options[:working_directory] ||= File.expand_path(File.dirname("."))
21 21 end
22 22
23 23 # Guard Interface Implementation
@@ -63,22 +63,22 @@ def perform
63 63 end
64 64
65 65 def create_updater
66   - @updater = ::Compass::Commands::UpdateProject.new(@options[:workdir] , @options)
  66 + @updater = ::Compass::Commands::UpdateProject.new(@options[:working_directory] , @options)
67 67 valid_sass_path?
68 68 end
69 69
70 70 def load_compass_configuration
71 71 ::Compass.default_configuration
72   - config_file = (options[:configuration_file] || ::Compass.detect_configuration_file(options[:workdir]))
  72 + config_file = (options[:configuration_file] || ::Compass.detect_configuration_file(options[:working_directory]))
73 73 unless(config_file.nil?)
74 74 filepath = Pathname.new(config_file)
75 75 if(filepath.relative?)
76   - filepath = Pathname.new([options[:workdir], config_file].join("/"))
  76 + filepath = Pathname.new([options[:working_directory], config_file].join("/"))
77 77 end
78 78 if(filepath.exist?)
79 79 ::Compass.add_configuration filepath
80 80 options[:configuration_file] = filepath.to_s
81   - src_path = Pathname.new( File.expand_path(::Compass.configuration.sass_dir, options[:workdir]) ).relative_path_from(Pathname.pwd)
  81 + src_path = Pathname.new( File.expand_path(::Compass.configuration.sass_dir, options[:working_directory]) ).relative_path_from(Pathname.pwd)
82 82 watchers.clear
83 83 watchers.push Watcher.new("^#{src_path}/.*")
84 84 watchers.push Watcher.new("^#{filepath.relative_path_from(Pathname.pwd)}$")
@@ -93,7 +93,7 @@ def load_compass_configuration
93 93 def valid_sass_path?
94 94 path = Pathname.new(::Compass.configuration.sass_dir)
95 95 if(path.relative?)
96   - path = Pathname.new(@options[:workdir]) + path
  96 + path = Pathname.new(@options[:working_directory]) + path
97 97 end
98 98 unless path.exist?
99 99 reporter.failure("Sass files src directory not found: #{::Compass.configuration.sass_path}\nPlease check your Compass configuration.")
2  spec/fixtures/dsl/simple/Guardfile
... ... @@ -1 +1 @@
1   -guard 'compass', :workdir => 'test', :configuration_file => 'test_also.rb'
  1 +guard 'compass', :working_directory => 'test', :configuration_file => 'test_also.rb'
18 spec/guard/compass_spec.rb
@@ -6,7 +6,7 @@ def create_fixture(name)
6 6 FileUtils.mkdir(TMP_PATH) if ! File.exists? TMP_PATH
7 7 @project_path = "#{TMP_PATH}/#{name}"
8 8 FileUtils.cp_r "#{FIXTURES_PATH}/#{name}", TMP_PATH
9   - subject.options.merge!(:workdir => @project_path)
  9 + subject.options.merge!(:working_directory => @project_path)
10 10 end
11 11
12 12 def remove_fixtures
@@ -27,8 +27,8 @@ def remove_fixtures
27 27 end
28 28
29 29 it "might be initialized with options" do
30   - g = Guard::Compass.new([], :workdir => 'test', :configuration_file => 'test_also')
31   - g.options[:workdir].should == 'test'
  30 + g = Guard::Compass.new([], :working_directory => 'test', :configuration_file => 'test_also')
  31 + g.options[:working_directory].should == 'test'
32 32 g.options[:configuration_file].should == 'test_also'
33 33 end
34 34
@@ -55,7 +55,7 @@ def remove_fixtures
55 55
56 56 describe "default options" do
57 57 it "should have a default path mathching the run location" do
58   - subject.options[:workdir].should == @project_path
  58 + subject.options[:working_directory].should == @project_path
59 59 subject.start.should be_true
60 60 end
61 61 end
@@ -131,7 +131,7 @@ def remove_fixtures
131 131
132 132 it "configure Compass correctly with a path relative to the workdir" do
133 133 subject.options[:configuration_file] = "another_config_location/config.rb"
134   - subject.options[:workdir] = @project_path
  134 + subject.options[:working_directory] = @project_path
135 135 subject.start
136 136 end
137 137
@@ -224,7 +224,7 @@ def remove_fixtures
224 224
225 225 describe "in standard project" do
226 226 subject {
227   - Guard::Compass.new([], :workdir => "#{TMP_PATH}/compass_prj")
  227 + Guard::Compass.new
228 228 }
229 229
230 230 before :each do
@@ -232,7 +232,7 @@ def remove_fixtures
232 232 end
233 233
234 234 it "should have some watchers" do
235   - subject.options.should eql :workdir => "#{TMP_PATH}/compass_prj"
  235 + subject.options.should eql :working_directory => "#{TMP_PATH}/compass_prj"
236 236 subject.start
237 237 subject.watchers.size.should(eql(2), subject.watchers.inspect)
238 238 subject.watchers.first.pattern.should == "^src/.*"
@@ -242,7 +242,7 @@ def remove_fixtures
242 242
243 243 describe "in customized project" do
244 244 subject {
245   - Guard::Compass.new([], :workdir => "#{TMP_PATH}/custom_config_file", :configuration_file => 'another_config_location/config.rb')
  245 + Guard::Compass.new([], :working_directory => "#{TMP_PATH}/custom_config_file", :configuration_file => 'another_config_location/config.rb')
246 246 }
247 247
248 248 before :each do
@@ -263,7 +263,7 @@ def create_fixture(name)
263 263 FileUtils.mkdir(TMP_PATH) if ! File.exists? TMP_PATH
264 264 @project_path = "#{TMP_PATH}/#{name}"
265 265 FileUtils.cp_r "#{FIXTURES_PATH}/#{name}", TMP_PATH
266   - subject.options.merge!(:workdir => @project_path)
  266 + subject.options.merge!(:working_directory => @project_path)
267 267
268 268 Dir.stub!(:pwd).and_return(@project_path)
269 269 Pathname.stub!(:pwd).and_return(Pathname.new(@project_path))
2  spec/guard/dsl_spec.rb
@@ -13,7 +13,7 @@
13 13 Dir.pwd.should == "#{FIXTURES_PATH}/dsl/simple"
14 14
15 15 ::Guard.stub!(:add_guard)
16   - ::Guard.should_receive(:add_guard).with('compass', [], hash_including(:workdir, :configuration_file))
  16 + ::Guard.should_receive(:add_guard).with('compass', [], hash_including(:working_directory, :configuration_file))
17 17 subject.evaluate_guardfile
18 18 end
19 19 end

0 comments on commit 74b527b

Please sign in to comment.
Something went wrong with that request. Please try again.