Skip to content

Build phar using box #548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 27, 2014
Merged

Build phar using box #548

merged 5 commits into from
Nov 27, 2014

Conversation

henrikbjorn
Copy link
Contributor

Fixes #532

$ ./bin/build_phar

Trying to use the build phar in the phpspec directoy in which it was build will result in an redeclaration error, as it will try and load vendor/autoload.php and as the files in the phar and in the project are exactly the same, it will fail. So try it out in another project using phpspec :)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@ciaranmcnulty
Copy link
Member

I think having build_phar in the bin folder will add it to people's bin dir when they install phpspec via composer, right?

@ciaranmcnulty
Copy link
Member

The box file looks great though - maybe we don't need the script?

@henrikbjorn
Copy link
Contributor Author

Uses Makefile now.

@ciaranmcnulty
Copy link
Member

Works for me, but when I build, the file is called phpspec-@[email protected] - should that be being replaced somehow?

@ciaranmcnulty
Copy link
Member

With the .phar not running inside phpspec - would this be fixed with a switch to require_once in bin/phpspec?

@ciaranmcnulty
Copy link
Member

Ignore last comment ;-)

If you add a composer install --dev step at the end, it resets the autoloader UID and lets you use the phar locally, to avoid that confusion.

Or, is there some way to move vendor to, say, vendor-backup and exclude it from the phar, then move it back in place afterwards?

@henrikbjorn
Copy link
Contributor Author

I dont think it is a problem, you would never use the phar to run the tests for the library from which is what build.

@ciaranmcnulty
Copy link
Member

That's fair - did you see my comment about the filename? It looks as if some magic is supposed to happen?

@henrikbjorn
Copy link
Contributor Author

when building the phar it will take a part of the git hash and append to the generated name, in order to avoid overwrites and clashes.

@ciaranmcnulty
Copy link
Member

When I type make the file generated is called phpspec-@[email protected] - this is why I ask.

@henrikbjorn
Copy link
Contributor Author

When i run it on OS X i get

-rwxr-xr-x   1 Henrik  staff  1636825 Nov 10 17:17 phpspec-2.1.0-RC1-19-g667b380.phar

@ciaranmcnulty
Copy link
Member

I installed box fresh via brew to try it out, the version I am running is:

Box version 2.4.0 build 48d0e8175a9ec24fc210942067cb63c2fa260c4b

is there some configuration that needs to be enabled to make this work?

@henrikbjorn
Copy link
Contributor Author

I just installed it via composer global require ~2.4 havent done anything else :)

@ciaranmcnulty
Copy link
Member

Very strange. Maybe you should add that to the require-dev?

@henrikbjorn
Copy link
Contributor Author

Don't think that is really a device requirement. More a build one.

@ciaranmcnulty
Copy link
Member

Well, if you and I are getting inconsistent behaviour...

@stof
Copy link
Member

stof commented Nov 24, 2014

I think having build_phar in the bin folder will add it to people's bin dir when they install phpspec via composer, right?

no we don't. Composer symlinks only the files listed in the composer.json


build-phar:
@echo "--> Checking for composer command line tool"
command -v $i >/dev/null && continue || { echo "$i command not found."; exit 1; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is $i here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woups ill fix that.

@ciaranmcnulty
Copy link
Member

Ah, thanks @stof

@ciaranmcnulty
Copy link
Member

The only reason I've not merged this is it doesn't work for me :/

@henrikbjorn
Copy link
Contributor Author

@ciaranmcnulty i opted for the simple solution, dont use magic named phars, just make a phpspec.phar instead.

ciaranmcnulty added a commit that referenced this pull request Nov 27, 2014
@ciaranmcnulty ciaranmcnulty merged commit 2c41076 into phpspec:master Nov 27, 2014
@ciaranmcnulty
Copy link
Member

I guess we have a question now of where the .phar should go.

@henrikbjorn
Copy link
Contributor Author

on the releases page

@ciaranmcnulty
Copy link
Member

Oh ok, so github host? Excellent.

@henrikbjorn
Copy link
Contributor Author

i would gladly make the phars, but someone with powah needs to edit the releases :) (not the tags, just add the file to the github releases tab thingy)

@ciaranmcnulty
Copy link
Member

I made a PHAR for 2.1-RC2, have a look when you are finished with Jeopardy :-)

@henrikbjorn
Copy link
Contributor Author

@ciaranmcnulty haha looks good :) I sucked at jeopardy!

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

Successfully merging this pull request may close these issues.

Provide phpspec.phar
3 participants