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 4a46649d5c0b3f77917adaa5f6bfc213fb7a0e88
class
RepositoriesController
<
ApplicationController
inherit_resources
defaults
finder
: :
find_by_path
!
load_and_authorize_resource
:
except
=> [:
index
, :
show
]
def
files
@
path
=
params
[:
path
]
commit_id
= @
repository.commit
_id
(
params
[:
oid
])
@
oid
=
commit_id
[:
oid
]
@
branch_name
=
commit_id
[:
branch_name
]
@
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
, @
oid
)
[:
content
],
content_type
:
Mime
::
Type.lookup
(
'
application
/
force-download
'
)
when
:
file_base
@
file
= @
repository.read
_file
(@
info
[:
entry
][:
path
],
params
[:
oid
])
end
end
def
entries_info
render
json
: @
repository.entries
_info
(@
oid
,
params
[:
path
])
end
def
diff
@
oid
= @
repository.commit
_id
(
params
[:
oid
])
[:
oid
]
@
changed_files
= @
repository.changed
_files
(@
oid
)
end
def
history
@
path
=
params
[:
path
]
@
oid
= @
repository.commit
_id
(
params
[:
oid
])
[:
oid
]
@
current_file
= @
repository.read
_file
(@
path
, @
oid
)
if
@
path
@
commits
= @
repository.commits
(@
oid
, @
path
)
end
end