Class: FileHelpers
- Inherits:
-
Object
- Object
- FileHelpers
- Defined in:
- lib/cmaker/file.rb
Class Method Summary collapse
- .create_directory(directory_path, cmake_string) ⇒ Object
- .delete_directory(directory_path) ⇒ Object
- .write_string_to_file(file_content, file_path) ⇒ Object
Class Method Details
.create_directory(directory_path, cmake_string) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/cmaker/file.rb', line 4 def self.create_directory(directory_path, cmake_string) FileUtils.mkpath directory_path if cmake_string.nil? == false cmake_file_path = "#{directory_path}/CMakeLists.txt" self.write_string_to_file(cmake_string, cmake_file_path) end end |
.delete_directory(directory_path) ⇒ Object
13 14 15 |
# File 'lib/cmaker/file.rb', line 13 def self.delete_directory(directory_path) FileUtils.rm_r(directory_path) end |
.write_string_to_file(file_content, file_path) ⇒ Object
17 18 19 20 21 |
# File 'lib/cmaker/file.rb', line 17 def self.write_string_to_file(file_content, file_path) cmake = File.new(file_path, "w") cmake.puts(file_content) cmake.close end |