Class: Kybus::CLI::FileWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/kybus/cli/file_writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_path) ⇒ FileWriter

Returns a new instance of FileWriter.



6
7
8
# File 'lib/kybus/cli/file_writer.rb', line 6

def initialize(base_path)
  @base_path = base_path
end

Instance Method Details

#write(relative_path, content) ⇒ Object



10
11
12
13
14
# File 'lib/kybus/cli/file_writer.rb', line 10

def write(relative_path, content)
  full_path = File.join(@base_path, relative_path)
  FileUtils.mkdir_p(File.dirname(full_path))
  File.write(full_path, content)
end