Skip to content
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

[Feature] Add support for scripts #264

Closed
xquelard opened this issue Mar 19, 2019 · 4 comments
Closed

[Feature] Add support for scripts #264

xquelard opened this issue Mar 19, 2019 · 4 comments

Comments

@xquelard
Copy link

Beginner in crystal, coming from javascript (node especially), in package.json, you can define scripts than you can run afterwards with "npm run name_of_user_created_script".

Maybe this could be useful as well in the shards.yml ? defining scripts and then "shards run ...".
I can try to add make the pull request for that feature to train on Crystal if you're interested, but I might need a bit of help :)

@z64
Copy link

z64 commented Mar 19, 2019

I don't think this is entirely a concern for shards, which is primarily zeroed in on package development and management, and not so much end-users.

I think what you are looking for is analogous to something like Rake from Ruby, where a lot of Crystal's users come from. With respect to this, there are several Rake-like tools and libraries in the Crystal ecosystem you can take a look at and see if they suit your needs already:

https://github.com/axvm/cake
https://github.com/imdrasil/sam.cr
https://github.com/tbrand/neph

Aside, you could use the post-install or executables section of your shard.yml to make certain scripts or binaries available to the host after installing.

@ysbaddaden
Copy link
Contributor

The only supported script is the postinstall hook to execute a command when the dependency is installed or updated, for example build an external library or an executable.

Arbitrary scripts are unlikely to be implemented. A simple Makefile is much more useful and flexible than npm-like scripts.

@straight-shoota
Copy link
Member

straight-shoota commented Mar 19, 2019

@xquelard What would be the benefit of running shards run name_of_user_created_script vs. ./scripts/name_of_user_created_script?
Or maybe crystal run ./scripts/name_of_user_created_script.cr?

@xquelard
Copy link
Author

I'll just close the issue :)

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

No branches or pull requests

4 participants