Skip to content

Commit

Permalink
Second exclude should not overwrite first one
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedor Kocherga committed Oct 20, 2009
1 parent 548da8e commit e9d495d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
5 changes: 4 additions & 1 deletion examples/integration/archive_integration_example.rb
Expand Up @@ -42,6 +42,7 @@
archive :test1 do
files src
exclude "#{src}/q/w"
exclude "#{src}/q/w/e"
end
end
end
Expand Down Expand Up @@ -74,6 +75,8 @@
it "should only include qwe 1 and 2 (no 3)" do
File.exists?("#{@test}/qwe1").should be_true
File.exists?("#{@test}/q/qwe2").should be_true
File.exists?("#{@test}/q/w/qwe3").should be_false
File.exists?("#{@test}/q/w/e/qwe4").should be_false
end

it "should preserve file content" do
Expand All @@ -83,4 +86,4 @@
end
end

end
end
2 changes: 1 addition & 1 deletion examples/unit/archive_example.rb
Expand Up @@ -64,4 +64,4 @@ def archive(id = :foo, config = def_config)
archive(:foo, {:files => ["foo", "bar"]}).send(:tar_files).should == "foo bar"
end
end
end
end
2 changes: 1 addition & 1 deletion lib/astrails/safe/archive.rb
Expand Up @@ -21,4 +21,4 @@ def tar_files

end
end
end
end
16 changes: 10 additions & 6 deletions lib/astrails/safe/config/node.rb
Expand Up @@ -27,13 +27,17 @@ def find(*path)
alias :[] :find

def set(key, value, &block)
@data[key.to_s] =
if value.is_a?(Hash)
Node.new(self, value, &block)
if value.is_a?(Hash)
@data[key.to_s] = Node.new(self, value, &block)
else
raise(ArgumentError, "#{key}: no block supported for simple values") if block
if @data[key.to_s] && value
@data[key.to_s] = @data[key.to_s].to_a + value.to_a
else
raise(ArgumentError, "#{key}: no block supported for simple values") if block
value
@data[key.to_s] = value
end
value
end
end
alias :[]= :set

Expand Down Expand Up @@ -63,4 +67,4 @@ def dump(indent = "")
end
end
end
end
end

0 comments on commit e9d495d

Please sign in to comment.