Module: Nucleus::Adapters::BuildpackTranslator

Included in:
V1::CloudControl::Buildpacks, V1::CloudFoundryV2::Buildpacks, V1::Heroku::Buildpacks
Defined in:
lib/nucleus/adapters/buildpack_translator.rb

Overview

The BuildpackTranslator provides convenience methods for the user to handle the installation of application runtimes. Common runtime names can be applied and are automatically translated to a platform native runtime name / url (if applicable).

Constant Summary collapse

PUBLIC_BUILDPACKS =

List of common buildpacks that are available GitHub. However, they are not guaranteed to work with every platform that utilized buildpacks.

{
  'c' => 'https://github.com/atris/heroku-buildpack-c',
  'common_lisp' => 'https://github.com/mtravers/heroku-buildpack-cl',
  'core_data' => 'https://github.com/heroku/heroku-buildpack-core-data',
  'dart' => 'https://github.com/igrigorik/heroku-buildpack-dart',
  'eiffel' => 'https://github.com/mbustosorg/heroku-buildpack-eiffel',
  'elixir' => 'https://github.com/hashnuke/heroku-buildpack-elixir',
  'emacs' => 'https://github.com/technomancy/heroku-buildpack-emacs',
  'embedded_proxy' => 'https://github.com/ryanbrainard/heroku-buildpack-embedded-proxy',
  'erlang' => 'https://github.com/archaelus/heroku-buildpack-erlang',
  'factor' => 'https://github.com/ryanbrainard/heroku-buildpack-factor',
  'fakesu' => 'https://github.com/fabiokung/heroku-buildpack-fakesu',
  'geodjango' => 'https://github.com/cirlabs/heroku-buildpack-geodjango',
  'go' => 'https://github.com/kr/heroku-buildpack-go',
  'haskell' => 'https://github.com/mietek/haskell-on-heroku',
  'inline' => 'https://github.com/kr/heroku-buildpack-inline',
  'java_ant' => 'https://github.com/dennisg/heroku-buildpack-ant',
  # introduced by IBM Bluemix, shall also work in Heroku
  'java_liberty' => 'https://github.com/cloudfoundry/ibm-websphere-liberty-buildpack',
  'jekyll' => 'https://github.com/mattmanning/heroku-buildpack-ruby-jekyll',
  'lua' => 'https://github.com/leafo/heroku-buildpack-lua',
  'luvit' => 'https://github.com/skomski/heroku-buildpack-luvit',
  'meteor' => 'https://github.com/jordansissel/heroku-buildpack-meteor',
  'middleman' => 'https://github.com/hashicorp/heroku-buildpack-middleman',
  'monit' => 'https://github.com/k33l0r/monit-buildpack',
  'multi' => 'https://github.com/heroku/heroku-buildpack-multi',
  'nanoc' => 'https://github.com/bobthecow/heroku-buildpack-nanoc',
  'dot_net' => 'https://github.com/friism/heroku-buildpack-mono',
  'null' => 'https://github.com/ryandotsmith/null-buildpack',
  'opa' => 'https://github.com/tsloughter/heroku-buildpack-opa',
  'perl' => 'https://github.com/miyagawa/heroku-buildpack-perl',
  'phantomjs' => 'https://github.com/stomita/heroku-buildpack-phantomjs',
  'phing' => 'https://github.com/ryanbrainard/heroku-buildpack-phing',
  'r' => 'https://github.com/virtualstaticvoid/heroku-buildpack-r',
  'rust' => 'https://github.com/emk/heroku-buildpack-rust',
  'redline' => 'https://github.com/will/heroku-buildpack-redline',
  'silex' => 'https://github.com/klaussilveira/heroku-buildpack-silex',
  'sphinx' => 'https://github.com/kennethreitz/sphinx-buildpack',
  'test' => 'https://github.com/ddollar/buildpack-test',
  'testing' => 'https://github.com/ryanbrainard/heroku-buildpack-testrunner'
}

Instance Method Summary collapse

Instance Method Details

#find_runtime(name) ⇒ Boolean

Search the list of known buildpacks, both vendor specific and public, to match the desires runtime name.

Parameters:

  • name (String)

    of the runtime to look out for

Returns:

  • (Boolean)

    returns true if a vendor specific or public buildpack was found for the runtime



54
55
56
57
58
59
60
61
62
# File 'lib/nucleus/adapters/buildpack_translator.rb', line 54

def find_runtime(name)
  if respond_to? :vendor_specific_runtimes
    runtime = vendor_specific_runtimes[name.downcase.underscore]
    return runtime unless runtime.nil?
  end

  # if no vendor specific runtime was found, use the general definitions
  PUBLIC_BUILDPACKS[name.downcase.underscore]
end

#native_runtime?(name) ⇒ Boolean

Checks if the name of the runtime is matching a vendor specific runtime / buildpack.

Parameters:

  • name (String)

    of the runtime for which to check if it matches a vendor specific runtime

Returns:

  • (Boolean)

    returns true if the name matches a vendor specific runtime, false otherwise



67
68
69
70
71
72
73
74
75
76
# File 'lib/nucleus/adapters/buildpack_translator.rb', line 67

def native_runtime?(name)
  if respond_to? :vendor_specific_runtimes
    # case A: name is a key
    return true if vendor_specific_runtimes.keys.include? name
    # case B: name is a specific runtime name or a URL and one of the values
    return vendor_specific_runtimes.values.include? name
  end
  # cant be native if there are no vendor specific runtimes
  false
end