Class: Dnatural::Dir

Inherits:
Dir
  • Object
show all
Includes:
Namaste::Mixin
Defined in:
lib/dnatural.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.mkdir(path, integer = 0777, args = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/dnatural.rb', line 10

def self.mkdir path, integer=0777, args = {}
  super path, integer
  d = Dir.new path
  d.type = Dnatural::VERSION

  ::Dir.chdir(d.path)  do
    ::Dir.mkdir 'admin'
    ::Dir.mkdir 'consumer'
	::Dir.mkdir 'producer'
	::Dir.mkdir 'system'
  end

  d
end

Instance Method Details

#add(src, dest, options = {}) ⇒ Object



29
30
31
32
# File 'lib/dnatural.rb', line 29

def add src, dest, options = {}
  file = FileUtils.cp src, File.join(path, dest), options
  File.new File.join(path, dest)
end

#listObject



25
26
27
# File 'lib/dnatural.rb', line 25

def list
  glob('**/*')
end

#remove(list, options = {}) ⇒ Object



34
35
36
37
# File 'lib/dnatural.rb', line 34

def remove list, options = {}
  list = [list] if list.instance_of? String 
  FileUtils.rm list.map { |x| File.join(path, x) }, options
end