Sha256: a02f4f9bb8bcca1e1d874175c7a1e20c0aee081568e9daa32859532f08b588a2

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module MachineConfigure
  module Helpers
    module Shared
      private

        # Returns the path to the docker-machine's <tt>'config.json'</tt> file,
        # but without the prefixed path leading to the DM_MACHINES_PATH.
        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

        # Returns the <tt>filepath</tt> without DM_STORAGE_PATH.
        def remove_storage_path_from filepath
          return filepath.to_s.sub("#{DM_STORAGE_PATH.to_path}/", '')
        end

        # Replaces any occurences of the user's
        # home directory path with HOME_REPLACE_STRING.
        def remove_home_in string
          return string.gsub(HOME, HOME_REPLACE_STRING)
        end

        # Replaces any occurences of HOME_REPLACE_STRING
        # with the user's home directory path.
        def insert_home_in string
          return string.gsub(HOME_REPLACE_STRING, HOME)
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
machine_configure-0.0.3 lib/machine_configure/helpers/shared.rb
machine_configure-0.0.2 lib/machine_configure/helpers/shared.rb
machine_configure-0.0.1 lib/machine_configure/helpers/shared.rb