Project edit

This commit is contained in:
alexey
2025-03-08 00:13:31 +03:00
parent f88ef52d87
commit e0d169e679
11 changed files with 288 additions and 4 deletions

View File

@@ -18,6 +18,9 @@ end
class ReposProjects < Sequel::Model(:repos_projects)
end
class ProjectsReposSpec < Sequel::Model(:projects_repos_spec)
end
class DBase
attr :error, :last_id
@@ -34,7 +37,7 @@ class DBase
end
def get_repo_info_by_name(repo_name)
Repos.where(reponame: repo_name)
Repos.where(reponame: repo_name).first
end
def get_repo_info_by_id(id)
@@ -159,4 +162,8 @@ class DBase
@last_id = id
end
end
def get_project_repo_spec(prj_id, git_id)
ProjectsReposSpec.where(proj_id: prj_id.to_i, repo_id: git_id.to_i).first
end
end

View File

@@ -65,13 +65,11 @@ class GitRepo
repo_name = File.basename(fl, ".git")
db_info = @db.get_repo_info_by_name(repo_name)
unless db_info.nil?
db_info = db_info.first
repos_data << { :reponame => db_info.reponame, :descr => db_info.descr, :public => db_info.public, :id => db_info.id }
else
result = create_git_db_only(repo_name)
if result.nil?
db_info = @db.get_repo_info_by_name(repo_name)
db_info = db_info.first
repos_data << { :reponame => db_info.reponame, :descr => db_info.descr, :public => db_info.public, :id => db_info.id }
end
end

View File

@@ -59,6 +59,19 @@ class ProjectsActions
fname
end
def get_project_config(id)
@error = nil
fname = nil
prj = @db.proj(id)
if prj.nil?
@error = "Проекта с id = #{id} не существует"
else
fname = File.expand_path("#{prj[:projname]}.prj", @path)
fname = File.join(fname, PROJECTS_STRUCTURE[:CONFIGS], "#{prj[:projname]}.cfg")
end
fname
end
def get_project_path_git(id, gitname)
proj_path = get_project_path(id)
File.join(proj_path, PROJECTS_STRUCTURE[:SRC], gitname)

View File

@@ -30,3 +30,7 @@ def check_safe_path(filename)
home_dir = Dir.home
filename.start_with?("/etc/mock") || filename.start_with?(current_dir) || filename.start_with?(home_dir)
end
def get_spec_files_in_dir(directory)
Dir.glob(File.join(directory, "**", "*")).reject { |f| File.directory?(f) }.select { |f| File.extname(f) == ".spec" }.map { |f| f.delete_prefix(directory + "/") }
end