Added projects. Part 4
This commit is contained in:
@@ -119,6 +119,10 @@ class DBase
|
||||
Projects.order(:id).all
|
||||
end
|
||||
|
||||
def proj(id)
|
||||
Projects[id]
|
||||
end
|
||||
|
||||
def proj_create(proj_name, proj_descr)
|
||||
@error = nil
|
||||
data = Projects.where(projname: proj_name).first
|
||||
@@ -130,4 +134,17 @@ class DBase
|
||||
end
|
||||
@error
|
||||
end
|
||||
|
||||
def get_gits_for_projects(id)
|
||||
result = []
|
||||
git_list = ReposProjects.where(proj_id: id.to_i).all
|
||||
unless git_list.nil?
|
||||
result = git_list.map do |item|
|
||||
Repos[item[:repo_id]]
|
||||
end.reject do |item|
|
||||
item.nil?
|
||||
end
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,6 +37,15 @@ class ProjectsActions
|
||||
prj
|
||||
end
|
||||
|
||||
def get_project(id)
|
||||
prj = nil
|
||||
File.open("locks/prjcreate", "r") do |f|
|
||||
f.flock(File::LOCK_SH)
|
||||
prj = @db.proj(id.to_i)
|
||||
end
|
||||
prj
|
||||
end
|
||||
|
||||
def create_project(name, description, configuration)
|
||||
@error = nil
|
||||
ret_val = 0
|
||||
@@ -77,4 +86,8 @@ class ProjectsActions
|
||||
end
|
||||
ret_val
|
||||
end
|
||||
|
||||
def get_project_gits(id)
|
||||
@db.get_gits_for_projects(id)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user