class Cardio::Mod::LoadStrategy::TmpFiles

LoadStrategy for mod modules. It writes the code to tmp files and then loads the tmp files. (deprecated)

Public Instance Methods

clean_comments?() click to toggle source
# File lib/cardio/mod/load_strategy/tmp_files.rb, line 12
def clean_comments?
  true
end
load_modules() click to toggle source
# File lib/cardio/mod/load_strategy/tmp_files.rb, line 7
def load_modules
  generate_tmp_files if rewrite_tmp_files?
  load_tmp_files
end

Private Instance Methods

prepare_tmp_dir(path) click to toggle source
# File lib/cardio/mod/load_strategy/tmp_files.rb, line 18
def prepare_tmp_dir path
  return unless rewrite_tmp_files?

  p = Card.paths[path]
  FileUtils.rm_rf p.first, secure: true if p.existent.first
  FileUtils.mkdir_p p.first
end
rewrite_tmp_files?() click to toggle source
# File lib/cardio/mod/load_strategy/tmp_files.rb, line 26
def rewrite_tmp_files?
  return @rewrite if defined? @rewrite

  @rewrite = !(Rails.env.production? && Card.paths["tmp/set"].existent.first)
end
write_tmp_file(from_file, to_file, const_parts) click to toggle source
# File lib/cardio/mod/load_strategy/tmp_files.rb, line 32
def write_tmp_file from_file, to_file, const_parts
  FileUtils.mkdir_p File.dirname(to_file)
  mt = template_class.new const_parts, from_file, self
  File.write to_file, mt.to_s
end