class TyranoDsl::ExportGame::FileActions::CreateFile

Create a file with a custom content

Attributes

content[R]

@return [String]

path[R]

@return [String]

Public Class Methods

new(path, content) click to toggle source

@param [String] path @param [String] content

# File lib/tyrano_dsl/export_game/file_actions/create_file.rb, line 15
def initialize(path, content)
  @path = path
  @content = content
  log {self.to_s}
end

Public Instance Methods

run(tyrano_project_path) click to toggle source

@param [String] tyrano_project_path @return [void]

# File lib/tyrano_dsl/export_game/file_actions/create_file.rb, line 23
def run(tyrano_project_path)
  full_path = File.join(tyrano_project_path, path)
  log {"Creating file [#{full_path}]"}
  create_parent_dir_if_not_exist(full_path)
  File.write(full_path, content)
end
to_s() click to toggle source
# File lib/tyrano_dsl/export_game/file_actions/create_file.rb, line 30
def to_s
  "Create file [#{path}]"
end