Class: Dockerun::Config

Inherits:
Object
  • Object
show all
Includes:
TR::CondUtils
Defined in:
lib/dockerun/config.rb

Instance Method Summary collapse

Instance Method Details

#activate_context(ctx, &block) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/dockerun/config.rb', line 42

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

#active_contextObject



51
52
53
# File 'lib/dockerun/config.rb', line 51

def active_context
  @active_context
end

#dry_run(bool = true, prompt = true) ⇒ Object



68
69
70
71
# File 'lib/dockerun/config.rb', line 68

def dry_run(bool = true, prompt = true)
  @dry_run = bool 
  @dry_run_prompt = prompt
end

#gen_docker_runscript(bool = true, overwrite = false) ⇒ Object



56
57
58
59
# File 'lib/dockerun/config.rb', line 56

def gen_docker_runscript(bool = true, overwrite = false)
  @_gen_docker_runscript = bool 
  @_overwrite_docker_runscript = overwrite
end

#is_dry_run?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/dockerun/config.rb', line 72

def is_dry_run?
  @dry_run.nil? ? false : @dry_run
end

#is_dry_run_prompt?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/dockerun/config.rb', line 75

def is_dry_run_prompt?
  @dry_run_prompt.nil? ? false : @dry_run_prompt
end

#is_gen_docker_runscript?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/dockerun/config.rb', line 60

def is_gen_docker_runscript?
  @_gen_docker_runscript.nil? ? false : @_gen_docker_runscript
end

#is_overwrite_docker_runscript?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/dockerun/config.rb', line 63

def is_overwrite_docker_runscript?
  @_overwrite_docker_runscript.nil? ? false : @_overwrite_docker_runscript
end

#is_workdir_given?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dockerun/config.rb', line 17

def is_workdir_given?
  not_empty?(@workdir)
end

#platformObject



25
26
27
28
29
30
31
# File 'lib/dockerun/config.rb', line 25

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

#set_current_user(bool = true) ⇒ Object



34
35
36
# File 'lib/dockerun/config.rb', line 34

def set_current_user(bool = true)
  @set_current_user = bool
end

#set_current_user?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/dockerun/config.rb', line 37

def set_current_user?
  @set_current_user.nil? ? true : @set_current_user
end

#set_platform(val) ⇒ Object



22
23
24
# File 'lib/dockerun/config.rb', line 22

def set_platform(val)
  @platform = val
end

#set_workdir(path) ⇒ Object



8
9
10
# File 'lib/dockerun/config.rb', line 8

def set_workdir(path)
  @workdir = path 
end

#workdirObject



11
12
13
14
15
16
# File 'lib/dockerun/config.rb', line 11

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