forked from mikelmaron/osm-history
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
158 lines (129 loc) · 3.45 KB
/
Rakefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#This Rakefile defines tasks for setting up Analysis Windows
#The import_analysis_window script does all the heavy lifting
require_relative 'import_scripts/import_analysis_window'
require_relative 'osm-history'
#This function will ensure that we create the proper analysis window
def window
#TODO Make this more robust to handle multiple configuration files
unless ARGV[1].nil?
@this_window ||= AnalysisWindowImport.new(config: ARGV[1]) #Pass the configuration in
else
raise ArgumentError.new("A valid configuration file must be defined")
end
return @this_window
end
def osmhistory
unless ARGV[1].nil?
@osm_history ||= OSMHistory.new( analysis_window: ARGV[1]) #Pass the configuration in
else
raise ArgumentError.new("A valid configuration file must be defined")
end
return @osm_history
end
desc "Given a valid configuration file, Cut and Import all of the data"
task :new do
Rake::Task['cleanup'].invoke
Rake::Task['cut'].invoke
Rake::Task['import:pbf'].invoke
Rake::Task['import:changesets'].invoke
Rake::Task['import:users'].invoke
Rake::Task['import:notes'].invoke
end
desc "Write appropriate configuration file and cut the file to create temp.osm.pbf file"
task :cut do
puts "Writing Configuration File for Cut"
window.write_configuration_file
puts "Running osm history splitter"
window.run_osm_history_splitter
end
desc "Import Scripts"
namespace :import do
desc "Import PBF File (Nodes, Ways, Relations)"
task :pbf do
window.run_mongo_import
end
desc "Import Changesets"
task :changesets do
window.changeset_import
end
desc "Import NodeWays"
task :nodeways do
window.nodeways_import
end
desc "Import Users"
task :users do
window.user_import
end
desc "Import Realtime"
task :realtime do
window.run_live_replication_import
end
desc "Import Notes"
task :notes do
window.note_import
end
desc "Import OSMTM Tags"
task :osmtm_tags do
window.osmtm_tags_import
end
end
desc "Clean up all temp files"
task :cleanup do
if File.exists? "import_scripts/temp.config"
File.delete "import_scripts/temp.config"
end
if File.exists? "import_scripts/temp.osm.pbf"
File.delete "import_scripts/temp.osm.pbf"
end
end
desc "Network Writers"
task :network do
osmhistory = OSMHistory.new(analysis_window: ARGV[1])
osmhistory.run_network_functions #This will need to be pulled out eventually...
end
namespace :questions do
desc "Run all questions defined in the analysis window"
task :all do
Rake::Task['questions:nodes'].invoke
Rake::Task['questions:ways'].invoke
# Rake::Task['questions:relations'].invoke
Rake::Task['questions:changesets'].invoke
Rake::Task['questions:users'].invoke
Rake::Task['questions:multi_users'].invoke
Rake::Task['questions:bbox'].invoke
Rake::Task['questions:notes'].invoke
end
desc "Run Node Questions"
task :nodes do
osmhistory.run_node_questions
end
desc "Run Way Questions"
task :ways do
osmhistory.run_way_questions
end
# desc "Run Relation Questions"
task :relations do
# This doesn't exist yet
osmhistory.run_relation_questions
end
desc "Run Changeset Questions"
task :changesets do
osmhistory.run_changeset_questions
end
desc "Run User Questions"
task :users do
osmhistory.run_user_questions
end
desc "Run Multi-User Questions"
task :multi_users do
osmhistory.run_multi_user_questions
end
desc "Run BBox Questions"
task :bbox do
osmhistory.run_bbox_questions
end
desc "Run Notes Questions"
task :notes do
osmhistory.run_note_questions
end
end