Sha256: e13d560cf36c2a46db57714b635437b7c76f5359caf4ee3d10b7fd1ac73c589d

Contents?: true

Size: 890 Bytes

Versions: 1

Compression:

Stored size: 890 Bytes

Contents

module Dotman
  class Git
    def self.klone(git_location, alias_name = nil)
      unless git_location.nil?
        Dotman::Base.ensure_dotman_folder_exists
        Dotman::Base.ensure_default_folder_exists
        Dotman::Base.ensure_current_dotman_file_exists
        clone_repository(git_location, alias_name)
      end
    end

    def self.folder_name(git_location)
      folder_name = git_location.scan(/[^:]+[\/]?dotfile[s?]{1}/).first.gsub('/', '_')
    end

    def self.clone_repository(git_location, alias_name = nil)
      dotfile_location = "#{ENV['HOME']}/.dotman/#{folder_name(git_location)}"
      if (File.directory?(dotfile_location))
        Dotman::Notification.already_cloned
      else
        system "git clone #{git_location} #{dotfile_location}"
        Dotman::DotfileCollection.new_configuration(folder_name(git_location), alias_name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dotman-0.0.3.4 lib/dotman/git.rb