class Bit def insert_new @project_id = insert_new_project unless @project_id data = { :name => @name, :project => @project_id, :root => @root, :commit => nil, :commit_time => nil } @@db.insert_info :bits, data end def insert_new_project fail DuplicateAttr if @@db.select_info_by_name :projects, [ :name ], @project_name data = { :project => @project_name, :git => @git } @@db.insert_info :projects, data end def load_info info = @@db.select_info_by_id :bits, @@info[:bits], @id @name = info[:name] @project_id = info[:project] project_info = @@db.select_info_by_id :projects, @@info[:projects], @project_id info.merge! project_info @project_name = info[:name] @root = info[:root] @git = info[:git_path] @commit = { :name => info[:commit], :time => info[:commit_time] } end end