Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4e10ced5 authored by MICHON Nicolas's avatar MICHON Nicolas
Browse files

[dev] better error handling in Rakefile

parent 52fc8672
No related branches found
No related tags found
No related merge requests found
...@@ -12,8 +12,7 @@ namespace :puppet do ...@@ -12,8 +12,7 @@ namespace :puppet do
all_puppet_tasks.each { |t| all_puppet_tasks.each { |t|
desc "Generate #{t} configuration" desc "Generate #{t} configuration"
task t do task t do
puts "#{PUPPET_DIR}/#{t}.rb #{$CMD_ARGS}" invoke_script "#{PUPPET_DIR}/#{t}.rb"
ruby "#{PUPPET_DIR}/#{t}.rb #{$CMD_ARGS}"
end end
} }
...@@ -26,8 +25,7 @@ namespace :oar do ...@@ -26,8 +25,7 @@ namespace :oar do
desc "Generate oar properties" desc "Generate oar properties"
task :properties do task :properties do
puts "#{OAR_DIR}/oar-properties.rb #{$CMD_ARGS}" invoke_script "#{OAR_DIR}/oar-properties.rb"
ruby "#{OAR_DIR}/oar-properties.rb #{$CMD_ARGS}"
end end
end end
...@@ -36,14 +34,12 @@ namespace :validators do ...@@ -36,14 +34,12 @@ namespace :validators do
desc "Check homogeneity of clusters" desc "Check homogeneity of clusters"
task "homogeneity" do task "homogeneity" do
puts "ruby #{VALIDATORS_DIR}/check-cluster-homogeneity.rb #{$CMD_ARGS}" invoke_script "#{VALIDATORS_DIR}/check-cluster-homogeneity.rb"
system ("ruby #{VALIDATORS_DIR}/check-cluster-homogeneity.rb #{$CMD_ARGS}")
end end
desc "Check input data schema validity" desc "Check input data schema validity"
task "schema" do task "schema" do
puts "ruby #{VALIDATORS_DIR}/yaml-input-schema-validator.rb #{$CMD_ARGS}" invoke_script "#{VALIDATORS_DIR}/yaml-input-schema-validator.rb"
system ("ruby #{VALIDATORS_DIR}/yaml-input-schema-validator.rb #{$CMD_ARGS}")
end end
end end
...@@ -54,8 +50,7 @@ namespace :wiki do ...@@ -54,8 +50,7 @@ namespace :wiki do
all_wiki_tasks.each { |t| all_wiki_tasks.each { |t|
desc "Generate the media parts for #{t}" desc "Generate the media parts for #{t}"
task t do task t do
puts "#{WIKI_DIR}/#{t}.rb #{$CMD_ARGS}" invoke_script "#{WIKI_DIR}/#{t}.rb"
ruby "#{WIKI_DIR}/#{t}.rb #{$CMD_ARGS}"
end end
} }
...@@ -65,10 +60,19 @@ namespace :wiki do ...@@ -65,10 +60,19 @@ namespace :wiki do
end end
desc "Creates json data from inputs" desc "Creates json data from inputs"
task "reference-api" => ["validators:homogeneity", "validators:schema"] do task "reference-api" do
#no args needed here invoke_script "#{REFAPI_DIR}/reference-api.rb"
puts "#{REFAPI_DIR}/reference-api.rb" end
ruby "#{REFAPI_DIR}/reference-api.rb"
#Some scripts may return status != 0 (validators, errors, ...)
#Catch errors and exit properly with status 1 instead of getting Rake errors
def invoke_script(script)
puts "Running #{script} #{$CMD_ARGS}"
begin
ruby "#{script} #{$CMD_ARGS}"
rescue => e
exit 1
end
end end
#Hack rake: call only the first task and consider the rest as arguments to this task #Hack rake: call only the first task and consider the rest as arguments to this task
......
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