Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close

Paasmaker Ruby Interface Library

This is a simple Ruby library that is designed to read in the Paasmaker configuration, falling back to a custom configuration file in development.

Usage - Rails

If you want to use this with your Rails project, do the following steps:

  • Add paasmaker-interface to your Gemfile:
gem 'paasmaker-interface'
  • Update your database.yml file to look like the following:
<% require 'paasmaker' %>
<% interface = Paasmaker::Interface.new(['../project-configuration.yml']) %>
<% database = interface.get_service('postgres') %>

production:
  adapter: postgresql
  database: "<%= database['database'] %>"
  host: "<%= database['hostname'] %>"
  username: "<%= database['username'] %>"
  password: "<%= database['password'] %>"
  port: "<%= database['port'] %>"

And update your adapter as appropriate for your application.

Usage - Other applications

To read in the configuration details in other applications, you can instantiate the Interface class directly and work with it.

require 'paasmaker'

interface = Paasmaker::Interface.new(['../project-configuration.yml'])

interface.is_on_paasmaker?()

service = interface.get_service('service')

Example Configuration Overrides

Example YAML configuration file:

services:
  parameters:
    foo: bar

application:
  name: test
  version: 1
  workspace: Test
  workspace_stub: test

Example JSON configuration file:

{
    "services": {
        "parameters": {
            "foo": "bar"
        }
    },
    "application": {
        "name": "test",
        "version": 1,
        "workspace": "Test",
        "workspace_stub": "test"
    }
}

Testing

To run the unit tests for the interface, just execute test.rb in the root of the project.

Recent activity

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.