diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c43da..ef0360a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,15 +4,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## Unreleased -## [0.0.2 - 2017-10-18] +## 0.0.3 ### Added -Allow usage with newer versions of heartcheck +- Adds script and docker to facilitate development environment setup +- Adds support for ruby 3. -## 0.0.1 - 2015-11-27 +## 0.0.2 ### Added -Create gem +- Allow usage with newer versions of heartcheck +- [v 0.0.2](https://github.com/locaweb/heartcheck-resque/releases/tag/v0.0.2) -[Unreleased]: https://github.com/locaweb/heartcheck-resque/compare/master....HEAD -[0.0.2 - 2017-10-18]: https://github.com/locaweb/heartcheck-resque/releases/tag/v0.0.2 +## 0.0.1 +### Added +- Create gem diff --git a/README.md b/README.md index 30ab250..093cccc 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,31 @@ Heartcheck.setup do |config| end ``` -### Check Heartcheck example [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb) +**Check Heartcheck example** [here](https://github.com/locaweb/heartcheck/blob/master/lib/heartcheck/generators/templates/config.rb) -## License -* [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt) +## Development setup using Docker + +The Hearthcheck-Resque provides a container with the current stable version of Ruby released and a second Docker container running Redis. The development setup requires you to have these tools available in your local environment: + +- [Docker](https://docs.docker.com/get-docker/) +- [Docker Compose](https://docs.docker.com/compose/install/) +- [Bash](https://www.gnu.org/software/bash/) + +#### BootStrap Script to run the dockerized environment + +```bash +./scripts/heartcheck-resque setup +``` + +Run the command `./scripts/heartcheck-cache -h` to see available options. ## Contributing -1. Fork it ( https://github.com/locaweb/heartcheck-resque/fork ) -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create a new Pull Request +1. [Fork it](https://github.com/locaweb/heartcheck-resque/fork) +2. Create your feature branch ( **git checkout -b my-new-feature** ) +3. Commit your changes ( **git commit -am 'Add some feature'** ) +4. Push to the branch ( **git push origin my-new-feature** ) +5. Create a new Pull Request + +## License +* [MIT License](https://github.com/locaweb/heartcheck-resque/blob/master/LICENSE.txt) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d2e3db4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.7' + +services: + app: + image: ruby:3.0.2 + volumes: + - .:/app + working_dir: /app + command: bash + depends_on: + - 'redis' + environment: + REDIS_HOST: redis + REDIS_PORT: 6379 + BUNDLE_PATH: /app/.gems + redis: + image: redis:5.0.6 + command: --port 6379 + diff --git a/scripts/heartcheck-resque b/scripts/heartcheck-resque new file mode 100755 index 0000000..293a968 --- /dev/null +++ b/scripts/heartcheck-resque @@ -0,0 +1,49 @@ +#!/bin/bash -e + +command_name=$1 +command_args=${@:2} + +# we are relying on docker, adding a descriptive name here +# will help when identifiying containers with docker ps +image_name="heartcheck-resque" + +# helper to bring container alive +run() { + args=${@:1} + docker-compose run --rm -v $PWD:/heartcheck-resque app $args +} + +case $command_name in + setup) + docker-compose up --build -d + run bundle install + ;; + stop) + docker-compose down -v --rmi all + ;; + bash) + run bash + ;; + bundle) + run bundle install + ;; + console) + run bin/console + ;; + rspec) + run bundle exec rspec + ;; + usage) + echo -e "Usage:\n" + echo -e "heartcheck-resque bash - access docker sh console" + echo -e "heartcheck-resque bundle - runs bundle install" + echo -e "heartcheck-resque rspec - runs rspec" + echo -e "heartcheck-resque setup - setups docker image" + echo -e "heartcheck-resque stop - stops and removes containers, networks and volumes." + ;; + *) + echo -e "\n# Bootstrap Script to dockerize the hearthcheck-resque environment\n" + $0 usage + ;; +esac +