Rakefile in brighter_planet_metadata-0.2.0 vs Rakefile in brighter_planet_metadata-0.2.1

- old
+ new

@@ -8,5 +8,23 @@ test.pattern = 'test/**/test_*.rb' test.verbose = true end task :default => :test + +task :fallbacks do + require_relative 'lib/brighter_planet_metadata' + fallbacks = BrighterPlanet::Metadata::LIVE_URL.inject({}) do |memo, (k, _)| + if BrighterPlanet.metadata.respond_to?(k) + memo[k] = BrighterPlanet.metadata.send k + else + parts = k.split('_') # rail_trips_options => rail, trips, options + method_id = parts.pop + arg = parts.join('_') + memo[k] = BrighterPlanet.metadata.send method_id, arg + end + memo + end + File.open(File.expand_path('../lib/brighter_planet_metadata/fallbacks.json', __FILE__), 'w') do |f| + f.write MultiJson.encode(fallbacks) + end +end