Class: DotMe::Folder

Inherits:
Incubator show all
Defined in:
lib/dotme/incubators/folder.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Incubator

cells, incubate, #initialize, register!

Constructor Details

This class inherits a constructor from DotMe::Incubator

Class Method Details

.incubates?(path) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/dotme/incubators/folder.rb', line 15

def self.incubates?(path)
  ::File.directory? path
end

Instance Method Details

#incubate(*to) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/dotme/incubators/folder.rb', line 3

def incubate(*to)
  begin
    require 'git'

    { :git_clone => Git.open( @path ).config['remote.origin.url'], :to => @relative }
  rescue
    FileUtils.cp_r @path, ::File.join( to, @basename )

    { :link => @basename, :to => @relative }
  end
end