Sha256: 542766365c628646c7f5f11b6e45709ec54b0e9d45f43ab125d59dcca43339d3
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require 'byebug' require 'yaml' require "bundler/gem_tasks" require "rspec/core/rake_task" require_relative "lib/currency_rate" RSpec::Core::RakeTask.new(:spec) task :default => :spec desc "Update rates for specified adapter" task :update_rates, [:exchange] do |t, args| api_keys = YAML.load_file("api_keys.yml") CurrencyRate.configure do |config| api_keys.each { |name, key| config.api_keys[name] = key } end adapter = CurrencyRate::const_get("#{args.exchange}Adapter").instance print "Loading data for #{args.exchange}... " exchange_data = adapter.exchange_data raw_storage = CurrencyRate::FileStorage.new(File.expand_path("spec/fixtures/adapters", __dir__)) raw_storage.write(args.exchange, exchange_data) puts "Success!" print "Normalizing data for #{args.exchange}..." normalized_data = adapter.normalize exchange_data normalized_storage = CurrencyRate::FileStorage.new(File.expand_path("spec/fixtures/adapters/normalized", __dir__)) normalized_storage.write(args.exchange, normalized_data) puts "Success!" puts "#{args.exchange} fixtures update finished!" end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
currency-rate-1.5.4 | Rakefile |
currency-rate-1.5.3 | Rakefile |
currency-rate-1.5.2 | Rakefile |
currency-rate-1.5.1 | Rakefile |