<commit_before>require "integrity/project/notifiers"

module Integrity
  class Project
    include DataMapper::Resource
    include Notifiers

    property :id,         Serial
    property :name,       String,   :required => true, :length => 255, :unique => true
    property :permalink,  String,   :length => 255
    property :uri,        URI,      :required => true, :length => 255
    property :branch,     String,   :required => true, :length => 255, :default => "master"
    property :command,    String,   :required => true, :length => 255, :default => "rake"
    property :artifacts,  String,   :required => false, :length => 1000
    property :public,     Boolean,  :default  => true
    property :last_build_id, Integer, :required => false

    timestamps :at

    default_scope(:default).update(:order => [:name.asc])

    has n, :builds
    has n, :notifiers
    belongs_to :last_build, 'Build'

    before :save, :set_permalink

    before :destroy do
      builds.destroy!
    end

    def get_artifacts
      artifacts.split(",")
    end
    
    def artifacts_empty?
      artifacts.nil? || artifacts.empty?
    end

    def repo<commit_msg>Separate artifacts with semicolons, this should cause fewer problems<commit_after>require "integrity/project/notifiers"

module Integrity
  class Project
    include DataMapper::Resource
    include Notifiers

    property :id,         Serial
    property :name,       String,   :required => true, :length => 255, :unique => true
    property :permalink,  String,   :length => 255
    property :uri,        URI,      :required => true, :length => 255
    property :branch,     String,   :required => true, :length => 255, :default => "master"
    property :command,    String,   :required => true, :length => 255, :default => "rake"
    property :artifacts,  String,   :required => false, :length => 1000
    property :public,     Boolean,  :default  => true
    property :last_build_id, Integer, :required => false

    timestamps :at

    default_scope(:default).update(:order => [:name.asc])

    has n, :builds
    has n, :notifiers
    belongs_to :last_build, 'Build'

    before :save, :set_permalink

    before :destroy do
      builds.destroy!
    end

    def get_artifacts
      artifacts.split(";")
    end
    
    def artifacts_empty?
      artifacts.nil? || artifacts.empty?
    end

    def repo
{'fraction_non_alphanumeric': 0.11533586818757921, 'fraction_numerical': 0.01605407689057879, 'mean_word_length': 2.8009630818619584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 37, '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': '1325609', 'n_tokens_mistral': 746, 'n_tokens_neox': 690, 'n_words': 209}