Module: Bobkit::FileHelpers
- Included in:
- Assets, CoffeeBridge, SassBridge, SlimBridge::SlimHandler
- Defined in:
- lib/bobkit/file_helpers.rb
Instance Method Summary collapse
- #copy_file(source, target) ⇒ Object (also: #copy_folder, #copy_entry)
- #create_file(path, content) ⇒ Object
- #create_folder(path) ⇒ Object
- #create_folder_for(path) ⇒ Object
Instance Method Details
#copy_file(source, target) ⇒ Object Also known as: copy_folder, copy_entry
16 17 18 19 |
# File 'lib/bobkit/file_helpers.rb', line 16 def copy_file(source, target) create_folder_for target FileUtils.copy_entry source, target end |
#create_file(path, content) ⇒ Object
11 12 13 14 |
# File 'lib/bobkit/file_helpers.rb', line 11 def create_file(path, content) create_folder_for path File.write path, content end |
#create_folder(path) ⇒ Object
3 4 5 |
# File 'lib/bobkit/file_helpers.rb', line 3 def create_folder(path) FileUtils.mkdir_p(path) unless File.directory?(path) end |
#create_folder_for(path) ⇒ Object
7 8 9 |
# File 'lib/bobkit/file_helpers.rb', line 7 def create_folder_for(path) create_folder File.dirname(path) end |