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.
31 lines
512 B
31 lines
512 B
2 months ago
|
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
|