Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

AppPackage repack for hidden files #3

Merged
merged 1 commit into from

4 participants

@jfarrell

Hidden files ignored due to * vs . in zip call in repack.
Patch by @wallyqs and @JeanSebTr via github pull requests
which got closed and never brought back in.

@jfarrell jfarrell AppPackage repack for hidden files
Hidden files ignored due to * vs . in zip call in repack.
Patch by @wallyqs and @JeanSebTr via github pull requests
which got closed and never brought back in.
f771aa6
@mreider

Adding this one to the backlog too...

@cf-frameworks cf-frameworks merged commit 9b548e7 into cloudfoundry-attic:master
@drnic

Not yet tested this patch, but I think it will be necessary to upload http://deployd.com/ applications that have a .dpd folder containing credentials that need to be uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 14, 2013
  1. @jfarrell

    AppPackage repack for hidden files

    jfarrell authored
    Hidden files ignored due to * vs . in zip call in repack.
    Patch by @wallyqs and @JeanSebTr via github pull requests
    which got closed and never brought back in.
This page is out of date. Refresh to see the latest.
View
4 cloud_controller/app/models/app_package.rb
@@ -40,10 +40,10 @@ def to_zip
def self.repack_app_in(dir, tmpdir, format)
if format == :zip
target_path = File.join(tmpdir, 'app.zip')
- cmd = "cd #{dir}; zip -q -y #{target_path} -r * 2>&1"
+ cmd = "cd #{dir}; zip -q -y #{target_path} -r . 2>&1"
else
target_path = File.join(tmpdir, 'app.tgz')
- cmd = "cd #{dir}; COPYFILE_DISABLE=true tar -czf #{target_path} * 2>&1"
+ cmd = "cd #{dir}; COPYFILE_DISABLE=true tar -czf #{target_path} . 2>&1"
end
timed_section(CloudController.logger, 'repack_app') do
View
31 cloud_controller/spec/models/app_package_spec.rb
@@ -217,6 +217,37 @@
end.resume
end
end
+
+ it 'should repack files that start with a dot using zip or tar' do
+ app_dir = Dir.mktmpdir
+ tmp_dir = Dir.mktmpdir
+ zip_extract_dir = Dir.mktmpdir
+ tar_extract_dir = Dir.mktmpdir
+
+ git_directory_path = File.join(app_dir, '.git')
+ FileUtils.mkdir(git_directory_path)
+
+ app_files = ['.gitignore', '.htaccess', 'index.php']
+ app_files.each do |filename|
+ FileUtils.touch(File.join(app_dir, filename))
+ end
+
+ em do
+ Fiber.new do
+ packaged_app_path = AppPackage.repack_app_in(app_dir, tmp_dir, :zip)
+ `unzip #{packaged_app_path} -d #{zip_extract_dir}`
+ unpacked_zip_files = Dir.entries(zip_extract_dir)
+ unpacked_zip_files.should include(*app_files, File.basename(git_directory_path))
+
+ packaged_app_path = AppPackage.repack_app_in(app_dir, tmp_dir, :tar)
+ `tar -zxf #{packaged_app_path} -C #{tar_extract_dir}`
+ unpacked_tar_files = Dir.entries(tar_extract_dir)
+ unpacked_tar_files.should include(*app_files, File.basename(git_directory_path))
+
+ EM.stop
+ end.resume
+ end
+ end
end
def em(timeout=5)
Something went wrong with that request. Please try again.