An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Spark

![Shard CI](https://github.com/stephendolan/spark/workflows/Shard%20CI/badge.svg)
[![API Documentation Website](https://img.shields.io/website?down_color=red&down_message=Offline&label=API%20Documentation&up_message=Online&url=https%3A%2F%2Fstephendolan.github.io%2Fspark%2F)](https://stephendolan.github.io/spark)
[![GitHub release](https://img.shields.io/github/release/stephendolan/spark.svg?label=Release)](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