Cross Reference: rake_helper.rb
xref
: /
ontohub
/
lib
/
rake_helper.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
rake_helper.rb revision bc9e15ca07956db262187916be61f3567167e1c6
module
RakeHelper
def
self.import
_logicgraph
(
email
=
nil
)
def
save
(
user
,
symbol
)
symbol.user
=
user
if
symbol.has
_attribute
?
"user_id"
begin
symbol.save
!
rescue
ActiveRecord
::
RecordInvalid
=> e
puts
"Validation-Error: #{
e.record
} (#{
e.message
})"
end
end
user
=
User.find
_all_by_admin
(
true
)
.
first
user
=
User.find
_by_email
!
email
unless
nil.nil
?
Dir.mktmpdir
do
|
dir
|
Dir.chdir
(
dir
)
do
system
(
"#{
Settings.hets.executable
_path} -G"
)
LogicgraphParser.parse
(
File.open
(
File.join
(
dir
,
'
LogicGraph.xml
'
)
)
,
logic
:
Proc.new
{ |h|
save
(
user
, h)
},
language
:
Proc.new
{ |h|
save
(
user
, h)
},
logic_mapping
:
Proc.new
{ |h|
save
(
user
, h)
},
support
:
Proc.new
{ |h|
save
(
user
, h)
})
end
end
end
end