1 $LOAD_PATH << File.join(File.dirname(__FILE__),"..","lib")
2 require 'lib/i18n_data'#TODO should not be necessary but is :/
5 desc "Run all specs in spec directory"
7 options = "--colour --format progress --loadby --reverse"
8 files = FileList['spec/**/*_spec.rb']
9 system("spec #{options} #{files}")
12 desc "write all languages to output"
13 task :all_languages do
14 I18nData.languages.keys.each do |lc|
15 `rake languages LANGUAGE=#{lc}`
19 desc "write languages to output/languages_{language}"
21 raise unless language = ENV['LANGUAGE']
23 data = I18nData.languages(language.upcase)
24 File.open("output/languages_#{language.downcase}.yml",'w') {|f|f.puts data.to_yaml}
27 desc "write all countries to output"
28 task :all_countries do
29 I18nData.languages.keys.each do |lc|
30 `rake countries LANGUAGE=#{lc}`
34 desc "write countries to output/countries_{language}"
36 raise unless language = ENV['LANGUAGE']
38 data = I18nData.countries(language.upcase)
39 File.open("output/countries_#{language.downcase}.yml",'w') {|f|f.puts data.to_yaml}
42 desc "write example output, just to show off :D"
43 task :example_output do
44 `mkdir example_output -p`
46 #all names for germany, france, united kingdom and unites states
47 ['DE','FR','GB','US'].each do |cc|
48 names = I18nData.languages.keys.map do |lc|
50 [I18nData.countries(lc)[cc], I18nData.languages[lc]]
51 rescue I18nData::NoOnlineTranslationAvaiable
55 File.open("example_output/all_names_for_#{cc}.txt",'w') {|f|
56 f.puts names.reject(&:nil?).map{|x|x*" ---- "} * "\n"
61 desc "write cache for I18nData::FileDataProvider"
62 task :write_cache_for_file_data_provider do
63 require 'i18n_data/file_data_provider'
64 require 'i18n_data/live_data_provider'
65 I18nData::FileDataProvider.write_cache(I18nData::LiveDataProvider)
70 Jeweler::Tasks.new do |gem|
71 gem.name = "i18n_data"
72 gem.summary = "country/language names and 2-letter-code pairs, in 85 languages"
73 gem.email = "grosser.michael@gmail.com"
74 gem.homepage = "http://github.com/grosser/i18n_data"
75 gem.authors = ["Michael Grosser"]
76 gem.add_dependency ['activesupport']
77 gem.files += (FileList["{lib,spec,cache}/**/*"] + FileList["VERSION.yml"] + FileList["README.markdown"]).to_a.sort
80 puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"