module MotherBrain::FileSystem
Public Class Methods
init()
click to toggle source
Create the directory structure for motherbrain
# File lib/mb/file_system.rb, line 9 def init FileUtils.mkdir_p(logs) FileUtils.mkdir_p(manifests) FileUtils.mkdir_p(root) FileUtils.mkdir_p(templates) FileUtils.mkdir_p(tmp) end
logs()
click to toggle source
@return [Pathname]
# File lib/mb/file_system.rb, line 18 def logs root.join("logs") end
manifests()
click to toggle source
@return [Pathname]
# File lib/mb/file_system.rb, line 23 def manifests root.join("manifests") end
root()
click to toggle source
@return [Pathname]
# File lib/mb/file_system.rb, line 28 def root Pathname.new(default_root_path) end
templates()
click to toggle source
@return [Pathname]
# File lib/mb/file_system.rb, line 38 def templates root.join("templates") end
tmp()
click to toggle source
@return [Pathname]
# File lib/mb/file_system.rb, line 33 def tmp root.join("tmp") end
tmpdir(prefix = nil)
click to toggle source
Create a temporary directory in the tmp directory of the motherbrain file system
@param [String] prefix (nil)
a prefix suffix to attach to name of the generated directory
@return [String]
# File lib/mb/file_system.rb, line 49 def tmpdir(prefix = nil) Dir.mktmpdir(prefix, tmp) end
Private Class Methods
default_root_path()
click to toggle source
# File lib/mb/file_system.rb, line 55 def default_root_path File.expand_path(ENV["MOTHERBRAIN_PATH"] || "~/.mb") end