Module: Deployman::Component::Filemanager
- Defined in:
- lib/deployman/component/filemanager.rb
Class Method Summary collapse
-
.create_file(path, content) ⇒ Object
create file.
Class Method Details
.create_file(path, content) ⇒ Object
create file
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/deployman/component/filemanager.rb', line 7 def self.create_file(path, content) # create unexisting folders from path dirname = File.dirname(path) unless File.directory?(dirname) FileUtils.mkdir_p(dirname) end # create file # existing file will be overwritten File.open(path, 'wb') do |file| file.write(content) file.close end end |