Skip to content
Snippets Groups Projects
Commit 46528315 authored by Andre Starosta's avatar Andre Starosta
Browse files

backup

parent 104cc5dd
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 5 deletions
......@@ -22,6 +22,46 @@ def parseCommunity searchComm, client
end
end
def recSubColl target,id,client
i = 0
data = Array.new(2)
name = String.new
description = String.new
puts target
if(target.split(".")[-1] != "metadata")
meta = target + "/" + target.split('/')[-1] + ".metadata"
f = File.open(meta,"r")
f.each_line{|line|
data[i] = line
i += 1
}
j = 0
data.each{|line|
if(j==0)
name = line.extractMeta
end
if(j==1)
description = line.extractMeta
end
j += 1
}
community = client.communities.create(
Dspace::Community.new(
{
'name' => name,
'introductory_text' => description
}
),
parent_community: id
)
d = Dir[target + "/*"]
id = parseCommunity(target.split('/')[-1],client)
d.each{ |subColl|
recSubColl(subColl,id,client)
}
end
end
###################################################################################################
$LOAD_PATH.unshift('/home/starosta/c3sl/seppir/scriptsRuby/rest-client-gem/lib')
#################################### A U T E N T I C A C A O ######################################
......@@ -40,6 +80,14 @@ d = Dir[root + "*"].sort
data = Array.new(2)
name = String.new
description = String.new
community = client.communities.create(
Dspace::Community.new(
{
'name' => "SEPPIR"
}
)
)
idS = parseCommunity("SEPPIR",client)
d.each{ |file|
i = 0
meta = file + "/" + file.split('/')[-1] + ".metadata"
......@@ -60,10 +108,17 @@ d.each{ |file|
}
community = client.communities.create(
Dspace::Community.new(
{
'name'=> name ,
'introductoryText' => description
}
)
{
'name' => name,
'introductoryText' => description
}
),
parentCommunity: "SEPPIR"
)
id = parseCommunity(file.split('/')[-1],client)
g = Dir[file + "/*"]
g.each{|subDirect|
recSubColl(subDirect,id,client)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment