Sha256: 171a34f85ed74c31ce092e9bec1c9d428a10e11621d31db7503e687cd1f636a1
Contents?: true
Size: 634 Bytes
Versions: 6
Compression:
Stored size: 634 Bytes
Contents
module Gritano module Core class Repository < ActiveRecord::Base has_many :permissions has_many :users, through: :permissions validates :name, presence: true validates :name, uniqueness: true validates :name, format: /\.git\z/ validates :path, presence: true before_create :create_bare_repo after_destroy :destroy_bare_repo def create_bare_repo Grit::Repo.init_bare(full_path) end def destroy_bare_repo FileUtils.rm_r(full_path, force: true) end def full_path File.join(path, name) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems