-
Notifications
You must be signed in to change notification settings - Fork 9
/
Rakefile
189 lines (156 loc) · 3.94 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#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 'epic-osm'
require_relative 'modules/realtime'
#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 epicosm
unless ARGV[1].nil?
@epic_osm ||= EpicOSM.new( analysis_window: ARGV[1]) #Pass the configuration in
else
raise ArgumentError.new("A valid configuration file must be defined")
end
return @epic_osm
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_epic_osm_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 OSMTM Tags"
task :osmtm_tags do
window.osmtm_tags_import
end
desc "Import Realtime"
task :realtime do
window.run_live_replication_import
end
desc "Import Notes"
task :notes do
window.note_import
end
end
desc "Indexes"
namespace :index do
desc "Rebuild Changeset Indexes"
task :changesets do
window
ChangesetImport.new.add_indexes
end
desc "Rebuild User Indexes"
task :users do
window
UserImport.new.add_indexes
end
end
desc "Realtime"
task :realtime do
include Realtime
Realtime::updateYAML(ARGV[1])
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.osh.pbf"
File.delete "import_scripts/temp.osh.pbf"
end
end
desc "Network Writers"
task :network do
epicosm = EpicOSM.new(analysis_window: ARGV[1])
epicosm.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
epicosm.run_node_questions
end
desc "Run Way Questions"
task :ways do
epicosm.run_way_questions
end
# desc "Run Relation Questions"
task :relations do
# This doesn't exist yet
epicosm.run_relation_questions
end
desc "Run Changeset Questions"
task :changesets do
epicosm.run_changeset_questions
end
desc "Run Advanced Changeset Questions"
task :changeset_geometries do
epicosm.run_advanced_changeset_questions
end
desc "Run User Questions"
task :users do
epicosm.run_user_questions
end
desc "Run Multi-User Questions"
task :multi_users do
epicosm.run_multi_user_questions
end
desc "Run BBox Questions"
task :bbox do
epicosm.run_bbox_questions
end
desc "Run Notes Questions"
task :notes do
epicosm.run_note_questions
end
desc "Run Network Questions"
task :networks do
epicosm.run_network_questions
end
end