README.md in percy-common-1.2.0 vs README.md in percy-common-1.3.0

- old
+ new

@@ -1,11 +1,43 @@ # percy-common Server-side common library for Percy. -## Percy::KeywordStruct +## Installation +Add this line to your application's Gemfile: + +``` +gem 'percy-common' +``` + +Or, for a Ruby library, add this to your gemspec: + +```ruby +spec.add_development_dependency 'percy-common' +``` + +And then run: + +```bash +$ bundle install +``` + +### Setup in a Rails app + +If including in a Rails app, add the following to your `application.rb`: + +```ruby +require 'percy/common/engine' +``` + +This enables Rails to autoload the constants from this library without more `require` lines. + +## Usage + +### Percy::KeywordStruct + A simple struct that can be used when you need to return a simple value object. ```ruby require 'percy/keyword_struct' @@ -17,11 +49,11 @@ foo.baz # --> true foo.qux # --> nil foo.fake # --> raises NoMethodError ``` -## Percy.logger +### Percy.logger ```ruby require 'percy/logger' Percy.logger.debug { 'debug log' } @@ -30,13 +62,13 @@ Percy.logger.error { 'error message' } ``` Prefer the block form usage `Percy.logger.debug { 'message' }` over `Percy.logger.debug('message')` because it is slightly more efficient when the log will be excluded by the current logging level. For example, if the log level is currently `info`, then a `debug` log in block form will never evaluate or allocate the message string itself. -## Percy::ProcessHelpers +### Percy::ProcessHelpers -### `gracefully_kill(pid[, grace_period_seconds: 10])` +#### `gracefully_kill(pid[, grace_period_seconds: 10])` Returns `true` if the process was successfully killed, or `false` if the process did not exist or its exit status was already collected. ```ruby require 'percy/process_helpers' @@ -44,10 +76,10 @@ Percy::ProcessHelpers.gracefully_kill(pid) ``` This will send `SIGTERM` to the process, wait up to 10 seconds, then send `SIGKILL` if it has not already shut down. -## Percy::Stats +### Percy::Stats Client for recording Datadog metrics and automatically setting up Percy-specific environment tags. This class is a wrapper for [Datadog::Statsd](https://github.com/DataDog/dogstatsd-ruby), an extended client for DogStatsD, which extends the StatsD metric server for Datadog.