version: 2.1
jobs:
  build:
    working_directory: ~/project
    docker:
      - image: bkuhlmann/alpine-ruby:latest
    steps:
      - checkout

      - restore_cache:
          name: Gems Restore
          keys:
            - gem-cache-{{.Branch}}-{{checksum "Gemfile"}}
            - gem-cache-

      - run:
          name: Gems Install
          command: |
            gem update --system
            bundle config set path "vendor/bundle"
            bundle install

      - save_cache:
          name: Gems Store
          key: gem-cache-{{.Branch}}-{{checksum "Gemfile"}}
          paths:
            - vendor/bundle

      - run:
          name: Rake
          command: bundle exec rake
