Class: FileRecord::Directory
- Inherits:
-
Object
- Object
- FileRecord::Directory
- Defined in:
- lib/file_record/directory.rb
Class Method Summary collapse
-
.create_new(options = {}) ⇒ Object
Create a new directory structure, copying the contents from directory_structure/tempo into ~/tempo.
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(={}) directory = .fetch( :directory, Dir.home ) cwd = File. 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 |