-
Notifications
You must be signed in to change notification settings - Fork 3
/
Rakefile
35 lines (28 loc) · 1018 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
26
27
28
29
30
31
32
33
34
35
# 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