-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
25 lines (20 loc) · 891 Bytes
/
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
$LOAD_PATH.unshift File.expand_path('lib')
ENV['RAKE'] = "true"
desc 'Updates and generates the YAML file with the IBAN specs'
task :update_iban_specs => [:update_iban_registry, :generate_iban_specs]
desc 'Updates the dev/IBAN_Registry.txt file from the internet'
task :update_iban_registry do
require 'open-uri'
File.write('dev/IBAN_Registry.txt', open('http://www.swift.com/dsp/resources/documents/IBAN_Registry.txt', &:read))
end
desc 'Generates the YAML file with the IBAN specs from the local dev/IBAN_Registry.txt'
task :generate_iban_specs do
require 'iso/iban/specification'
require 'yaml'
specs = ISO::IBAN::Specification.parse_file('dev/IBAN_Registry.txt')
File.write('data/iso-iban/specs.yaml', Hash[specs.map { |spec| [spec.a2_country_code, spec.to_a] }].to_yaml)
end
desc 'run the tests'
task :test do
require File.expand_path("../test/runner", __FILE__)
end