Skip to content

Commit

Permalink
Merge pull request berkshelf#1339 from rveznaver/exclude_metadata_rb
Browse files Browse the repository at this point in the history
Correct exclusion of metadata.rb
  • Loading branch information
sethvargo committed Nov 13, 2014
2 parents f996585 + ed3a776 commit 13ec984
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/berkshelf/berksfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def vendor(destination)
#
# * https://tickets.opscode.com/browse/CHEF-4811
# * https://tickets.opscode.com/browse/CHEF-4810
FileSyncer.sync(scratch, destination, exclude: ["**/*/metadata.rb"])
FileSyncer.sync(scratch, destination, exclude: ['**/metadata.rb'])
end

destination
Expand Down
13 changes: 13 additions & 0 deletions spec/unit/berkshelf/file_syncer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@ module Berkshelf
expect("#{destination}/.file_g").to be_a_file
end

it 'does not copy files and folder matching a pattern with a wildcard' do
described_class.sync(source, destination, exclude: '**/file_e')

expect("#{destination}/file_a").to be_a_file
expect("#{destination}/file_b").to be_a_file
expect("#{destination}/file_c").to be_a_file
expect("#{destination}/folder/file_d").to be_a_file
expect("#{destination}/folder/file_e").to_not be_a_file
expect("#{destination}/.dot_folder").to be_a_directory
expect("#{destination}/.dot_folder/file_f").to be_a_file
expect("#{destination}/.file_g").to be_a_file
end

it 'removes existing files and folders in destination' do
FileUtils.mkdir_p("#{destination}/existing_folder")
FileUtils.touch("#{destination}/existing_file")
Expand Down

0 comments on commit 13ec984

Please sign in to comment.