Cross Reference:
xref
: /
ontohub
/
app
/
models
/
repository
/
symlink.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
symlink.rb revision ee5342a8882c2fc7631fcffb5497e6597747887c
#
# 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