Cross Reference:
xref
: /
ontohub
/
app
/
models
/
repository
/
files_list.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
files_list.rb revision 685ccf70e6e6c011ed6e5accf31419124efe7d4f
module
Repository
::
FilesList
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