<commit_before>#
# Generates a symlink for exposing the repositories via git daemon
#
module Repository::Symlink
  extend ActiveSupport::Concern

  PATH = Ontohub::Application.config.symlink_path

  included do
    after_save     :symlink_update, if: :path_changed?
    before_destroy :symlink_remove
  end

  def symlink_name
    PATH.join("#{path}.git")
  end

  protected

  def symlink_update
    PATH.mkpath
    symlink_remove
    symlink_name.make_symlink local_path
  end

  def symlink_remove
    symlink_name.unlink if symlink_name.exist?
  end

end
<commit_msg>Load symlink path at runtime instead of boot time<commit_after>#
# Generates a symlink for exposing the repositories via git daemon
#
module Repository::Symlink
  extend ActiveSupport::Concern

  included do
    after_save     :symlink_update, if: :path_changed?
    before_destroy :symlink_remove
  end

  def symlink_name
    Ontohub::Application.config.symlink_path.join("#{path}.git")
  end

  protected

  def symlink_update
    Ontohub::Application.config.symlink_path.mkpath
    symlink_remove
    symlink_name.make_symlink local_path
  end

  def symlink_remove
    symlink_name.unlink if symlink_name.exist?
  end

end

{'fraction_non_alphanumeric': 0.060884070058381985, 'fraction_numerical': 0.0, 'mean_word_length': 4.02092050209205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1762154', 'n_tokens_mistral': 406, 'n_tokens_neox': 394, 'n_words': 96}