Sha256: abac80f75849f3ba1d05db25196d21fd3ab3d6d0de8a965cc4e3f3ff32acf503

Contents?: true

Size: 1.64 KB

Versions: 2

Compression:

Stored size: 1.64 KB

Contents

require_relative 'context/rubygems'

module Dockerun
  class Config
    include TR::CondUtils

    def set_workdir(path)
      @workdir = path 
    end
    def workdir
      if @workdir.nil?
        @workdir = File.join("/opt",File.basename(Dir.getwd))
      end
      @workdir
    end
    def is_workdir_given?
      not_empty?(@workdir)
    end


    def set_platform(val)
      @platform = val
    end
    def platform
      if is_empty?(@platform)
        # wild guess
        @platform = :debian
      end
      @platform
    end


    def set_current_user(bool = true)
      @set_current_user = bool
    end
    def set_current_user?
      @set_current_user.nil? ? true : @set_current_user
    end


    def activate_context(ctx, &block)
      case ctx
      when :rubygems
        @active_context = Context::Rubygems.new(self)
      else
        raise Error, "Unknown context '#{ctx}'"
      end
      @active_context.instance_eval(&block)
    end
    def active_context
      @active_context
    end

 
    def gen_docker_runscript(bool = true, overwrite = false)
      @_gen_docker_runscript = bool 
      @_overwrite_docker_runscript = overwrite
    end
    def is_gen_docker_runscript?
      @_gen_docker_runscript.nil? ? false : @_gen_docker_runscript
    end
    def is_overwrite_docker_runscript?
      @_overwrite_docker_runscript.nil? ? false : @_overwrite_docker_runscript
    end
   

    def dry_run(bool = true, prompt = true)
      @dry_run = bool 
      @dry_run_prompt = prompt
    end
    def is_dry_run?
      @dry_run.nil? ? false : @dry_run
    end
    def is_dry_run_prompt?
      @dry_run_prompt.nil? ? false : @dry_run_prompt
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dockerun-0.4.2 lib/dockerun/config.rb
dockerun-0.4.1 lib/dockerun/config.rb