Added projects. Part 1

This commit is contained in:
alexey
2025-02-23 23:59:45 +03:00
parent d278cda22d
commit e68e781759
7 changed files with 106 additions and 5 deletions

30
classes/projects.rb Normal file
View File

@@ -0,0 +1,30 @@
require_relative "db"
class ProjectsActions
attr :path, :error, :db
def initialize(path, db)
@path = nil
@error = nil
@db = db
if File.absolute_path?(path)
if File.exist?(path)
@path = path
end
else
apath = File.realpath(path)
if File.exist?(apath)
@path = apath
end
end
end
def get_projects
prj = []
File.open("locks/prjcreate", "r") do |f|
f.flock(File::LOCK_SH)
prj = @db.proj_list
end
prj
end
end