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

criacao de comm

parent be0aa3e3
No related branches found
No related tags found
No related merge requests found
......@@ -9,4 +9,5 @@ f.each_line { |line|
f.close
data.each{|line|
puts line.scan(/"(.*)"/)
puts line.class
}
......@@ -11,7 +11,6 @@ param2 = ARGV[2]
param3 = ARGV[3]
param4 = ARGV[4]
#==========================#
p "dasd"
#==AUTHENTICATION==#
client = Dspace::Client.new(dspace_api: 'https://seppirdev.c3sl.ufpr.br:8443/rest')
if !client.is_running?
......@@ -99,6 +98,7 @@ end
#==DELETE ALL FOR TESTING==#
if task == "delete"
puts "Deletando todas as comunidades"
client.communities.all.each do |community|
client.communities.delete(id: community.id)
end
......
class String
def extractMeta
self[/#{"\""}(.*?)#{"\""}/m, 1]
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 ######################################
......@@ -13,6 +19,8 @@ client.login 'admin@seppirdev.com', 'adminadmin'
root = "/home/starosta/c3sl/seppir/scriptsRuby/files/SEPPIR_SoNucleos/"
d = Dir[root + "*"].sort
data = Array.new(2)
name = String.new
description = String.new
d.each{ |file|
i = 0
meta = file + "/" + file.split('/')[-1] + ".metadata"
......@@ -21,13 +29,22 @@ d.each{ |file|
data[i] = line
i += 1
}
name = data[0].scan(/"(.*)"/)
description = data[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
}
'name'=> name ,
'introductoryText' => description
}
)
)
}
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