Sha256: 36158f5774d2b896d3440b25dc33e20e02207f48cd5fbdb1ab65eb50c5fd9a11

Contents?: true

Size: 1018 Bytes

Versions: 9

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'httparty'
require_relative 'lib/cardano_wallet'

RSpec::Core::RakeTask.new(:spec)

task default: :spec

def wget(url, file = nil)
  file ||= File.basename(url)
  resp = HTTParty.get(url)
  File.binwrite(file, resp.body)
  puts "#{url} -> #{resp.code}"
end

def mk_dir(path)
  FileUtils.mkdir_p(path)
end

task :get_latest_configs, [:env] do |_, args|
  puts "\n  >> Get latest configs for '#{args[:env]}'"

  base_url = 'https://book.world.dev.cardano.org/environments'
  env = args[:env]
  path = File.join(Dir.pwd, 'configs')
  mk_dir(path)
  wget("#{base_url}/#{env}/config.json", "#{path}/config.json")
  wget("#{base_url}/#{env}/byron-genesis.json", "#{path}/byron-genesis.json")
  wget("#{base_url}/#{env}/alonzo-genesis.json", "#{path}/alonzo-genesis.json")
  wget("#{base_url}/#{env}/shelley-genesis.json", "#{path}/shelley-genesis.json")
  wget("#{base_url}/#{env}/topology.json", "#{path}/topology.json")
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cardano_wallet-0.4.2 Rakefile
cardano_wallet-0.4.1 Rakefile
cardano_wallet-0.4.0 Rakefile
cardano_wallet-0.3.28 Rakefile
cardano_wallet-0.3.27 Rakefile
cardano_wallet-0.3.26 Rakefile
cardano_wallet-0.3.25 Rakefile
cardano_wallet-0.3.24 Rakefile
cardano_wallet-0.3.23 Rakefile