class Object

Public Instance Methods

_command(command) click to toggle source
# File lib/stackose.rb, line 22
def _command(command)
  [_project, _files, command].join(" ")
end
_files() click to toggle source
# File lib/stackose.rb, line 14
def _files
  cmd = []

  Array(fetch(:stackose_file)).each {|file| cmd << ["-f #{file}"]}

  cmd.join(" ")
end
_project() click to toggle source
# File lib/stackose.rb, line 9
def _project
  return "" if fetch(:stackose_project).nil?
  "-p #{fetch(:stackose_project)}_tmp"
end
normalized_stackose_linked_folders() click to toggle source
# File lib/stackose.rb, line 26
def normalized_stackose_linked_folders
  files = []
  fetch(:stackose_linked_folders).each do |f|

    if f.is_a? Hash
      f.each {|k, v| files << [replace_strings_with_paths(k).to_sym, replace_strings_with_paths(v).to_sym]}
    elsif f.is_a? String
      files << ["#{shared_path}/#{f}", "#{fetch(:stackose_docker_mount_point)}/#{f}"]
    end

  end
  files.to_h
end
replace_strings_with_paths(str) click to toggle source

Replace string with composer fetch_functions

# File lib/stackose.rb, line 42
def replace_strings_with_paths(str)

  str_to_replace = str.to_s

  str.to_s.scan(/__([a-z_]*)__/).each do |k|
    k = k.first
    case k
    when 'shared_path'
      value = shared_path
    else
      value = fetch(k.to_sym)
    end
    str_to_replace = str_to_replace.gsub("__#{k}__", value.to_s)
  end

  str_to_replace

end