From eb255df64a330a30f15f663667ce0a0392f4f4b8 Mon Sep 17 00:00:00 2001 From: Daniel Hernandez Date: Sun, 22 Feb 2026 18:40:33 +0100 Subject: [PATCH] Create a Rakefile. --- Rakefile | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 Rakefile diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..4a8f451 --- /dev/null +++ b/Rakefile @@ -0,0 +1,90 @@ +RUBY = RbConfig.ruby + +def run(script) + sh "#{RUBY} #{script}" +end + +# ── Individual file tasks ──────────────────────────────────────────────────── + +file 'data/countries.ttl' => 'src/map_countries_from_location.rb' do + run 'src/map_countries_from_location.rb' +end + +# Generates data/countries_wikidata_review.ttl as a side-effect +file 'data/countries_wikidata.ttl' => ['data/countries.ttl', 'src/link_countries_to_wikidata.rb'] do + run 'src/link_countries_to_wikidata.rb' +end + +file 'data/locations.ttl' => 'src/map_locations.rb' do + run 'src/map_locations.rb' +end + +file 'data/migrations.ttl' => 'src/map_migration_table.rb' do + run 'src/map_migration_table.rb' +end + +file 'data/occupations.ttl' => 'src/map_occupations_from_person_profession.rb' do + run 'src/map_occupations_from_person_profession.rb' +end + +file 'data/organisations.ttl' => 'src/map_organisation.rb' do + run 'src/map_organisation.rb' +end + +file 'data/personnames.ttl' => 'src/map_personnames.rb' do + run 'src/map_personnames.rb' +end + +# Generates data/persons_occupations_review.ttl as a side-effect +file 'data/persons_occupations.ttl' => ['data/occupations.ttl', 'src/map_person_profession.rb'] do + run 'src/map_person_profession.rb' +end + +file 'data/002-persons.ttl' => 'src/map_persons.rb' do + run 'src/map_persons.rb' +end + +file 'data/relationships.ttl' => 'src/map_relationship.rb' do + run 'src/map_relationship.rb' +end + +file 'data/persons-religions.ttl' => 'src/map_religions.rb' do + run 'src/map_religions.rb' +end + +# Generates data/religions_wikidata_review.ttl as a side-effect +file 'data/religions_wikidata.ttl' => ['data/religions.ttl', 'src/link_religions_to_wikidata.rb'] do + run 'src/link_religions_to_wikidata.rb' +end + +file 'data/works.ttl' => 'src/map_work.rb' do + run 'src/map_work.rb' +end + +# ── Aggregate tasks ────────────────────────────────────────────────────────── + +GENERATED = %w[ + data/countries.ttl + data/countries_wikidata.ttl + data/locations.ttl + data/migrations.ttl + data/occupations.ttl + data/organisations.ttl + data/personnames.ttl + data/persons_occupations.ttl + data/002-persons.ttl + data/relationships.ttl + data/persons-religions.ttl + data/religions_wikidata.ttl + data/works.ttl +].freeze + +task default: GENERATED + +task :clean do + review_files = %w[ + data/countries_wikidata_review.ttl + data/religions_wikidata_review.ttl + ] + rm_f GENERATED + review_files +end