aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/postcodes-norway.rake
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2015-02-02 18:59:12 +0100
committerHarald Eilertsen <haraldei@anduin.net>2015-02-02 18:59:53 +0100
commit9af117df2f9e26a151a24caf54b967f56c08d60a (patch)
treee70ed92ba61b64044339b8b4dd163b3eb30c36ce /lib/tasks/postcodes-norway.rake
parent743dadd3f7cfabd9d0dbaebff3b4f07d32c5f1ef (diff)
downloadpostcodes-norway-9af117df2f9e26a151a24caf54b967f56c08d60a.tar.gz
postcodes-norway-9af117df2f9e26a151a24caf54b967f56c08d60a.tar.bz2
postcodes-norway-9af117df2f9e26a151a24caf54b967f56c08d60a.zip
Rename files and prepare for release.v0.1.0
Diffstat (limited to 'lib/tasks/postcodes-norway.rake')
-rw-r--r--lib/tasks/postcodes-norway.rake13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/tasks/postcodes-norway.rake b/lib/tasks/postcodes-norway.rake
new file mode 100644
index 0000000..6ec53b7
--- /dev/null
+++ b/lib/tasks/postcodes-norway.rake
@@ -0,0 +1,13 @@
+require 'uri'
+require 'open-uri'
+
+namespace :postcodes do
+ desc "Fetch postcode database from Bring"
+ task :fetch, [:data_path] do |t, args|
+ args.with_defaults(:data_path => 'data')
+ uri = URI.parse('http://www.bring.no/hele-bring/forside/_attachment/159761')
+ filename = File.join(args.data_path, 'Postnummerregister_ansi.txt')
+ puts "Downloading postcodes to: #{filename}..."
+ IO.write(filename, uri.read)
+ end
+end