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.
|
|
|
require "sequel"
|
|
|
|
|
|
|
|
cfg_internal = IniConfig.new()
|
|
|
|
Sequel.connect(cfg_internal.get_db)
|
|
|
|
|
|
|
|
class Repos < Sequel::Model(:repos)
|
|
|
|
end
|
|
|
|
|
|
|
|
class Recips < Sequel::Model(:recips)
|
|
|
|
end
|
|
|
|
|
|
|
|
class RepocRecips < Sequel::Model(:repos_recips)
|
|
|
|
end
|
|
|
|
|
|
|
|
class DBase
|
|
|
|
attr :error, :last_id
|
|
|
|
|
|
|
|
def creategit(project_name, description)
|
|
|
|
@error = nil
|
|
|
|
data = Repos.where(reponame: project_name)
|
|
|
|
unless data.nil?
|
|
|
|
id = Repos.insert(reponame: project_name, descr: description, public: 1)
|
|
|
|
@last_id = id
|
|
|
|
else
|
|
|
|
@error = "Данный репозиторий уже существует"
|
|
|
|
end
|
|
|
|
@error
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_repo_info_by_name(repo_name)
|
|
|
|
Repos.where(reponame: repo_name)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_recips()
|
|
|
|
result = []
|
|
|
|
Recips.order(:id).map do |item|
|
|
|
|
{ :fname => item[:filepath], :descr => item[:descr], :id => item[:id] }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|