https://github.com/juanmanuelramallo/marathon
Running shell commands in parallel and grouped in steps
https://github.com/juanmanuelramallo/marathon
bash marathon rubygem runner
Last synced: about 2 months ago
JSON representation
Running shell commands in parallel and grouped in steps
- Host: GitHub
- URL: https://github.com/juanmanuelramallo/marathon
- Owner: juanmanuelramallo
- License: mit
- Created: 2019-07-10T14:40:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-28T04:37:16.000Z (almost 6 years ago)
- Last Synced: 2025-02-27T14:23:30.947Z (over 1 year ago)
- Topics: bash, marathon, rubygem, runner
- Language: Ruby
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Marathon
[](https://circleci.com/gh/juanmanuelramallo/marathon)
[](https://codeclimate.com/github/juanmanuelramallo/marathon/maintainability)
[](https://codeclimate.com/github/juanmanuelramallo/marathon/test_coverage)
Marathon allows you to run several bash commands and configure them by steps, so if any previous step has failed the execution gets stoped after the current step ends.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'marathon'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install marathon
## Usage
```bash
$ marathon -c 'command A in first step','command B in first step' -c 'command C in second step','command D in second step' -c 'command E in third step','you get the idea'
```
Some real life examples would be:
- To set rspec to run after all linters and static analizers:
```bash
marathon -c 'yarn test','bundle exec rubocop','bundle exec brakeman','yarn run js-lint','yarn run css-lint' -c 'bundle exec rspec'
```
- To set rspec to run after rubocop and after frontend linters:
```bash
marathon -c 'yarn run js-lint','yarn run css-lint' -c 'bundle exec rubocop' -c 'bundle exec rspec'
```
Order matters!
### Options
- Commands: `-c` List of commands of one step. You should enclose your commands with a single apostrophe and separate them using commas. If you want to specify a different step just write this option again.
```bash
marathon -c 'a command in step 1','other command in step 1','you get the idea' -c 'a command in step 2'
```
- Processes: `-p` `--processes` Number of processes to use to run the commands in every step. Only one process (main) by default.
```bash
marathon -c 'sleep 1','sleep 1' -p 2
```
- Verbose: `-v` `--verbose` As you may already guess, it prints more information on execution. Prints a message after the command has ended. And no matter the if the command was successful or not, the output is always displayed on stdout.
```bash
marathon -c 'echo Hola' -v
```

## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
[Read the docs](http://marathon-docs.s3-website-us-west-2.amazonaws.com/)
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/juanmanuelramallo/marathon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Marathon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).