Module: FPM::Fry::Plugin::Env
- Defined in:
- lib/fpm/fry/plugin/env.rb
Overview
plugin ‘env’, ‘PATH’ => ‘$PATH:/usr/local/go/bin’
Defined Under Namespace
Classes: AddEnv
Class Method Summary collapse
Class Method Details
.apply(builder, env) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fpm/fry/plugin/env.rb', line 26 def self.apply(builder, env) unless env.kind_of? Hash raise FPM::Fry::WithData( ArgumentError.new("ENV must be a Hash, got #{env.inspect}"), documentation: 'https://github.com/xing/fpm-fry/wiki/Plugin-env' ) end env.each do |k,v| k = k.to_s if k.kind_of? Symbol unless k.kind_of?(String) && k =~ /\A[A-Z][A-Z0-9_]*\z/ raise FPM::Fry::WithData( ArgumentError.new("environment variable names must be strings consisiting of uppercase letters, numbers and underscores, got #{k.inspect}"), documentation: 'https://github.com/xing/fpm-fry/wiki/Plugin-env' ) end end builder.recipe.dockerfile_hooks << AddEnv.new(env.dup.freeze) end |