Class: FileRecord::Directory

Inherits:
Object
  • Object
show all
Defined in:
lib/file_record/directory.rb

Class Method Summary collapse

Class Method Details

.create_new(options = {}) ⇒ Object

Create a new directory structure, copying the contents from directory_structure/tempo into ~/tempo. If a directory is passed in through the options, the tempo directory will be created within that directory instead, in the users home folder

ex. create new(directory: “custom/directory”)

> Users/usrname/custom/directory/tempo



15
16
17
18
19
20
21
22
23
24
# File 'lib/file_record/directory.rb', line 15

def create_new(options={})

  directory = options.fetch( :directory, Dir.home )
  cwd = File.expand_path File.dirname(__FILE__)
  source = File.join(cwd, "directory_structure/tempo")
  if ! Dir.exists? directory
    FileUtils.mkdir_p directory
  end
  FileUtils.cp_r source, directory
end