Sha256: 25d607d57a75168931570408957a874c54a6b45a47b792e28109d558c5a8b134

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

module IronWorkerNG
  module Feature
    module Common
      module SetEnv
        class Feature < IronWorkerNG::Feature::Base
          attr_reader :key
          attr_reader :value

          def initialize(code, key, value)
            super(code)

            @key = key
            @value = value
          end

          def bundle(container)
            container.runner_add "export #{@key}=\"#{@value.to_s.gsub('"','\\"')}\""
          end

          def build_command
            if @code.remote_build_command || @code.full_remote_build
              "set_env \"#{@key}\", \"#{@value.to_s.gsub('"','\\"')}\""
            else
              nil
            end
          end
        end

        module InstanceMethods
          def set_env(key, value)
            IronCore::Logger.info 'IronWorkerNG', "Setting ENV variable with name='#{key}' and value='#{@value}'"

            @features << IronWorkerNG::Feature::Common::SetEnv::Feature.new(self, key, value)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iron_worker_ng-1.0.4 lib/iron_worker_ng/feature/common/set_env.rb
iron_worker_ng-1.0.3 lib/iron_worker_ng/feature/common/set_env.rb