Added projects. Part 1
This commit is contained in:
30
classes/projects.rb
Normal file
30
classes/projects.rb
Normal 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
|
||||
Reference in New Issue
Block a user