Module: CardanoUp
- Defined in:
- lib/cardano-up.rb,
lib/cardano-up/err.rb,
lib/cardano-up/tar.rb,
lib/cardano-up/tail.rb,
lib/cardano-up/start.rb,
lib/cardano-up/utils.rb,
lib/cardano-up/install.rb,
lib/cardano-up/version.rb
Overview
Version
Defined Under Namespace
Modules: Install, Start, Tail, Tar, Utils Classes: ConfigNotSetError, EnvNotSupportedError, VersionNotSupportedError, WalletPortError
Constant Summary collapse
- CONFIGS_BASE_URL =
'https://book.world.dev.cardano.org/environments'- BINS_BASE_URL =
'https://github.com/input-output-hk/cardano-wallet'- HYDRA_BASE_URL =
'https://hydra.iohk.io/job/Cardano/cardano-wallet'- ENVS =
%w[mainnet preview preprod shelley-qa staging vasil-qa vasil-dev mixed testnet].freeze
- CONFIG_FILES =
['alonzo-genesis.json', 'byron-genesis.json', 'shelley-genesis.json', 'config.json', 'topology.json'].freeze
- MAINNET_TOKEN_SERVER =
'https://tokens.cardano.org'- TESTNET_TOKEN_SERVER =
'https://metadata.cardano-testnet.iohkdev.io'
Class Method Summary collapse
- .base_dir ⇒ Object
- .base_dir=(value) ⇒ Object
- .cardano_up_config ⇒ Object
- .cardano_up_config=(value) ⇒ Object
-
.clean_config_dir(dir) ⇒ Object
dir [String] config dir.
-
.config ⇒ Object
Get config values.
-
.configure(bin_dir, state_dir, logs_dir, config_dir) ⇒ Object
Set custom config for CardanoUp.
-
.configure_default ⇒ Object
Set default config for CardanoUp.
-
.configured? ⇒ Boolean
Check if CardanoUp config exists.
-
.remove_cardano_up_config ⇒ Object
Remove configuration file.
Class Method Details
.base_dir ⇒ Object
40 41 42 |
# File 'lib/cardano-up.rb', line 40 def self.base_dir @base_dir end |
.base_dir=(value) ⇒ Object
44 45 46 47 48 |
# File 'lib/cardano-up.rb', line 44 def self.base_dir=(value) @base_dir = value @cardano_up_config = File.join(@base_dir, 'config.json') @base_dir end |
.cardano_up_config ⇒ Object
50 51 52 |
# File 'lib/cardano-up.rb', line 50 def self.cardano_up_config @cardano_up_config end |
.cardano_up_config=(value) ⇒ Object
54 55 56 |
# File 'lib/cardano-up.rb', line 54 def self.cardano_up_config=(value) @cardano_up_config = value end |
.clean_config_dir(dir) ⇒ Object
dir [String] config dir
103 104 105 |
# File 'lib/cardano-up.rb', line 103 def self.clean_config_dir(dir) FileUtils.rm_f(config[dir]) end |
.config ⇒ Object
Get config values
91 92 93 94 95 |
# File 'lib/cardano-up.rb', line 91 def self.config raise CardanoUp::ConfigNotSetError unless configured? JSON.parse(File.read(@cardano_up_config)) end |
.configure(bin_dir, state_dir, logs_dir, config_dir) ⇒ Object
Set custom config for CardanoUp
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cardano-up.rb', line 72 def self.configure(bin_dir, state_dir, logs_dir, config_dir) FileUtils.mkdir_p(@base_dir) c = if configured? CardanoUp.config else { 'bin_dir' => File.join(@base_dir, 'bins'), 'state_dir' => File.join(@base_dir, 'state'), 'log_dir' => File.join(@base_dir, 'state'), 'config_dir' => File.join(@base_dir, 'configs') } end c['bin_dir'] = bin_dir if bin_dir c['state_dir'] = state_dir if state_dir c['log_dir'] = logs_dir if logs_dir c['config_dir'] = config_dir if config_dir File.write(@cardano_up_config, JSON.pretty_generate(c)) JSON.parse(File.read(@cardano_up_config)) end |
.configure_default ⇒ Object
Set default config for CardanoUp
64 65 66 67 68 69 |
# File 'lib/cardano-up.rb', line 64 def self.configure_default configure(File.join(@base_dir, 'bins'), File.join(@base_dir, 'state'), File.join(@base_dir, 'logs'), File.join(@base_dir, 'configs')) end |
.configured? ⇒ Boolean
Check if CardanoUp config exists
59 60 61 |
# File 'lib/cardano-up.rb', line 59 def self.configured? File.exist?(@cardano_up_config) end |
.remove_cardano_up_config ⇒ Object
Remove configuration file
98 99 100 |
# File 'lib/cardano-up.rb', line 98 def self.remove_cardano_up_config FileUtils.rm_f(@cardano_up_config) end |