Initial commit
This commit is contained in:
27
classes/db.rb
Normal file
27
classes/db.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
require "sequel"
|
||||
|
||||
cfg_internal = IniConfig.new()
|
||||
Sequel.connect(cfg_internal.get_db)
|
||||
|
||||
class Repos < Sequel::Model(:repos)
|
||||
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
|
||||
end
|
||||
Reference in New Issue
Block a user