Class: DevSnap::SnapRepos

Inherits:
Object
  • Object
show all
Includes:
TR::CondUtils
Defined in:
lib/dev_snap/snap_repos.rb

Instance Method Summary collapse

Constructor Details

#initialize(root, name) ⇒ SnapRepos

Returns a new instance of SnapRepos.

Raises:



10
11
12
13
14
15
# File 'lib/dev_snap/snap_repos.rb', line 10

def initialize(root, name)
  raise Error, "Snap repos root cannot be nil" if root.nil?
  @root = root
  FileUtils.mkdir_p(@root) if not File.exist?(@root)
  @name = name
end

Instance Method Details

#initObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/dev_snap/snap_repos.rb', line 17

def init
  target = File.join(@root, @name)
  if not File.exist?(target)
    logger.debug "Snap workspace '#{target}' does not exist. Creating new bare workspace"
    GitCli::Vcs.new.init(target, true)
  else
    logger.debug "Snap workspace '#{target}' already exist."
  end
  target
end