You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
699 B
36 lines
699 B
6 years ago
|
#coding=utf-8
|
||
|
#
|
||
|
#
|
||
|
module Trustie
|
||
|
module Gitlab
|
||
|
class Api
|
||
|
# attr_accessor :g
|
||
|
|
||
|
def initialize(client=nil)
|
||
|
@g = client || ::Gitlab.client
|
||
|
end
|
||
|
|
||
|
def trees(project_id)
|
||
|
@g.trees(project_id)
|
||
|
end
|
||
|
|
||
|
def entries(project)
|
||
|
entries = []
|
||
|
api = Trustie::Gitlab::Api.new
|
||
|
trees = api.trees(11)
|
||
|
trees.each do |tree|
|
||
|
entries << Redmine::Scm::Adapters::Entry.new({
|
||
|
:name => tree.name,
|
||
|
:path => tree.id,
|
||
|
:kind => tree.type == 'tree' ? 'dir' : 'file',
|
||
|
:size => nil,
|
||
|
:lastrev => nil
|
||
|
})
|
||
|
end
|
||
|
entries
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|
||
|
end
|