Skip to content

Commit

Permalink
fix bug where it fails to strip leading directory for zip files
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwb committed May 22, 2012
1 parent 68d7783 commit eb7c3ef
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions files/default/tests/minitest/test_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
directory( "/usr/local/foo_dont_strip/foo_sub").must_exist
end

it "does strip for zip file" do
file("/usr/local/foo_zip_strip/foo1.txt").must_exist
end


it "successfully compiles haproxy" do
file("/usr/local/haproxy-1.5/haproxy").must_exist
end
Expand Down
6 changes: 6 additions & 0 deletions libraries/provider_ark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ def unzip
cmd.run_command
cmd.error!
subdirectory_children = Dir.glob("#{tmpdir}/**")
if subdirectory_children.length == 1
subdir = subdirectory_children[0]
subdirectory_children = Dir.glob("#{subdir}/**")
end
require 'pry'
binding.pry
FileUtils.mv subdirectory_children, new_resource.path
FileUtils.rm_rf tmpdir
else
Expand Down
8 changes: 8 additions & 0 deletions recipes/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@
action :install
end

ark "foo_zip_strip" do
version "2"
url 'https://github.com/bryanwb/chef-ark/raw/master/files/default/foo.zip'
checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
action :install
end


ark "haproxy" do
url "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
version "1.5"
Expand Down

0 comments on commit eb7c3ef

Please sign in to comment.