migrants/Rakefile

90 lines
2.6 KiB
Ruby

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