Module: Util

Defined in:
lib/zarchitect/util.rb

Class Method Summary collapse

Class Method Details

.mkdir(path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/zarchitect/util.rb', line 3

def self.mkdir(path)
  a = path.split("/")
  if a.count == 1
      Util.mkdir2(path)
  else
    i = 0
    p = ""
    a.each do |s|
      if i == 0
        p = s
        Util.mkdir2(p)
      else
        p = File.join(p, s)
        Util.mkdir2(p)
      end
      i += 1
    end
  end
end

.mkdir2(path) ⇒ Object

PRIVATE



30
31
32
33
34
35
36
37
38
39
# File 'lib/zarchitect/util.rb', line 30

def self.mkdir2(path)
  npath = File.join(Dir.getwd, path)
  GPI.print "Checking for directory #{npath}", GPI::CLU.check_option('v')
  unless Dir.exist?(npath)
    GPI.print "Missing directory #{npath}", GPI::CLU.check_option('v')
    GPI.print "Creating directory #{npath}", GPI::CLU.check_option('v')
    Dir.mkdir(npath)
    GPI.print "Created directory #{npath}", GPI::CLU.check_option('v')
  end
end

.path_to_dataObject

path to data files located in installation directory



24
25
26
# File 'lib/zarchitect/util.rb', line 24

def self.path_to_data
  File.join(__dir__, "../../data")
end