Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Compress vagrant files with ZipArchive #42

Closed
tonicospinelli opened this issue May 31, 2013 · 8 comments
Closed

Compress vagrant files with ZipArchive #42

tonicospinelli opened this issue May 31, 2013 · 8 comments
Assignees

Comments

@tonicospinelli
Copy link
Contributor

I did create a virtual machine with puPHPet, and I was testing my fork with new improvements.

After VM was up, I had problems with data compression and I changed the compression to \ZipArchive.

I did some tests with this improvement and it's working good.

You can look in my fork:
tonicospinelli@badb6b2

If you agree, I do a PR with my changes.

@jtreminio
Copy link
Member

Hi,

To run puphpet locally you need to clone https://github.com/puphpet/vagrant-puppet-lamp and run $ vagrant up. It'll set everything you need up for you!

@tonicospinelli
Copy link
Contributor Author

Ok! =)
but when I created the VM with puphpet, I had problems to create compressed data.
I fixed this problem with Php ZipArchive, and I believe this improvement is good for all OS.

It is a simple refactoring ;)

@jtreminio
Copy link
Member

I had originally chosen ZipArchive, but a few problems:

  1. It can't add a directory at once,
  2. Attempting to replace a file within a zip archive overwrites everything in that tree structure.

Looking back I probably could have gone another, more logical route before jumping to exec(). Will look through this PR to see if it makes sense for us.

Can you tell me what problems you had with the compression? It should work perfectly on all VMs, that's the whole point.

@frastel
Copy link
Contributor

frastel commented May 31, 2013

I also have a problem with ZipArchive. When I jumped onto this project I thought "man this has to be refactored to ZipArchive as soon as possible" after I have seen this exec call. Time has passed and I do not see the benefit using this PHP feature anymore.
Viewing at the lines of code needed to copy a folder recursive does not convince me without any further added test.
However this refactoring is great and I like your motivation but I am not really sure if we should go this way.

Besides like @jtreminio I do not understand your initial problem. Did you use vagrant-puppet-lamp for provisioning your dev box or did you configure your dev box with the help of puPHPet and perhaps missed to add the zip package?
Could you please explain this problem further more?

@ghost ghost assigned jtreminio Jun 2, 2013
@tonicospinelli
Copy link
Contributor Author

OK, I explain my problem. =)
I didn't use vagrant-puppet-lamp to create my box. I created my box with PuPHPet.com to test this repository.
After clicked in "Create My Manifest" warnings occurred, because the zip file didn't exists.
Warning: filemtime(): stat failed for /tmp/51ac952e9ef78FA0isn.zip in /var/www/puphpet.dev/src/Puphpet/Controller/Front.php on line 140
Warning: filesize(): stat failed for /tmp/51ac952e9ef78FA0isn.zip in /var/www/puphpet.dev/src/Puphpet/Controller/Front.php on line 142
Warning: readfile(/tmp/51ac952e9ef78FA0isn.zip): failed to open stream: No such file or directory in /var/www/puphpet.dev/src/Puphpet/Controller/Front.php on line 130

You can look my commit, in my fork, with this changes to resolve the warnings: tonicospinelli@badb6b2

Could you understand now? =)

@jtreminio
Copy link
Member

Gotcha.

The thing is, if you want to actually run a local copy of puphpet.com, you should do the following:

$ git clone https://github.com/puphpet/vagrant-puppet-lamp.git
$ cd vagrant-puppet-lamp
$ vagrant up

I realize the documentation isn't very good at all right now, but we've been pumping out so much new stuff it was hard to find time. I will make sure to find time soon.

@jtreminio
Copy link
Member

Hi,

After juggling with the decision, I've decided not to merge this in.

Requiring devs to use vagrant-puppet-lamp for developing puphpet gives us the freedom to use any tool and any version that we want, without worrying about compatibility issues.

Please don't stop submitting PRs are you create something new and awesome, though!

Thanks,
Juan

@tonicospinelli
Copy link
Contributor Author

Ok my friend! =)

I will do new PRs when I find new improvements or features.

Thanks,
Antonio

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants