Class: Dockerun::Config
- Inherits:
-
Object
- Object
- Dockerun::Config
- Includes:
- TR::CondUtils
- Defined in:
- lib/dockerun/config.rb
Instance Method Summary collapse
- #activate_context(ctx, &block) ⇒ Object
- #active_context ⇒ Object
- #dry_run(bool = true, prompt = true) ⇒ Object
- #gen_docker_runscript(bool = true, overwrite = false) ⇒ Object
- #is_dry_run? ⇒ Boolean
- #is_dry_run_prompt? ⇒ Boolean
- #is_gen_docker_runscript? ⇒ Boolean
- #is_overwrite_docker_runscript? ⇒ Boolean
- #is_workdir_given? ⇒ Boolean
- #platform ⇒ Object
- #set_current_user(bool = true) ⇒ Object
- #set_current_user? ⇒ Boolean
- #set_platform(val) ⇒ Object
- #set_workdir(path) ⇒ Object
- #workdir ⇒ Object
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_context ⇒ Object
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
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
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
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
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
17 18 19 |
# File 'lib/dockerun/config.rb', line 17 def is_workdir_given? not_empty?(@workdir) end |
#platform ⇒ Object
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
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 |
#workdir ⇒ Object
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 |