module MachineConfigure::Helpers::Shared

Private Instance Methods

get_config_json_path() click to toggle source

Returns the path to the docker-machine's 'config.json' file, but without the prefixed path leading to the DM_MACHINES_PATH.

# File lib/machine_configure/helpers/shared.rb, line 8
def get_config_json_path
  return nil  unless (@machine_name)
  config_json_path = remove_storage_path_from DM_MACHINES_PATH.join(@machine_name, 'config.json').to_path
end
insert_home_in(string) click to toggle source

Replaces any occurences of HOME_REPLACE_STRING with the user's home directory path.

# File lib/machine_configure/helpers/shared.rb, line 26
def insert_home_in string
  return string.gsub(HOME_REPLACE_STRING, HOME)
end
remove_home_in(string) click to toggle source

Replaces any occurences of the user's home directory path with HOME_REPLACE_STRING.

# File lib/machine_configure/helpers/shared.rb, line 20
def remove_home_in string
  return string.gsub(HOME, HOME_REPLACE_STRING)
end
remove_storage_path_from(filepath) click to toggle source

Returns the filepath without DM_STORAGE_PATH.

# File lib/machine_configure/helpers/shared.rb, line 14
def remove_storage_path_from filepath
  return filepath.to_s.sub("#{DM_STORAGE_PATH.to_path}/", '')
end