Browse files

Add failing test for deleting dynamic dependencies

Found in ember's build process.
  • Loading branch information...
1 parent ee992cb commit c80c03fb0fc93fe47d7804a4043eb9c1f4465b64 twinturbo committed Feb 21, 2013
View
4 lib/rake-pipeline/manifest.rb
@@ -59,6 +59,10 @@ def []=(key, value)
@entries[key] = value
end
+ def clear
+ entries.clear
+ end
+
def empty?
entries.empty?
end
View
5 lib/rake-pipeline/project.rb
@@ -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
View
18 spec/rake_acceptance_spec.rb
@@ -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
View
2 spec/support/spec_helpers/filters.rb
@@ -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 c80c03f

Please sign in to comment.