Closed Charlyzzz closed 7 years ago
Add the following script to the migrations
directory of a bibliotheca:
def do_migrate!
Bibliotheca::Collection::Guides.migrate_exercises! do |exercise, guide|
puts "migrating #{guide.name}/#{exercise.name}..."
next if !exercise.description.include?('```') || !exercise.corollary&.include?('```')
case exercise.effective_language_name(guide)
when 'gobstones' then
exercise.description = exercise.description.gsub('```puppet', '```gobstones')
exercise.corollary = exercise.corollary&.gsub('```puppet', '```gobstones')
print_change exercise
when 'wollok' then
exercise.description = exercise.description.gsub('```javascript', '```wollok')
exercise.corollary = exercise.corollary&.gsub('```javascript', '```wollok')
print_change exercise
when 'qsim' then
exercise.description = exercise.description.gsub(/```\n(.*?)```/m) { "```qsim\n#{$1}```" }
exercise.corollary = exercise.corollary&.gsub(/```\n(.*?)```/m) { "```qsim\n#{$1}```" }
print_change exercise
else
;
end
end
end
def print_change(exercise)
puts "Updating #{exercise.name}\n\n#{exercise.description}\n\n#{exercise.description}"
end
And then run
bundle exec rake db:migrate[exercise_markdown_language]
That will do the trick.
Wollok and Gobstones exercises are being tagged with Javascript and Puppet, hence there would not be any visual change in rouge.