Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean the code a bit

  • Loading branch information...
commit 6a0b2cbb31b60d4ed86dfddece355884a2b6af46 1 parent c363edc
@rymai rymai authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 lib/guard/sprockets.rb
  2. +1 −1  spec/guard/sprockets_spec.rb
View
6 lib/guard/sprockets.rb
@@ -15,11 +15,11 @@ def initialize(watchers = [], options = {})
@options = options
@asset_paths = Array(@options[:asset_paths] || 'app/assets/javascripts')
@destination = @options[:destination] || 'public/javascripts'
- @root_file = Array(@options[:root_file]) if @options[:root_file]
+ @root_file = Array(@options[:root_file])
@sprockets = ::Sprockets::Environment.new
@asset_paths.each { |p| @sprockets.append_path(p) }
- @root_file.each{|f| @sprockets.append_path(Pathname.new(f).dirname) } if @root_file
+ @root_file.each { |f| @sprockets.append_path(Pathname.new(f).dirname) }
if @options.delete(:minify)
begin
@@ -46,7 +46,7 @@ def run_all
end
def run_on_changes(paths)
- paths = @root_file if @root_file
+ paths = @root_file unless @root_file.empty?
success = true
paths.each do |file|
View
2  spec/guard/sprockets_spec.rb
@@ -21,7 +21,7 @@
end
describe 'root_file' do
- it { described_class.new.root_file.should be_nil }
+ it { described_class.new.root_file.should eq [] }
it { described_class.new([], :root_file => 'foo/bar').root_file.should eq ['foo/bar'] }
it { described_class.new([], :root_file => %w(a b c)).root_file.should eq %w(a b c) }
end
Please sign in to comment.
Something went wrong with that request. Please try again.