ninoxe 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/chouette/time_table.rb +74 -22
- data/app/models/chouette/vehicle_journey.rb +2 -5
- data/db/migrate/20130410063411_add_shortcut_to_time_table.rb +6 -0
- data/db/migrate/20130410100706_set_shortcut_to_existing_time_table.rb +10 -0
- data/db/migrate/20130410143542_resize_chouette_columns.rb +5 -0
- data/lib/factories/chouette_time_table.rb +1 -0
- data/lib/ninoxe/version.rb +1 -1
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config/application.rb +56 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/{config/database.yml.me → spec/dummy/config/database.yml} +0 -2
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/active_record.rb +2 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/log/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/models/chouette/access_link_spec.rb +78 -0
- data/spec/models/chouette/access_point_spec.rb +222 -0
- data/spec/models/chouette/active_record_spec.rb +121 -0
- data/spec/models/chouette/area_type_spec.rb +53 -0
- data/spec/models/chouette/company_spec.rb +51 -0
- data/spec/models/chouette/connection_link_spec.rb +56 -0
- data/spec/models/chouette/direction_spec.rb +60 -0
- data/spec/models/chouette/exporter_spec.rb +28 -0
- data/spec/models/chouette/file_validator_spec.rb +28 -0
- data/spec/models/chouette/group_of_line_spec.rb +31 -0
- data/spec/models/chouette/journey_pattern_spec.rb +62 -0
- data/spec/models/chouette/line_spec.rb +106 -0
- data/spec/models/chouette/loader_spec.rb +69 -0
- data/spec/models/chouette/network_spec.rb +22 -0
- data/spec/models/chouette/object_id_spec.rb +146 -0
- data/spec/models/chouette/route_spec.rb +159 -0
- data/spec/models/chouette/stop_area_spec.rb +382 -0
- data/spec/models/chouette/stop_point_spec.rb +39 -0
- data/spec/models/chouette/time_table_spec.rb +350 -0
- data/spec/models/chouette/transport_mode_spec.rb +64 -0
- data/spec/models/chouette/vehicle_journey_at_stop_spec.rb +46 -0
- data/spec/models/chouette/vehicle_journey_spec.rb +204 -0
- data/spec/spec_helper.rb +62 -0
- metadata +445 -272
- data/db/migrate/20130204141720_add_foreign_keys.rb~ +0 -277
- data/lib/ninoxe.rb~ +0 -7
@@ -1,277 +0,0 @@
|
|
1
|
-
require "forwardable"
|
2
|
-
|
3
|
-
class AddForeignKeys < ActiveRecord::Migration
|
4
|
-
def up
|
5
|
-
# t.remove_foreign_key does not works if foreign key doesn't exists so check before if keys already exists
|
6
|
-
change_table :access_links do |t|
|
7
|
-
if @connection.foreign_keys(:access_links).any?
|
8
|
-
@connection.foreign_keys(:access_links).map do |f|
|
9
|
-
name = f.options[:name]
|
10
|
-
if (name == "aclk_acpt_fkey" || name == "aclk_area_fkey" )
|
11
|
-
remove_foreign_key :access_links, :name => name
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
t.foreign_key :access_points, :dependent => :delete, :name => 'aclk_acpt_fkey'
|
16
|
-
t.foreign_key :stop_areas, :dependent => :delete, :name => 'aclk_area_fkey'
|
17
|
-
end
|
18
|
-
change_table :access_points do |t|
|
19
|
-
if @connection.foreign_keys(:access_points).any?
|
20
|
-
@connection.foreign_keys(:access_points).map do |f|
|
21
|
-
name = f.options[:name]
|
22
|
-
if (name == "access_area_fkey" )
|
23
|
-
remove_foreign_key :access_points, :name => name
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
t.foreign_key :stop_areas, :dependent => :delete, :name => 'access_area_fkey'
|
28
|
-
end
|
29
|
-
change_table :connection_links do |t|
|
30
|
-
if @connection.foreign_keys(:connection_links).any?
|
31
|
-
@connection.foreign_keys(:connection_links).map do |f|
|
32
|
-
name = f.options[:name]
|
33
|
-
if (name == "colk_endarea_fkey" || name == "colk_startarea_fkey" )
|
34
|
-
remove_foreign_key :connection_links, :name => name
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
t.foreign_key :stop_areas, :dependent => :delete, :column => 'arrival_id', :name => 'colk_endarea_fkey'
|
39
|
-
t.foreign_key :stop_areas, :dependent => :delete, :column => 'departure_id', :name => 'colk_startarea_fkey'
|
40
|
-
end
|
41
|
-
change_table :group_of_lines_lines do |t|
|
42
|
-
if @connection.foreign_keys(:group_of_lines_lines).any?
|
43
|
-
@connection.foreign_keys(:group_of_lines_lines).map do |f|
|
44
|
-
name = f.options[:name]
|
45
|
-
if (name == "groupofline_group_fkey" || name == "groupofline_line_fkey" )
|
46
|
-
remove_foreign_key :group_of_lines_lines, :name => name
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
t.foreign_key :group_of_lines, :dependent => :delete, :name => 'groupofline_group_fkey'
|
51
|
-
t.foreign_key :lines, :dependent => :delete, :name => 'groupofline_line_fkey'
|
52
|
-
end
|
53
|
-
change_table :journey_patterns do |t|
|
54
|
-
if @connection.foreign_keys(:journey_patterns).any?
|
55
|
-
@connection.foreign_keys(:journey_patterns).map do |f|
|
56
|
-
name = f.options[:name]
|
57
|
-
if (name == "arrival_point_fkey" || name == "departure_point_fkey" || name == "jp_route_fkey")
|
58
|
-
remove_foreign_key :journey_patterns, :name => name
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
t.foreign_key :stop_points, :dependent => :nullify, :column => 'arrival_stop_point_id', :name => 'arrival_point_fkey'
|
63
|
-
t.foreign_key :stop_points, :dependent => :nullify, :column => 'departure_stop_point_id', :name => 'departure_point_fkey'
|
64
|
-
t.foreign_key :routes, :dependent => :delete, :name => 'jp_route_fkey'
|
65
|
-
end
|
66
|
-
change_table :journey_patterns_stop_points do |t|
|
67
|
-
if @connection.foreign_keys(:journey_patterns_stop_points).any?
|
68
|
-
@connection.foreign_keys(:journey_patterns_stop_points).map do |f|
|
69
|
-
name = f.options[:name]
|
70
|
-
if (name == "jpsp_jp_fkey" || name == "jpsp_stoppoint_fkey" )
|
71
|
-
remove_foreign_key :journey_patterns_stop_points, :name => name
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
t.foreign_key :journey_patterns, :dependent => :delete, :name => 'jpsp_jp_fkey'
|
76
|
-
t.foreign_key :stop_points, :dependent => :delete, :name => 'jpsp_stoppoint_fkey'
|
77
|
-
end
|
78
|
-
change_table :lines do |t|
|
79
|
-
if @connection.foreign_keys(:lines).any?
|
80
|
-
@connection.foreign_keys(:lines).map do |f|
|
81
|
-
name = f.options[:name]
|
82
|
-
if (name == "line_company_fkey" || name == "line_ptnetwork_fkey" )
|
83
|
-
remove_foreign_key :lines, :name => name
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
t.foreign_key :companies, :dependent => :nullify, :name => 'line_company_fkey'
|
88
|
-
t.foreign_key :networks, :dependent => :nullify, :name => 'line_ptnetwork_fkey'
|
89
|
-
end
|
90
|
-
change_table :routes do |t|
|
91
|
-
if @connection.foreign_keys(:routes).any?
|
92
|
-
@connection.foreign_keys(:routes).map do |f|
|
93
|
-
name = f.options[:name]
|
94
|
-
if (name == "route_line_fkey" )
|
95
|
-
remove_foreign_key :routes, :name => name
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
t.foreign_key :lines, :dependent => :delete, :name => 'route_line_fkey'
|
100
|
-
end
|
101
|
-
change_table :routing_constraints_lines do |t|
|
102
|
-
if @connection.foreign_keys(:routing_constraints_lines).any?
|
103
|
-
@connection.foreign_keys(:routing_constraints_lines).map do |f|
|
104
|
-
name = f.options[:name]
|
105
|
-
if (name == "routingconstraint_line_fkey" || name == "routingconstraint_stoparea_fkey" )
|
106
|
-
remove_foreign_key :routing_constraints_lines, :name => name
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
t.foreign_key :lines, :dependent => :delete, :name => 'routingconstraint_line_fkey'
|
111
|
-
t.foreign_key :stop_areas, :dependent => :delete, :name => 'routingconstraint_stoparea_fkey'
|
112
|
-
end
|
113
|
-
change_table :stop_areas do |t|
|
114
|
-
if @connection.foreign_keys(:stop_areas).any?
|
115
|
-
@connection.foreign_keys(:stop_areas).map do |f|
|
116
|
-
name = f.options[:name]
|
117
|
-
if (name == "area_parent_fkey" )
|
118
|
-
remove_foreign_key :stop_areas, :name => name
|
119
|
-
end
|
120
|
-
end
|
121
|
-
end
|
122
|
-
t.foreign_key :stop_areas, :dependent => :nullify, :column => 'parent_id', :name => 'area_parent_fkey'
|
123
|
-
end
|
124
|
-
change_table :stop_areas_stop_areas do |t|
|
125
|
-
if @connection.foreign_keys(:stop_areas_stop_areas).any?
|
126
|
-
@connection.foreign_keys(:stop_areas_stop_areas).map do |f|
|
127
|
-
name = f.options[:name]
|
128
|
-
if (name == "stoparea_child_fkey" || name == "stoparea_parent_fkey" )
|
129
|
-
remove_foreign_key :stop_areas_stop_areas, :name => name
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
t.foreign_key :stop_areas, :dependent => :delete, :column => 'child_id', :name => 'stoparea_child_fkey'
|
134
|
-
t.foreign_key :stop_areas, :dependent => :delete, :column => 'parent_id', :name => 'stoparea_parent_fkey'
|
135
|
-
end
|
136
|
-
change_table :stop_points do |t|
|
137
|
-
if @connection.foreign_keys(:stop_points).any?
|
138
|
-
@connection.foreign_keys(:stop_points).map do |f|
|
139
|
-
name = f.options[:name]
|
140
|
-
if (name == "stoppoint_area_fkey" || name == "stoppoint_route_fkey" )
|
141
|
-
remove_foreign_key :stop_points, :name => name
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
145
|
-
t.foreign_key :stop_areas, :name => 'stoppoint_area_fkey'
|
146
|
-
t.foreign_key :routes, :dependent => :delete, :name => 'stoppoint_route_fkey'
|
147
|
-
end
|
148
|
-
change_table :time_table_dates do |t|
|
149
|
-
if @connection.foreign_keys(:time_table_dates).any?
|
150
|
-
@connection.foreign_keys(:time_table_dates).map do |f|
|
151
|
-
name = f.options[:name]
|
152
|
-
if (name == "tm_date_fkey" )
|
153
|
-
remove_foreign_key :time_table_dates, :name => name
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
t.foreign_key :time_tables, :dependent => :delete, :name => 'tm_date_fkey'
|
158
|
-
end
|
159
|
-
change_table :time_table_periods do |t|
|
160
|
-
if @connection.foreign_keys(:time_table_periods).any?
|
161
|
-
@connection.foreign_keys(:time_table_periods).map do |f|
|
162
|
-
name = f.options[:name]
|
163
|
-
if (name == "tm_period_fkey" )
|
164
|
-
remove_foreign_key :time_table_periods, :name => name
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
t.foreign_key :time_tables, :dependent => :delete, :name => 'tm_period_fkey'
|
169
|
-
end
|
170
|
-
change_table :time_tables_vehicle_journeys do |t|
|
171
|
-
if @connection.foreign_keys(:time_tables_vehicle_journeys).any?
|
172
|
-
@connection.foreign_keys(:time_tables_vehicle_journeys).map do |f|
|
173
|
-
name = f.options[:name]
|
174
|
-
if (name == "vjtm_tm_fkey" || name == "vjtm_vj_fkey" )
|
175
|
-
remove_foreign_key :time_tables_vehicle_journeys, :name => name
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
t.foreign_key :time_tables, :dependent => :delete, :name => 'vjtm_tm_fkey'
|
180
|
-
t.foreign_key :vehicle_journeys, :dependent => :delete, :name => 'vjtm_vj_fkey'
|
181
|
-
end
|
182
|
-
change_table :vehicle_journey_at_stops do |t|
|
183
|
-
if @connection.foreign_keys(:vehicle_journey_at_stops).any?
|
184
|
-
@connection.foreign_keys(:vehicle_journey_at_stops).map do |f|
|
185
|
-
name = f.options[:name]
|
186
|
-
if (name == "vjas_sp_fkey" || name == "vjas_vj_fkey" )
|
187
|
-
remove_foreign_key :vehicle_journey_at_stops, :name => name
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
t.foreign_key :stop_points, :dependent => :delete, :name => 'vjas_sp_fkey'
|
192
|
-
t.foreign_key :vehicle_journeys, :dependent => :delete, :name => 'vjas_vj_fkey'
|
193
|
-
end
|
194
|
-
change_table :vehicle_journeys do |t|
|
195
|
-
if @connection.foreign_keys(:vehicle_journeys).any?
|
196
|
-
@connection.foreign_keys(:vehicle_journeys).map do |f|
|
197
|
-
name = f.options[:name]
|
198
|
-
if (name == "vj_company_fkey" || name == "vj_jp_fkey" || name == "vj_route_fkey")
|
199
|
-
remove_foreign_key :vehicle_journeys, :name => name
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
|
-
t.foreign_key :companies, :dependent => :nullify, :name => 'vj_company_fkey'
|
204
|
-
t.foreign_key :journey_patterns, :dependent => :delete, :name => 'vj_jp_fkey'
|
205
|
-
t.foreign_key :routes, :dependent => :delete, :name => 'vj_route_fkey'
|
206
|
-
end
|
207
|
-
|
208
|
-
end
|
209
|
-
|
210
|
-
def down
|
211
|
-
change_table :access_links do |t|
|
212
|
-
t.remove_foreign_key :name => :aclk_acpt_fkey
|
213
|
-
t.remove_foreign_key :name => :aclk_area_fkey
|
214
|
-
end
|
215
|
-
change_table :access_points do |t|
|
216
|
-
t.remove_foreign_key :name => :access_area_fkey
|
217
|
-
end
|
218
|
-
change_table :connection_links do |t|
|
219
|
-
t.remove_foreign_key :name => :colk_endarea_fkey
|
220
|
-
t.remove_foreign_key :name => :colk_startarea_fkey
|
221
|
-
end
|
222
|
-
change_table :group_of_lines_lines do |t|
|
223
|
-
t.remove_foreign_key :name => :groupofline_group_fkey
|
224
|
-
t.remove_foreign_key :name => :groupofline_line_fkey
|
225
|
-
end
|
226
|
-
change_table :journey_patterns do |t|
|
227
|
-
t.remove_foreign_key :name => :arrival_point_fkey
|
228
|
-
t.remove_foreign_key :name => :departure_point_fkey
|
229
|
-
t.remove_foreign_key :name => :jp_route_fkey
|
230
|
-
end
|
231
|
-
change_table :journey_patterns_stop_points do |t|
|
232
|
-
t.remove_foreign_key :name => :jpsp_jp_fkey
|
233
|
-
t.remove_foreign_key :name => :jpsp_stoppoint_fkey
|
234
|
-
end
|
235
|
-
change_table :lines do |t|
|
236
|
-
t.remove_foreign_key :name => :line_company_fkey
|
237
|
-
t.remove_foreign_key :name => :line_ptnetwork_fkey
|
238
|
-
end
|
239
|
-
change_table :routes do |t|
|
240
|
-
t.remove_foreign_key :name => :route_line_fkey
|
241
|
-
end
|
242
|
-
change_table :routing_constraints_lines do |t|
|
243
|
-
t.remove_foreign_key :name => :routingconstraint_line_fkey
|
244
|
-
t.remove_foreign_key :name => :routingconstraint_stoparea_fkey
|
245
|
-
end
|
246
|
-
change_table :stop_areas do |t|
|
247
|
-
t.remove_foreign_key :name => :area_parent_fkey
|
248
|
-
end
|
249
|
-
change_table :stop_areas_stop_areas do |t|
|
250
|
-
t.remove_foreign_key :name => :stoparea_child_fkey
|
251
|
-
t.remove_foreign_key :name => :stoparea_parent_fkey
|
252
|
-
end
|
253
|
-
change_table :stop_points do |t|
|
254
|
-
t.remove_foreign_key :name => :stoppoint_area_fkey
|
255
|
-
t.remove_foreign_key :name => :stoppoint_route_fkey
|
256
|
-
end
|
257
|
-
change_table :time_table_dates do |t|
|
258
|
-
t.remove_foreign_key :name => :tm_date_fkey
|
259
|
-
end
|
260
|
-
change_table :time_table_periods do |t|
|
261
|
-
t.remove_foreign_key :name => :tm_period_fkey
|
262
|
-
end
|
263
|
-
change_table :time_tables_vehicle_journeys do |t|
|
264
|
-
t.remove_foreign_key :name => :vjtm_tm_fkey
|
265
|
-
t.remove_foreign_key :name => :vjtm_vj_fkey
|
266
|
-
end
|
267
|
-
change_table :vehicle_journey_at_stops do |t|
|
268
|
-
t.remove_foreign_key :name => :vjas_sp_fkey
|
269
|
-
t.remove_foreign_key :name => :vjas_vj_fkey
|
270
|
-
end
|
271
|
-
change_table :vehicle_journeys do |t|
|
272
|
-
t.remove_foreign_key :name => :vj_company_fkey
|
273
|
-
t.remove_foreign_key :name => :vj_jp_fkey
|
274
|
-
t.remove_foreign_key :name => :vj_route_fkey
|
275
|
-
end
|
276
|
-
end
|
277
|
-
end
|