box-project / box2 Goto Github PK
View Code? Open in Web Editor NEWAn application for building and managing Phars.
Home Page: https://box-project.github.io/box2/
License: MIT License
An application for building and managing Phars.
Home Page: https://box-project.github.io/box2/
License: MIT License
The Box application must only be able to update within its own major version.
If a new major version is available, an option like --upgrade
must be used.
This will prevent somebody from upgrading from 1.0 to 2.0, and potentially breaking their PHAR building setup.
This will affect the update
command and the installer script.
The default base-path
option should be the directory in where the configuration file is located, not the current working directory.
See bin/pake
as an example.
When Box is loaded as a dependency, it should automatically detect the appropriate autoloader and use it.
The Phar
class will not create a file if no files are added.
If Box does not find any files to add, the user should be warned.
When running Box on a separate machine, the BOX_SCHEMA
constant resolves to false.
When box.phar is run isolated from the repository, it cannot find Finder.
The Symfony\Component\Finder\Finder
class when Box is packaged as a PHAR.
At the moment, all comments are stripped by default. This introduces bugs in the compiled code if for example Doctrine annotations are removed.
I'd therefore suggest to make this an optional switch can be enabled/disabled, or not strip Doctrine annotations. The latter seems more complex though.
The Box Phar should be able to load third-party compactors.
There would probably needs to be an optional configuration setting that builders can use to specific an bootstrap file that can be included by Box prior to the build process.
Hello
when I run
curl -s http://box-project.org/installer.php | php
I get the warnings below, and the resulting box.phar file doesn't do anything.
I am running Mac OSX 10.8.4
PHP 5.3.25 (cli) (built: May 29 2013 12:16:24)
Thanks
Todd
ERROR
Checking requirements...
PHP Notice: Use of undefined constant STDERR - assumed 'STDERR' in - on line 13
PHP Stack trace:
PHP 1. {main}() -:0
PHP 2. Installer::run() -:3
PHP 3. Installer::checkRequirements() -:8
PHP 4. Installer::assert() -:10
PHP 5. Installer::warn() -:9
Notice: Use of undefined constant STDERR - assumed 'STDERR' in - on line 13
Call Stack:
0.2043 775464 1. {main}() -:0
0.2043 775464 2. Installer::run() -:3
0.2043 775464 3. Installer::checkRequirements() -:8
0.2044 776360 4. Installer::assert() -:10
0.2044 776360 5. Installer::warn() -:9
PHP Warning: fwrite() expects parameter 1 to be resource, string given in - on line 13
PHP Stack trace:
PHP 1. {main}() -:0
PHP 2. Installer::run() -:3
PHP 3. Installer::checkRequirements() -:8
PHP 4. Installer::assert() -:10
PHP 5. Installer::warn() -:9
PHP 6. fwrite() -:13
Warning: fwrite() expects parameter 1 to be resource, string given in - on line 13
Call Stack:
0.2043 775464 1. {main}() -:0
0.2043 775464 2. Installer::run() -:3
0.2043 775464 3. Installer::checkRequirements() -:8
0.2044 776360 4. Installer::assert() -:10
0.2044 776360 5. Installer::warn() -:9
0.2046 776616 6. fwrite() -:13
Downloading...
Done!
box-project.org is down returning 404 meaning impossible to install box. Is there a way to download directly box.phar ?
Thanks
I am just wondering how to show an error message if users add the same file twice to the phar, e.g. by specifying a directory and including files of the directory via the finder method too. Currently there is only a call to addFile (https://github.com/kherge/Box/blob/2.0/src/lib/KevinGH/Box/Command/Build.php#L668) without checking if the file is already in. The underlying library does not hold a state which files are in the phar (https://github.com/herrera-io/php-box/blob/master/src/lib/Herrera/Box/Box.php#L117) and could not check either.
Maybe it would be good to change the library to store all added files in an array and expose a method like getFiles() or isFileOnPath($path)?
Maybe something like git-commit
? This could be useful for people who want to be able to track both the full commit hash in addition to the short/taggish looking thing that git-version
currently supports.
A nice convenience option: add chmod
to cause Box to chmod the new PHAR to the configured mode.
When the validate
command is used, list all of the validation errors instead of just saying it failed.
The create
command should warn the user about the phar.readonly
setting if it is enabled and the user attempts to create a PHAR.
When I try to build a phar for phpDocumentor I get the following error:
? Generating new stub...
? Compressing...
PHP Fatal error: Uncaught exception 'ErrorException' with message 'proc_open(): unable to create pipe Too many open files' in phar:///home/mvriel/Copy/Projects/OSS/phpDocumentor/phpDocumentor2/box.phar/src/vendors/symfony/console/Symfony/Component/Console/Application.php:974
Stack trace:
#0 [internal function]: KevinGH\Box\Application->KevinGH\Box\{closure}(2, 'proc_open(): un...', 'phar:///home/mv...', 974, Array)
#1 phar:///home/mvriel/Copy/Projects/OSS/phpDocumentor/phpDocumentor2/box.phar/src/vendors/symfony/console/Symfony/Component/Console/Application.php(974): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 phar:///home/mvriel/Copy/Projects/OSS/phpDocumentor/phpDocumentor2/box.phar/src/vendors/symfony/console/Symfony/Component/Console/Application.php(793): Symfony\Component\Console\Application->getSttyColumns()
#3 phar:///home/mvriel/Copy/Projects/OSS/phpDocumentor/phpDocumentor2/box.phar/src/vendors/symfony/console/Symfony/Component/Console/Application.php(754): Symfony\Component\Console\Application in phar:///home/mvriel/Copy/Projects/OSS/phpDocumentor/phpDocumentor2/box.phar/src/vendors/symfony/console/Symfony/Component/Console/Application.php on line 974
If possible, try to verify the phar and openssl without the extension.
The app needs a validate
command for debugging along with automatic validation of configuration files.
It would be nice to support signing using OpenSSL.
Since Box relies on Symfony's 2.1 components, it cannot be released as stable until the 2.1 components are released as stable.
The BuildTest::testExecuteDefaultStub
test fails on a separate machine.
Current result with key-pass: true
:
Creating PHAR...Private key password: phpunit
done.
Expected:
Createing PHAR...
Private key password: phpunit
Done.
Expose the Phar::getSupportedCompression()
, Phar::getSupportedSignature()
, and Phar::getVersion()
as a command.
Hello. I'm trying your library. It seems cool, thanks.
But I have an issue.
I use composer, with the native autoloader, but I use a mount point like that This is not my project, this is just a sample.
My issue is that the autoloader can find class a the root of my project. But If I hack and copy the lib to the target-dir
, it works.
So it could me very nice to add a new option: a map between real path, and phar path:
"map": {
"src": "SensioLabs/Bundle/ConnectBundle"
}
Add a configuration option that toggles the use of Phar::interceptFileFuncs
on and off.
This option will likely only be supported by the default stub generated by Box.
My travis builds are failing recently, because the http://box-project.org/installer.php is sometimes not available.
Example output from curl:
$ curl --verbose http://box-project.org/installer.php
* About to connect() to box-project.org port 80 (#0)
* Trying 204.232.175.78... connected
> GET /installer.php HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: box-project.org
> Accept: */*
>
< HTTP/1.1 302 Found
< Connection: close
< Pragma: no-cache
< cache-control: no-cache
< Location: /installer.php
<
* Closing connection #0
Would a different call to curl fix this?
Maybe using '--location' or '--retry 3'.
See: https://bugs.php.net/bug.php?id=53467
Some changes may be necessary in addition to any workaround implemented.
The --verbose
option should cause the create
command to output more information than just the files that are added.
The verbose output should also include whether user given or default information is used.
An example would be: Was a user given stub file used, or was one generated by Box?
This could be useful for debugging configuration settings.
Import the run script fix that was applied to the Go
project.
It would be great if Box somehow figured out which classes were used, and only included those in the load.
The workaround for now is using an explicit file list to list all of the files.
Support the extraction of a specific file or directory, or multiple files or directories, in the extract
command.
The create
command warns about no files being available even if a main script is used.
Since the message is intended to clear up why a PHAR was not created, the message should not be presented if a main file is used.
An edit
command will be added that will add, delete, or replace files contained in a PHAR.
I'm on the latest build of Box 2.0. I tried basically started with the box.json.dist
file that ships with Box when making my own box file, which looks like this:
{
"alias": "craft.phar",
"chmod": "0755",
"directories": ["src/lib"],
"finder": [
{
"name": "*.php",
"exclude": [
"phpunit",
"phpunit-test-case",
"Tester",
"Tests",
"tests",
"yaml"
],
"in": "src/vendors"
}
],
"main": "bin/craft",
"output": "craft.phar",
"stub": true
}
However, I am getting an error that the index.php
doesn't exist when actually trying to run the generated Phar. So, I cloned down Box itself and ran box build
and get the same error on a clean clone of Box:
Warning: include(phar:///media/sf_Code/Laboratory/Box/box-2.0.0-rc.1-8-g77f3c19.phar/index.php):
A command for deploying an updated box.phar
would be extremely useful, and simplify the update-commit-push-create-publish cycle.
When trying to install dependencies for kherge/box
I eventually end up trying to install kherge/version. Here the following happens:
Installing kherge/version (1.0.1)
Downloading: connection...
Could not fetch https://api.github.com/repos/kherge/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30, enter your GitHub credentials to access private repos
The credentials will be swapped for an OAuth token stored in /Users/kasper/.composer/config.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
Username: kasperg
Password:
Downloading: connection...
[Composer\Downloader\TransportException]
The "https://api.github.com/repos/kherge/Version/zipball/f07cf83f8ce533be8f93d2893d96d674bbeb7e30" file could not be downloaded (H
TTP/1.1 404 Not Found)
I guess this happens because the project has been deprecated/moved and composer cannot handle this.
If kherge/version has been deprecated for herrera-io/php-version
I think some more composer files need to be updated to reflect this as well.
Add a command that will generate a private key if a new one is required.
That command will also be able export the private key's public key to a file.
The Box::importFile()
treats every file it imports as a PHP source file.
The Box
class, Config
class, and create
command all need to be fixed to allow for safe importing of binary data.
It would be far better to use the Phar::*
constants instead of setting their values directly in the configuration file.
{
"algorithm": "SHA1"
}
Would resolve to constant("Phar::$algorithm")
if it exists.
When using box.phar
with the --verbose
option, chmod()
will fail with the following error:
chmod(): No such file or directory
First of all, this project has saved me countless hours getting PHAR packaging of PHP apps right ๐ .
This could also be my own error, being to dumb to configure it correctly.
I have some PHP files which I want to add to the PHAR verbatim via finder-bin
, though comments and white space get removed.
My box.json
is at https://github.com/CHH/spark/tree/master/box.json
Allow for metadata to be set from within the configuration setting file.
The output
setting should support using the value of git-version
anywhere in the path.
Box installer doesn't work on php 5.3.10 with Suhosin patch
As far as I understand adding suhosin.executor.include.whitelist = phar
will work only for Suhosin extension. Suhosin patch seems to ignore this keyword.
After I commented out suhosin check, installed worked as expected, so it seems that white listing isn't required for patch.
Composer installer checks white list only for extension: composer/getcomposer.org@9b43609
Also similar issue can be seen here symfony/symfony#5444 (comment)
When I try to run box.phar
after installing the project using the installer the command always seems to return Hs?
.
If I clone the master branch of the project, install dependencies using composer and finally run php ./bin/box
I get the expected Symfony console application overview.
Is there a problem with the current box.phar
or could it be something that is not configured right on my local system?
I'm using:
The messages output by Box should support more locales than just English.
I will probably use Symfony's Translator component and bundle an English localization file for starters.
Because I want to require you lib. And when I do that, I got phpspec. So I add lot of dependencies.
These new additions to php-box
should be available in configuration.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.