https://github.com/stephendolan/spark
A set of CLI utilities to facilitate advanced application setup and building.
https://github.com/stephendolan/spark
Last synced: about 1 year ago
JSON representation
A set of CLI utilities to facilitate advanced application setup and building.
- Host: GitHub
- URL: https://github.com/stephendolan/spark
- Owner: stephendolan
- License: mit
- Created: 2021-04-02T18:06:35.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-07-05T20:21:24.000Z (almost 4 years ago)
- Last Synced: 2025-04-01T04:32:46.620Z (about 1 year ago)
- Language: Crystal
- Homepage: https://stephendolan.github.io/spark/
- Size: 238 KB
- Stars: 10
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# Spark

[](https://stephendolan.github.io/spark)
[](https://github.com/stephendolan/spark/releases)
## Installation
Add the dependency to your `shard.yml`:
```yaml
dependencies:
spark:
github: stephendolan/spark
```
Run `shards install`
## Library usage
Require the shard:
```crystal
require "spark"
```
Then, use any of the fully documented modules below to interact with your user:
- ⚡️ **[Spark](https://stephendolan.github.io/spark/Spark.html)**
- [`.indent`](https://stephendolan.github.io/spark/Spark.html#indent-instance-method) - Increase indentation for all Spark output by one level
- [`.outdent`](https://stephendolan.github.io/spark/Spark.html#outdent-instance-method) - Decrease indentation for all Spark output by one level
- [`.reset_indentation`](https://stephendolan.github.io/spark/Spark.html#reset_indentation-instance-method) - Set the indentation level for all Spark output back to zero
- 💬 **[Spark::Prompt](https://stephendolan.github.io/spark/Spark/Prompt.html)**
- [`#say`]() - Display a message to a user
- [`#ask`]() - Get information from a user
- [`#yes?`]() - Get confirmation from a user, with a default of "Yes"
- [`#no?`]() - Get confirmation from a user, with a default of "No"
- [`#newline`](https://stephendolan.github.io/spark/Spark/Prompt.html#newline-instance-method) - Output a blank line to the user's prompt
- 📄 **[Spark::Template](https://stephendolan.github.io/spark/Spark/Template.html)**
- [`.run_remote_file`]() - Run Crystal code from a remote source (**USE WITH CAUTION**)
- [`.run_local_file`]() - Run Crystal code from a local file source (**USE WITH CAUTION**)
- 🗄 **[Spark::File](https://stephendolan.github.io/spark/Spark/File.html)**
- [`.replace_in_file`]() - Replace some content in a file
- [`.inject_into_file`]() - Insert content into a file before or after a pattern
- [`.prepend_to_file`]() - Insert content at the beginning of a file
- [`.append_to_file`]() - Insert content at the end of a file
- [`.copy_file`]() - Copy a file (very few safeguards in place currently)
- [`.move_file`]() - Move a file (very few safeguards in place currently)
- [`.create_file`]() - Create a file (very few safeguards in place currently)
- [`.remove_file`]() - Remove a file
- [`.chmod_file`]() - Change the permissions of a file
- 💎 **[Spark::Shard](https://stephendolan.github.io/spark/Spark/Shard.html)**
- [`#add_shard`]() - Adds a shard to the `shard.yml` file
## Command line usage
Spark ships with a command line interface, installed in a `postinstall` step when you `shards install`. The resulting binary will be located at `./bin/spark`.
With this CLI installed, you have access to the following commands:
- `./bin/spark apply [Remote Template URL]` - Runs the content returned from the provided URL through `crystal run`
- `./bin/spark apply --local [Local File Path]` - Runs the content of the provided file path through `crystal run`
## Development
1. Add your code
1. Ensure specs pass with `crystal spec`
1. Ensure correct formatting with `crystal tool format --check`
1. Ensure correct style with `./bin/ameba`
## Contributing
1. Fork it ()
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create a new Pull Request
## Credits & Inspirations
- [TTY](https://github.com/piotrmurach/tty) because of the excellent code and organization
- [Thor](https://github.com/erikhuda/thor) because I've loved using it with Ruby and Rails
- [Ameba](https://github.com/crystal-ameba/ameba) because of their excellent shard CLI
## Contributors
- [Stephen Dolan](https://github.com/your-github-user) - creator and maintainer