Comments (10)
You right, build.before
is call after parsing all arguments/composer data.
I can add a new event before starting parsing arguments (just after getting the composer.json
file path)
from pharbuilder.
Why not just move the event? Instead of creating a new one?
from pharbuilder.
For several reason:
- It's doesn't cost anything to add a new event
- For the same reason I use a true event dispatcher instead of function hook: Extendability
build.before
happen just the actual build, and the event contains all parsed arguments.
For now, event action are only shell script, but I want to add the same mechanism of composer: have both PHP callable and shell script
from pharbuilder.
Yes, but I'd expect build.before
to happen before any other thing. Which other name do you suggest for the new event?
I'd go with something like
- dispatch
build.before
- parse and validate args
- dispatch
build.init
/build.validate(d)
- build phar
- dispatch
build.after
On the other hand: build.init
is strange after build.before
. Maybe build.start
?
from pharbuilder.
What I have in my mind was parsing.before
.
But you pointing out that my previous choice was not very wise.
Let's find something better.
Here my suggestion:
- trigger
application.start
- Start the application
- System check
- Command init
- trigger
parsing.start
(package
command only)- Read argument from CLI argument, Composer data, then ask
- trigger
parsing.end
- trigger
building.start
- Create the PHAR archive
- trigger
building.end
- trigger
application.end
from pharbuilder.
I prefer build
instead of building
. application.start
might be problematic if you add more commands like an about
command or so.
I don't know if we want to consider that edge case, but we might want to run certain end
hooks when the app is interrupted using Ctrl + C
.
from pharbuilder.
build
instead of building
: OK
application.start
(and application.end
): I see your concerne, and it's too early to add them, I need more time to find the right way to add them.
For Ctrl-C
, Symfony Console don't handle a such case but it's don't seem to hard to add, but it will not work on Windows
from pharbuilder.
How about command.[build|package].[start|end]
? I don't think we should emit events for parsing parameters.
from pharbuilder.
Nice one !
When should we trigger the start event ?
I need at least to know where is the composer.json
file to set the working directory of the shell script (because PharBuilder can be used as an external tool, so the current directory is not necessary the project root)
from pharbuilder.
Sure, you also need the composer.json
to know which events can even be triggered.
from pharbuilder.
Related Issues (20)
- Default to current directory
- Update Similar project in READMe HOT 1
- Add before-script and after-script hooks HOT 20
- how to exclude directory add in phar. such as logs and temp HOT 3
- Add the possibility to avoid the shebang at the start of the file HOT 4
- Upgrading to version 3 HOT 5
- No PHAR in release-section for latest release HOT 1
- Trouble running the app in a headless CI-Server HOT 3
- Where is the phar of this app HOT 2
- Change the method MacFJA\PharBuilder\Utils\Composer::removeFilesAutoloadFor
- "skip-shebang": false doesn't have default HOT 5
- Performance improvements? HOT 6
- Fatal on broken Symlink HOT 1
- Add possibility to add files at root level
- Provide gpg signature for phar in releases
- Double slash not handled properly HOT 5
- Not bundling the composer file fails on some dependencies HOT 7
- No support for Symfony 4 HOT 6
- Documentation issues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pharbuilder.