-
Notifications
You must be signed in to change notification settings - Fork 0
/
transform.rb
executable file
·48 lines (39 loc) · 1.02 KB
/
transform.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env ruby
require 'optparse'
require_relative './scripts/bischoff/csv_import.rb'
require_relative './scripts/gca/csv_import.rb'
require_relative './scripts/pan_african/csv_import.rb'
require_relative './scripts/rumpf/csv_import.rb'
require_relative './scripts/supplique/csv_import.rb'
def create_output_dir(project)
dir_name = File.expand_path("output/#{project}")
Dir.mkdir(dir_name) unless File.exist?(dir_name)
end
def main
# Parse input options
options = {}
OptionParser.new do |opts|
opts.on '-p PROJECT', '--project PROJECT', 'Project name'
end.parse!(into: options)
unless options[:project]
puts 'Project name is required in arguments.'
exit 1
end
create_output_dir(options[:project])
case options[:project]
when 'supplique'
parse_supplique
when 'gca'
parse_gca
when 'rumpf'
parse_rumpf
when 'bischoff'
parse_bischoff
when 'pan_african'
parse_pan_african
else
puts 'No matching project found.'
exit 1
end
end
main if __FILE__ == $PROGRAM_NAME