Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby bootstrapping for projects for the Heroku Vault team
Ruby

Fix error when using MRI 2.2.0

Closes #49

LGTM given by: @mattmanning, @rmcafee

Squashed commit of the following:

commit 2f5aba0
Author: Kenny Parnell <k.parnell@gmail.com>
Date:   Tue Jan 6 14:02:25 2015 -0500

    Bump Gemfile.lock

commit a01053a
Author: Kenny Parnell <k.parnell@gmail.com>
Date:   Tue Jan 6 13:48:40 2015 -0500

    Fix error when using MRI 2.2.0
latest commit b9d0464395
@kennyp kennyp authored
Failed to load latest commit information.
lib Fix error when using MRI 2.2.0
test Accept, log, and pass on request id.
.gitignore remove gemfile.lock from gitignore, wtf?
.ruby-gemset Add ruby gemset file.
.ruby-version ruby version
.travis.yml Fix error when using MRI 2.2.0
.yardopts - Move common web logic to the Web base class.
Gemfile Use guard for easier unit test verification.
Gemfile.lock Fix error when using MRI 2.2.0
Guardfile Use guard for easier unit test verification.
LICENSE.txt initial commit
README.md
Rakefile Expose all tasks, and pull_schemas to other apps
vault-tools.gemspec Accept, log, and pass on request id.

README.md

Vault::Tools

Tools is the English word for ツール. Tooling for the Heroku Vault team to enable faster bootstrapping for Ruby projects.

Build Status

Installation

Add this line to your application's Gemfile:

gem 'vault-tools'

Usage

Vault.setup

calling Vault.setup will:

  • call Bundler.require with the corresponding RACK_ENV
  • add ./lib to the $LOAD_PATH
  • set TZ to utc as well as Sequel's default timezone
  • overwrite Time.to_s to default to ISO8601
  • replace Ruby's default, deprecated Config with Vault::Config
  • if the CONFIG_APP environment variable is defined and this is the production environment, it will attempt to use the Heroku API to load the config vars from another app into Vault::Config

Vault::Config

Provides a better way to configure the application than simply pulling strings from ENV.

defaults

Config[:foo]
# => nil

Config.default(:foo, 'bar')
Config[:foo]
# => 'bar'
Config['FOO']
# => 'bar'

type casts

Returns nil when undefined, otherwise casts to indicated type.

Config.int(:max_connections)

Vault::Log

  Log.time(name, t)
  #  => "measure=true at=web-40"

  Log.count('foo')
  #  => "measure=true at=foo"

Vault::Web

Sinatra base class

Includes request logging and health endpoints

  class Web < Vault::Web
    helpers Vault::SinatraHelpers::HtmlSerializer
  end

Setting up a development environment

Install the dependencies:

bundle install --binstubs vendor/bin
rbenv rehash

Run the tests:

vendor/bin/t

Generate the API documentation:

vendor/bin/d

Contributing

  1. Fork it
  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 new Pull Request

Releasing

> bundle exec rake release
Something went wrong with that request. Please try again.