Cross Reference: repositories_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
repositories_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
repositories_controller.rb revision 1232081e53efd8b1e4f6f1ad2341bcbe43883ad1
class
RepositoriesController
<
ApplicationController
inherit_resources
defaults
finder
: :
find_by_path
!
load_and_authorize_resource
:
except
=> [:
index
, :
show
]
def
index
@
content_kind
= :
repositories
end
def
show
@
content_kind
= :
repositories
end
def
files
@
path
=
params
[:
path
]
commit_id
= @
repository.commit
_id
(
params
[:
oid
])
@
oid
=
commit_id
[:
oid
]
@
branch_name
=
commit_id
[:
branch_name
]
@
is_head
= @
repository.is
_head
?
(@
oid
)
@
info
= @
repository.path
_info
(
params
[:
path
], @
oid
)
raise
Repository
::
FileNotFoundError
, @
path
if
@
info.nil
?
case
@
info
[:
type
]
when
:
raw
render
text
: @
repository.read
_file
(@
path
,
params
[:
oid
])
[:
content
],
content_type
:
Mime
::
Type.lookup
(
'
application
/
force-download
'
)
when
:
file_base
@
file
= @
repository.read
_file
(@
info
[:
entry
][:
path
],
params
[:
oid
])
end
end
end