Cross Reference:
xref
: /
ontohub
/
app
/
models
/
repository
/
file_list.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
file_list.rb revision c85bd4d521f2e3279b1b7ea65015995d03fd16d5
module
Repository
::
FileList
extend
ActiveSupport
::
Concern
def
list_folder
(
folderpath
,
commit_oid
=
nil
)
folderpath
||=
'/'
contents
=
git.folder
_contents
(
commit_oid
,
folderpath
)
.
each_with_index
do
|v,i|
v[:
index
] = i
end
grouped
=
Hash
[
contents.group
_by
do
| e |
{
type
: e[:
type
],
name
:
basename
(e[:
name
])
}
end.map
do
| k, v |
[k[:
name
], v]
end
]
grouped
end
def
basename
(
name
)
name.split
(
'.'
)
[
0
]
end
end