Permalink
Browse files

Support a new basename parameter for the install method.

  • Loading branch information...
1 parent 3616e71 commit 6c0337ef2bcb981cca6e56b6fd75c311d7d8a766 @bernd committed Aug 5, 2012
Showing with 13 additions and 2 deletions.
  1. +2 −2 lib/fpm/cookery/path.rb
  2. +11 −0 spec/path_spec.rb
View
@@ -25,14 +25,14 @@ def mkdir
FileUtils.mkdir_p(self.to_s)
end
- def install(src)
+ def install(src, new_basename = nil)
case src
when Array
src.collect {|src| install_p(src) }
when Hash
src.collect {|src, new_basename| install_p(src, new_basename) }
else
- install_p(src)
+ install_p(src, new_basename)
end
end
View
@@ -119,5 +119,16 @@
end
end
end
+
+ describe "with a new basename argument" do
+ it "installs the file with a new basename" do
+ Dir.mktmpdir do |dir|
+ path = FPM::Cookery::Path.new(dir)
+ path.install(File.expand_path('../spec_helper.rb', __FILE__), 'foo.rb')
+
+ File.exist?(path/'foo.rb').must_equal true
+ end
+ end
+ end
end
end

0 comments on commit 6c0337e

Please sign in to comment.