Skip to content

Commit

Permalink
Merge pull request #26 from envato/release-0.1.0
Browse files Browse the repository at this point in the history
Prepare release 0.1.0
  • Loading branch information
liamdawson authored Dec 17, 2020
2 parents b6f21a4 + 6f12cca commit d1aebcc
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 57 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Ruby

on: [push,pull_request]

jobs:
test:
strategy:
matrix:
ruby: [2.5, 2.6, 2.7]
runs-on: ubuntu-latest
name: Test (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Run the default task
run: |
gem install bundler -v 2.2.1
bundle install
bundle exec rake
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.9
2.5.8
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

29 changes: 16 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2020-12-16

### Added

- YARD-based gem documentation

### Changed

- **Breaking**: The Rack::ECG initializer now uses named options, instead of an
options hash. If you manually initialized an instance, you may need to use the
`**` operator to pass these options. (e.g. `Rack::ECG.new(nil, **options)`)
- **Breaking**: The Rack::ECG initializer now uses named options, instead of an options hash.

If you manually initialized an instance, you may need to use the `**` operator to pass these options. (e.g. `Rack::ECG.new(nil, **options)`)

### Removed

- Support for Ruby versions < 2.4.0
- **Breaking:** Dropped support for Ruby versions < 2.5.0

## [0.0.5] - 2017-05-12

### Added

- A new `sequel` check (#8), which checks if the Sequel database connection is
active.
- A new `sequel` check (#8), which checks if the Sequel database connection is active.

## [0.0.4] - 2017-05-04

### Added

- A new `active_record` check (#7), which checks if the ActiveRecord connection
is active.
- A new `active_record` check (#7), which checks if the ActiveRecord connection is active.
- A new `redis` check (#7), which checks if the Redis connection is active.

## [0.0.3] - 2017-02-13

### Added

- Accept a `hook` in configuration, which is run when all check results have
been gathered (#6)
- Accept a `hook` in configuration, which is run when all check results have been gathered (#6)

### Fixed

Expand All @@ -57,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `git_revision` check to return the current git revision
- `migration_version` check to return the current ActiveRecord migration version

[Unreleased]: https://github.com/envato/rack-ecg/compare/v0.0.5...HEAD
[Unreleased]: https://github.com/envato/rack-ecg/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/envato/rack-ecg/compare/v0.0.5...v0.1.0
[0.0.5]: https://github.com/envato/rack-ecg/compare/v0.0.4...v0.0.5
[0.0.4]: https://github.com/envato/rack-ecg/compare/v0.0.3...v0.0.4
[0.0.3]: https://github.com/envato/rack-ecg/compare/v0.0.2...v0.0.3
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rack::ECG

[![Gem version](https://img.shields.io/gem/v/rack-ecg)][gem-page]
[![Gem version](https://img.shields.io/gem/v/rack-ecg)][gem-page] [![Rubydoc](https://img.shields.io/badge/docs-rubydoc-success)][rubydoc]

Rack middleware for Ruby web apps, providing a simple and extensible health
check endpoint, with minimal configuration.
Expand All @@ -15,7 +15,9 @@ check endpoint, with minimal configuration.
- reports errors if any check can't be executed for whatever reason
- JSON output

## Development Status [![travis ci build](https://api.travis-ci.org/envato/rack-ecg.svg?branch=master)](https://travis-ci.org/envato/rack-ecg)
## Development Status

[![Build Status](https://github.com/envato/rack-ecg/workflows/build/badge.svg?branch=main)](https://github.com/envato/rack-ecg/actions)

`Rack::ECG` is extracted from production code in use at
[Envato](http://envato.com). However, it is undergoing early development, and
Expand Down Expand Up @@ -189,11 +191,11 @@ use Rack::ECG, hook: Proc.new { |success, _checks| puts "Is healthy? #{success}"
- `success`: whether the response will indicate success
- `checks`: an array of the check names and values

More examples are provided in [/examples](https://github.com/envato/rack-ecg/tree/master/examples)
More examples are provided in [/examples](https://github.com/envato/rack-ecg/tree/main/examples)

## Requirements

- Ruby >= 2.4
- Ruby >= 2.5
- Rack
- To use optional `git_revision` check, your deployed code needs to be in a git repo, and
`git` command must be accessible on the server
Expand All @@ -220,13 +222,13 @@ migrations stored in `schema_versions` table
## License

`Rack::ECG` uses MIT license. See
[`LICENSE.txt`](https://github.com/envato/rack-ecg/blob/master/LICENSE.txt) for
[`LICENSE.txt`](https://github.com/envato/rack-ecg/blob/main/LICENSE.txt) for
details.

## Code of conduct

We welcome contribution from everyone. Read more about it in
[`CODE_OF_CONDUCT.md`](https://github.com/envato/rack-ecg/blob/master/CODE_OF_CONDUCT.md)
[`CODE_OF_CONDUCT.md`](https://github.com/envato/rack-ecg/blob/main/CODE_OF_CONDUCT.md)

## Contributing

Expand All @@ -253,3 +255,4 @@ Encouraging the use and creation of open source software is one of the ways we s
[oss]: http://opensource.envato.com//?utm_source=github
[careers]: http://careers.envato.com/?utm_source=github
[gem-page]: https://rubygems.org/gems/rack-ecg
[rubydoc]: https://www.rubydoc.info/gems/rack-ecg/
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ YARD::Rake::YardocTask.new

task(default: [:rubocop, :spec, :yard])

task(:'yard:server') do
task(:watch_docs) do
sh "yard server --reload"
end
15 changes: 15 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "rack-ecg"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
8 changes: 8 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install

# Do any other automated setup that you need to do here
8 changes: 4 additions & 4 deletions lib/rack/ecg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class ECG
# Constructs an instance of ECG Rack middleware with the specified
# options.
#
# @param [Object,nil] app Underlying Rack application to receive unmatched
# @param app [Object,nil] Underlying Rack application to receive unmatched
# requests. If unset, any unmatched requests will return a 404.
# @param [Array<Symbol, Array<Symbol, Object>>] checks: Sets and
# @param checks [Array<Symbol, Array<Symbol, Object>>] Sets and
# configures the checks run by this instance.
# @param [String, nil] at: Path which this ECG instance handles.
# @param [#call, nil] hook: Callable which receives the success status and
# @param at [String, nil] Path which this ECG instance handles.
# @param hook [#call, nil] Callable which receives the success status and
# check results
def initialize(app = nil, checks: DEFAULT_CHECKS, at: DEFAULT_MOUNT_AT, hook: nil)
@app = app
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/ecg/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
module Rack
class ECG
# Library version.
VERSION = "0.0.5"
VERSION = "0.1.0"
end
end
23 changes: 15 additions & 8 deletions rack-ecg.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# coding: utf-8
# frozen_string_literal: true
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rack/ecg/version'

require_relative "lib/rack/ecg/version"

Gem::Specification.new do |spec|
spec.name = "rack-ecg"
Expand All @@ -18,17 +17,25 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/envato/rack-ecg"
spec.license = "MIT"

spec.files = %x(git ls-files -z).split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = spec.homepage
spec.metadata["changelog_uri"] = "https://github.com/envato/rack-ecg/blob/main/CHANGELOG.md"

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
%x(git ls-files -z).split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.4"
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")

spec.add_runtime_dependency("rack")

spec.add_development_dependency("rake", "~> 13.0")
spec.add_development_dependency("bundler", "~> 2.1.4")
spec.add_development_dependency("bundler", "~> 2.2.1")
spec.add_development_dependency("rspec", "~> 3.10.0")
spec.add_development_dependency("rack-test", "~> 1.1.0")
spec.add_development_dependency("pry", "~> 0.13.0")
Expand Down
1 change: 1 addition & 0 deletions spec/check_factory_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true
RSpec.describe(Rack::ECG::CheckFactory) do
class MyCheckClass; end

class MyOtherCheckClass; def initialize(params); end; end

let(:definitions) { [] }
Expand Down

0 comments on commit d1aebcc

Please sign in to comment.