<commit_before># Remove existing repositories
FileUtils.rm_rf Ontohub::Application.config.git_root

# Create a repository
repository = Repository.create! \
  name: 'Default'

# Add permissions
Repository.find_each do |o|
  o.permissions.create! \
    subject: Team.first,
    role: 'owner'
end

Repository.first.permissions.create! \
  subject: User.first,
  role: 'editor'

# Import ontologies
ontologies = %w[
  owl/Domain_Fields_Core.owl
  casl/partial_order.casl
  casl/test1.casl
  casl/test2.casl
  clif/cat.clif
  owl/generations.owl
  owl/pizza.owl
]
ontologies.each do |path|
  path = File.join(Rails.root, 'test', 'fixtures', 'ontologies', path)
  basename = File.basename(path)
  
  version = repository.save_file path, basename, "#{basename} added", @user
  version.ontology.update_attribute :description, Faker::Lorem.paragraph
end
Rake::Task['generate:categories'].invoke<commit_msg>Removed invokation of generate:categories to get seeds working again.<commit_after># Remove existing repositories
FileUtils.rm_rf Ontohub::Application.config.git_root

# Create a repository
repository = Repository.create! \
  name: 'Default'

# Add permissions
Repository.find_each do |o|
  o.permissions.create! \
    subject: Team.first,
    role: 'owner'
end

Repository.first.permissions.create! \
  subject: User.first,
  role: 'editor'

# Import ontologies
ontologies = %w[
  owl/Domain_Fields_Core.owl
  casl/partial_order.casl
  casl/test1.casl
  casl/test2.casl
  clif/cat.clif
  owl/generations.owl
  owl/pizza.owl
]
ontologies.each do |path|
  path = File.join(Rails.root, 'test', 'fixtures', 'ontologies', path)
  basename = File.basename(path)
  
  version = repository.save_file path, basename, "#{basename} added", @user
  version.ontology.update_attribute :description, Faker::Lorem.paragraph
end
{'fraction_non_alphanumeric': 0.11719181868435599, 'fraction_numerical': 0.002211166390270868, 'mean_word_length': 4.62111801242236, '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': '467087', 'n_tokens_mistral': 635, 'n_tokens_neox': 618, 'n_words': 132}