Sha256: 84d4b16b334b123fe461baa6a163c1ac35f07c2a91312c0cbf459799faf926a2
Contents?: true
Size: 1.23 KB
Versions: 15
Compression:
Stored size: 1.23 KB
Contents
require 'tmpdir' module MotherBrain module FileSystem autoload :Tempfile, 'mb/file_system/tempfile' class << self # Create the directory structure for motherbrain def init FileUtils.mkdir_p(logs) FileUtils.mkdir_p(manifests) FileUtils.mkdir_p(root) FileUtils.mkdir_p(templates) FileUtils.mkdir_p(tmp) end # @return [Pathname] def logs root.join("logs") end # @return [Pathname] def manifests root.join("manifests") end # @return [Pathname] def root Pathname.new(default_root_path) end # @return [Pathname] def tmp root.join("tmp") end # @return [Pathname] def templates root.join("templates") end # 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] def tmpdir(prefix = nil) Dir.mktmpdir(prefix, tmp) end private def default_root_path File.expand_path(ENV["MOTHERBRAIN_PATH"] || "~/.mb") end end end end
Version data entries
15 entries across 15 versions & 1 rubygems