Permalink
Browse files

Merge pull request #133 from twinturbo/dynamic-deletion-fix

Add failing test for deleting dynamic dependencies
  • Loading branch information...
2 parents ee992cb + c80c03f commit 65b1e744defa208e313703d89f3453447cc103b2 @wycats wycats committed Feb 27, 2013
@@ -59,6 +59,10 @@ def []=(key, value)
@entries[key] = value
end
+ def clear
+ entries.clear
+ end
+
def empty?
entries.empty?
end
@@ -132,6 +132,7 @@ def invoke
# Remove the project's temporary and output files.
def clean
+ last_manifest.clear
files_to_clean.each { |file| FileUtils.rm_rf(file) }
end
@@ -273,7 +274,7 @@ def digest(str)
end
def dirty?
- assetfile_dirty? || files_dirty? || files_deleted?
+ assetfile_dirty? || files_deleted? || files_dirty?
end
def assetfile_dirty?
@@ -307,7 +308,7 @@ def files_dirty?
end
def files_deleted?
- manifest.files.each_key do |input_file|
+ last_manifest.files.each_key do |input_file|
return true if !File.exists?(input_file)
end
@@ -586,6 +586,24 @@ def delete_files
content.should == "true to trance"
end
+ it "should handle dynamic dependencies being deleted" do
+ project.invoke
+
+ content = File.read output_file
+
+ content.should == EXPECTED_DYNAMIC_OUTPUT
+
+ sleep 1
+
+ imported_file = File.join tmp, "variables.import"
+
+ File.exists?(imported_file).should be_true
+
+ FileUtils.rm_rf imported_file
+
+ project.invoke
+ end
+
it "should not regenerate files when nothing changes" do
project.invoke
previous_mtime = File.mtime output_file
@@ -20,7 +20,7 @@ def additional_dependencies(input)
def includes(input)
input.read.scan(/^@import\(\"(.*)\"\)$/).map(&:first).map do |inc|
File.join(input.root, "#{inc}.import")
- end
+ end.select { |f| File.exists? f }
end
def generate_output(inputs, output)

0 comments on commit 65b1e74

Please sign in to comment.