class DotMe::Incubator

Public Class Methods

cells() click to toggle source
# File lib/dotme/incubator.rb, line 39
def self.cells
  @@cells
end
incubate(path,to) click to toggle source
# File lib/dotme/incubator.rb, line 23
def self.incubate(path,to)
  path = ::File.join( Etc.getpwuid.dir, path ) unless ::File.exists? path

  Dir.mkdir to, 0700 unless ::File.directory? to

  puts "Incubating #{::File.basename path} to #{to}"
  incubator = nil
  # get the last valid incubator
  @@incubators.each { |c| if c.incubates? path then incubator = c end }
  unless incubator 
    raise NoIncubator 
  end 

  @@cells << incubator.new(path).incubate(to)
end
new(path) click to toggle source
# File lib/dotme/incubator.rb, line 9
def initialize(path)
  @path     = path
  @relative = @path.gsub( Etc.getpwuid.dir, '~' )
  @basename = ::File.basename @path
  unless @basename[0] != '.'
    @basename = @basename[1..-1]
  end
end
register!(c) click to toggle source
# File lib/dotme/incubator.rb, line 18
def self.register!(c)
  raise TypeError, 'Not an Incubator derived class.' unless c.respond_to? :incubates?
  @@incubators << c
end