sensiolabs / melody Goto Github PK
View Code? Open in Web Editor NEWOne-file composer scripts
License: MIT License
One-file composer scripts
License: MIT License
As I read PR #24 it came into my mind, that it might also be a good thing, if one could define composer-options
..?
The PR #24 broke the HHVM tests https://travis-ci.org/sensiolabs/melody/jobs/43699766
We should be able to define repositories for private repositories like we do on current composer.json definition schema: https://getcomposer.org/doc/04-schema.md#repositories
Maybe something like this or any variation that apply:
<?php
<<<CONFIG
repositories:
- "private-vendor/private-repo"
- "type": "vcs"
- "url": "[email protected]:private-vendor/private-repo.git"
packages:
- "private-vendor/private-repo: ~1.0"
CONFIG;
Hi !
Given this very simple witness script:
<?php
<<<CONFIG
packages:
- "php"
CONFIG;
echo 'Hello World'.PHP_EOL;
I'm unable to redirect the output to a file using standard or error output redirection:
$ melody run hello_world.php > hello.txt
# hello.txt remains empty
Here is the strace output captured by @lyrixx that might help, showing it seems to be properly output on FD1:
16787 write(1, "/tmp/melody/aefded2aec05bb759178"..., 131) = 131
16787 write(1, "\n", 1) = 1
16787 lstat("/tmp/melody/aefded2aec05bb75917826c8787c3c6c24a4ff56cc67f6b6522fe8105cf4bc2c5/vendor/symfony/finder/Comparator/DateComparator.php", {st_mode=S_IFREG|0644, st_size=1465, ...}) = 0
16787 stat("/tmp/melody/aefded2aec05bb75917826c8787c3c6c24a4ff56cc67f6b6522fe8105cf4bc2c5/vendor/symfony/finder/Comparator/DateComparator.php", {st_mode=S_IFREG|0644, st_size=1465, ...}) = 0
16787 write(1, "/tmp/melody/aefded2aec05bb759178"..., 129) = 129
16787 write(1, "\n", 1) = 1
Any hint ?
ping @smaftoul, if by chance you have any idea.
@jeremy-derusse and I have created few useful gist (private and / or public use).
I think it could be useful to have a place in the documentation to "link" theses gist.
What do you think?
Hello, this is such a good idea! Is there a reason why this project got discontinued?
atm one needs to write
<<<CONFIG
packages:
- "codeguy/arachnid: 1.*"
CONFIG;
for melody to get it working.
More composer like would be something like
<<<CONFIG
packages:
- "codeguy/arachnid": "1.*"
CONFIG;
as this is 1:1 the notation composer uses on CLI. this might semantically not be the JSON one would expect, but syntax wise it would be great, as you can pickup the lines from the composer.json
related to #75
When downloading a gist, we may have a failure
[InvalidArgumentException]
There is an issue with your gist URL: API rate limit exceeded for W.X.Y.Z. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
We could take the composer's one ~/.composer/auth.json
or asking the user to create ours auth.json
.
Hi,
I think melody should ask before running code loaded from the outside and wild world, the Internet.
The main reason for this is that melody allows you to pass in an url, a username/gistID, or just the gistID.
It's not hard to type in "http://gist.github.com/gistID", but it would be even better if melody could show up useful informations before running it, like owner name, creation date, revisions count, last revision date ... And a direct link to the gist.
Still, some might wan't to run it without interaction, so it might be useful to add a --no-interaction
flag
Thanks in advance (I'll try to do it, but can't promise anything ... and don't know how to test it)
file_get_contents
+ copy
)We should integrate with FriendsOfPHP/security-advisories and warn the user when one of the required packages contains known vulnerabilities.
Hi,
I'm loving Melody! I've noticed however, that I can't get at a Gists from behind my organization's proxy server...
Patch/ suggestions to follow.
Thank you,
Nick
Gist "..." not found
:
$ melody.phar -vvv run https://gist.github.com/nfreear/5a870499717f18babbd6 -- -pLACE -l"sprint 4"
[InvalidArgumentException]
Gist "5a870499717f18babbd6" not found
Exception trace:
() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Handler/Github/Gist.php:66
SensioLabs\Melody\Handler\Github\Gist->download() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Handler/Github/Gist.php:38
SensioLabs\Melody\Handler\Github\Gist->get() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Handler/GistHandler.php:30
SensioLabs\Melody\Handler\GistHandler->createResource() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Melody.php:82
SensioLabs\Melody\Melody->createResource() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Melody.php:50
SensioLabs\Melody\Melody->run() at phar://C:/Users/ndf42/workspace/melody.phar/src/SensioLabs/Melody/Console/Command/RunCommand.php:87
SensioLabs\Melody\Console\Command\RunCommand->execute() at phar://C:/Users/ndf42/workspace/melody.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252
Symfony\Component\Console\Command\Command->run() at phar://C:/Users/ndf42/workspace/melody.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:874
Symfony\Component\Console\Application->doRunCommand() at phar://C:/Users/ndf42/workspace/melody.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:195
Symfony\Component\Console\Application->doRun() at phar://C:/Users/ndf42/workspace/melody.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:126
Symfony\Component\Console\Application->run() at phar://C:/Users/ndf42/workspace/melody.phar/bin/melody:19
require() at ... \workspace\melody.phar:10
My proxy configuration:
$ echo $HTTP_PROXY
wwwcache.open.ac.uk:80
.bashrc:
# ~/.bashrc
export HTTP_PROXY=wwwcache.open.ac.uk:80
export HTTPS_PROXY=wwwcache.open.ac.uk:80
export https_proxy=wwwcache.open.ac.uk:80
Melody exit with code 0 even if the script exit with a failure.
We should exit the melody's process with the same code than the runned script.
I wrote this simple php script :
<?php
<<<CONFIG
packages:
- "symfony/finder: ~2.5"
CONFIG;
$options = getopt('h');
var_export($options);
run with php test.php -h
can output option h:
$ php test.php -h
array(
'h' => false
)
Expect melody run test.php -- -h
same output, which is not. It output melody run
help.
would be great if you could tag a release.
atm my tooling based on melody is really unstable because of some BC changes happing from time to time :-/
https://github.com/sensiolabs/melody/blob/master/src/SensioLabs/Melody/Configuration/ConfigurationParser.php#L48
this will not work if $config['packages'] is an empty array, because array_merge requires at least 1 argument
I was playing with the shebang to try to not do melody run ...
each times.
$ cat foo.php
#!/usr/bin/env -S melody run -vvv
<?php
<<<CONFIG
packages:
- "symfony/var-dumper: ^4"
CONFIG;
dump('Hello world');
$ ./foo.php
RUN '/usr/local/bin/composer' 'update' '--prefer-dist'
ERR Loading composer repositories with package information
ERR Updating dependencies (including require-dev)
ERR Package operations: 3 installs, 0 updates, 0 removals
ERR - Installing symfony/polyfill-php72 (v1.11.0): Loading from cache
ERR - Installing symfony/polyfill-mbstring (v1.11.0): Loading from cache
ERR - Installing symfony/var-dumper (v4.2.7): Loading from cache
ERR symfony/var-dumper suggests installing symfony/console (To use the ServerDumpCommand and/or the bin/var-dump-server script)
ERR Writing lock file
ERR Generating autoload files
ERR
RES Command ran successfully
#!/usr/bin/env -S melody run -vvv
"Hello world"
$ php foo.php
PHP Fatal error: Uncaught Error: Call to undefined function dump() in /somewhere/foo.php:9
Stack trace:
#0 {main}
thrown in /somewhere/foo.php on line 9
But the shebang is in the output ๐ค
Do you think it would be possible to hide it if we adapt melody ?
When I start a file with:
<?php
declare(strict_types=1);
<<<CONFIG
packages:
- .....
CONFIG;
Then I get the following error in console (after melody run
)
In ResourceParser.php line 23:
Impossible to parse the content of the document.
The php script should look like:
<?php
<<<CONFIG
packages:
- "symfony/finder: ~2.5"
CONFIG;
$finder = Symfony\Component\Finder\Finder::create();
run [--no-cache] [--prefer-source] [-t|--trust] [--] <script> [<arguments>]...
https://gist.github.com/pimolo/d06bb4d2e803369a66758095c007f2d1 can be used in order to reproduce.
I would like to store some temporary files which are required run melody-scripts from within another app (php-console).
If I could add somehow files to the melody's working-dir those were automatically cleaned up by the melody garbage collector, which would be highly usefull in my case. otherwise i need to create another garbage collector for my "own" temp files.
Would you consider this something in scope of melody?
https://github.com/sensiolabs/melody/blob/master/src/SensioLabs/Melody/Configuration/ConfigurationParser.php#L15
this will not match packages without a vendor name (for instance requirements on php, hhvm or ext-curl)
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.