Class: Cmt

Inherits:
Pkg
  • Object
show all
Defined in:
lib/cmt.rb

Constant Summary

Constants inherited from Pkg

Pkg::PACKAGE_MANGER, Pkg::RELEASE_FILE, Pkg::SYSTEM_PACKAGE_MANGER

Instance Method Summary collapse

Methods inherited from Pkg

get_package_manager, get_system_package_manager

Instance Method Details

#init(repo) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cmt.rb', line 15

def init(repo)
  force = options['force']

  if File.exist? Config::CONFIG_DIR
    if force
      FileUtils.rm_rf(Config::CONFIG_DIR)
    else
      Log::LOGGER.error("Config already exists at '#{Config::CONFIG_DIR}'")
      abort("Config already exists at '#{Config::CONFIG_DIR}'")
    end
  end

  `git clone #{repo} #{Config::CONFIG_DIR}`

  return if Gem.win_platform?

  hostname = `hostname`
  Dir.chdir(Config::CONFIG_DIR) do
    `git checkout -b #{hostname}`
  end
end

#versionObject



47
48
49
# File 'lib/cmt.rb', line 47

def version
  puts(VERSION)
end