cardano-up 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/bin/cardano-up +3 -3
- data/lib/cardano-up/bins.rb +1 -1
- data/lib/cardano-up/err.rb +9 -2
- data/lib/cardano-up/launcher.rb +13 -0
- data/lib/cardano-up/utils.rb +16 -30
- data/lib/cardano-up/version.rb +1 -1
- data/lib/cardano-up.rb +0 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55536463a8a275a7a370bac31474072c837a1411e08455934aa23a9b9d18932
|
4
|
+
data.tar.gz: b884c70ea66053c81bb91c3eefdef6447bd855e5a91595f0d7cf6ea0d5216b23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84a039aeab642b1e9eb5adcc30ebf1eccc8af53edbf6aebb28025ade0a69a858c9f8f8f7cb66ea4c84f1ff547065c19682347e7e4e5eef1039f47dfec70d14c4
|
7
|
+
data.tar.gz: 948ba5bad9619f2aaacad6c0cc6a9c1e5f114b8aa3eb1ea40c47141922b6d373eba19be5e8ff586db6f770296ab6cb868efa09773c82523b9fa61b6823e22b34
|
data/README.md
CHANGED
@@ -23,7 +23,19 @@ This Ruby gem provides easy way for:
|
|
23
23
|
|
24
24
|
## Installation
|
25
25
|
|
26
|
+
#### Rubygem:
|
27
|
+
|
26
28
|
$ gem install cardano-up
|
29
|
+
$ cardano-up --help
|
30
|
+
|
31
|
+
#### Nix:
|
32
|
+
|
33
|
+
$ nix develop github:piotr-iohk/cardano-up?dir=nix
|
34
|
+
$ cardano-up --help
|
35
|
+
|
36
|
+
or run directly
|
37
|
+
|
38
|
+
$ nix run github:piotr-iohk/cardano-up?dir=nix -- --help
|
27
39
|
|
28
40
|
## Usage
|
29
41
|
|
@@ -52,7 +64,7 @@ By default cardano-up keeps all files at `$HOME/.cardano-up/` however this can b
|
|
52
64
|
|
53
65
|
**Configurations** for the networks are downloaded from [Cardano Book](https://book.world.dev.cardano.org/environments.html).
|
54
66
|
|
55
|
-
**Binaries** come from [cardano-wallet](https://github.com/input-output-hk/cardano-wallet) which actually provides `cardano-node`, `cardano-cli`, `cardano-wallet`, `cardano-addresses` and `bech32` tools in each of its release bundles. This ensures that all components are compatible and work smoothly together. You can get any public release of the cardano-wallet bundle
|
67
|
+
**Binaries** come from [cardano-wallet](https://github.com/input-output-hk/cardano-wallet) which actually provides `cardano-node`, `cardano-cli`, `cardano-wallet`, `cardano-addresses` and `bech32` tools in each of its release bundles. This ensures that all components are compatible and work smoothly together. You can get any public release of the cardano-wallet bundle.
|
56
68
|
|
57
69
|
**Starting** `cardano-node` and `cardano-wallet`, cardano-up attempts to launch separate [`screen`](https://www.gnu.org/software/screen/) sessions for wallet and node respectively. If screen is not present on your system you can install it using package manager, e.g.:
|
58
70
|
|
data/bin/cardano-up
CHANGED
@@ -21,7 +21,7 @@ doc = <<~DOCOPT
|
|
21
21
|
|
22
22
|
Options:
|
23
23
|
install Install cardano-node, cardano-cli, cardano-wallet, cardano-addresses and bech32.
|
24
|
-
<release> latest | release tag
|
24
|
+
<release> latest | release tag [default: latest]
|
25
25
|
get-configs Get configs for particular Cardano environment.
|
26
26
|
<env> mainnet | preview | preprod etc.
|
27
27
|
up Start particular service. If any configs are missing #{File.basename(__FILE__)}
|
@@ -261,7 +261,7 @@ Stop mainnet node and wallet:
|
|
261
261
|
$stderr.puts
|
262
262
|
warn "Congratulations! You've just started cardano-node and cardano-wallet!"
|
263
263
|
end
|
264
|
-
rescue CardanoUp::EnvNotSupportedError => e
|
264
|
+
rescue CardanoUp::EnvNotSupportedError, CardanoUp::NoScreenError => e
|
265
265
|
warn "⚠️ #{e}"
|
266
266
|
exit 1
|
267
267
|
rescue CardanoUp::SessionHasNodeError => e
|
@@ -307,7 +307,7 @@ Stop mainnet node and wallet:
|
|
307
307
|
end
|
308
308
|
warn 'Wallet stopped.'
|
309
309
|
end
|
310
|
-
rescue CardanoUp::EnvNotSupportedError, CardanoUp::SessionNotExistsError => e
|
310
|
+
rescue CardanoUp::EnvNotSupportedError, CardanoUp::SessionNotExistsError, CardanoUp::NoScreenError => e
|
311
311
|
warn "⚠️ #{e}"
|
312
312
|
exit 1
|
313
313
|
end
|
data/lib/cardano-up/bins.rb
CHANGED
@@ -4,7 +4,7 @@ module CardanoUp
|
|
4
4
|
# Installing binaries for Cardano
|
5
5
|
module Bins
|
6
6
|
# Get cardano-wallet bundle binaries to your computer.
|
7
|
-
# @param release [String] - 'latest' | /^v20.{2}-.{2}-.{2}/
|
7
|
+
# @param release [String] - 'latest' | /^v20.{2}-.{2}-.{2}/
|
8
8
|
# @raise CardanoUp::VersionNotSupportedError
|
9
9
|
def self.install(release)
|
10
10
|
CardanoUp.configure_default unless CardanoUp.configured?
|
data/lib/cardano-up/err.rb
CHANGED
@@ -67,8 +67,15 @@ module CardanoUp
|
|
67
67
|
# Thrown when version of bundle to download is not supported
|
68
68
|
class VersionNotSupportedError < StandardError
|
69
69
|
def initialize(ver)
|
70
|
-
super(["Not supported version: #{ver}. Supported are: 'latest'
|
71
|
-
"tag (e.g. 'v2022-08-16')
|
70
|
+
super(["Not supported version: #{ver}. Supported are: 'latest' or",
|
71
|
+
"tag (e.g. 'v2022-08-16')"].join(' '))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Thrown when there is no screen on the system
|
76
|
+
class NoScreenError < StandardError
|
77
|
+
def initialize
|
78
|
+
super('There is no screen tool on the system!')
|
72
79
|
end
|
73
80
|
end
|
74
81
|
end
|
data/lib/cardano-up/launcher.rb
CHANGED
@@ -73,6 +73,7 @@ module CardanoUp
|
|
73
73
|
# @param configuration [Hash] output of setup
|
74
74
|
# @raise CardanoUp::SessionHasNodeError
|
75
75
|
# @raise CardanoUp::SessionHasWalletError
|
76
|
+
# @raise CardanoUp::NoScreenError
|
76
77
|
def self.node_up(configuration)
|
77
78
|
env = configuration[:env]
|
78
79
|
bin_dir = configuration[:bin_dir]
|
@@ -82,6 +83,8 @@ module CardanoUp
|
|
82
83
|
node_socket = configuration[:node_socket]
|
83
84
|
session_name = configuration[:session_name]
|
84
85
|
|
86
|
+
raise CardanoUp::NoScreenError if !CardanoUp::Utils.win? && !CardanoUp::Utils.screen?
|
87
|
+
|
85
88
|
exe = CardanoUp::Utils.win? ? '.exe' : ''
|
86
89
|
cardano_node = "#{File.join(bin_dir, 'cardano-node')}#{exe}"
|
87
90
|
version = CardanoUp::Utils.cmd "#{cardano_node} version"
|
@@ -146,11 +149,15 @@ module CardanoUp
|
|
146
149
|
end
|
147
150
|
|
148
151
|
# @param configuration [Hash] output of setup
|
152
|
+
# @raise CardanoUp::NoScreenError
|
153
|
+
# @raise CardanoUp::WalletPortUsedError
|
149
154
|
def self.wallet_up(configuration)
|
150
155
|
if CardanoUp::Utils.port_used?(configuration[:wallet_port].to_i)
|
151
156
|
raise CardanoUp::WalletPortUsedError, configuration[:wallet_port]
|
152
157
|
end
|
153
158
|
|
159
|
+
raise CardanoUp::NoScreenError if !CardanoUp::Utils.win? && !CardanoUp::Utils.screen?
|
160
|
+
|
154
161
|
env = configuration[:env]
|
155
162
|
wallet_port = configuration[:wallet_port]
|
156
163
|
token_metadata_server = configuration[:token_metadata_server]
|
@@ -211,9 +218,12 @@ module CardanoUp
|
|
211
218
|
end
|
212
219
|
|
213
220
|
# @raise CardanoUp::EnvNotSupportedError
|
221
|
+
# @raise CardanoUp::NoScreenError
|
214
222
|
def self.node_down(env, session_name = '0')
|
215
223
|
raise CardanoUp::EnvNotSupportedError, env unless CardanoUp::ENVS.include? env
|
216
224
|
|
225
|
+
raise CardanoUp::NoScreenError if !CardanoUp::Utils.win? && !CardanoUp::Utils.screen?
|
226
|
+
|
217
227
|
if CardanoUp::Utils.win?
|
218
228
|
CardanoUp::Utils.cmd "nssm stop cardano-node-#{env}-#{session_name}"
|
219
229
|
CardanoUp::Utils.cmd "nssm remove cardano-node-#{env}-#{session_name} confirm"
|
@@ -225,9 +235,12 @@ module CardanoUp
|
|
225
235
|
end
|
226
236
|
|
227
237
|
# @raise CardanoUp::EnvNotSupportedError
|
238
|
+
# @raise CardanoUp::NoScreenError
|
228
239
|
def self.wallet_down(env, session_name = '0')
|
229
240
|
raise CardanoUp::EnvNotSupportedError, env unless CardanoUp::ENVS.include? env
|
230
241
|
|
242
|
+
raise CardanoUp::NoScreenError if !CardanoUp::Utils.win? && !CardanoUp::Utils.screen?
|
243
|
+
|
231
244
|
if CardanoUp::Utils.win?
|
232
245
|
CardanoUp::Utils.cmd "nssm stop cardano-wallet-#{env}-#{session_name}"
|
233
246
|
CardanoUp::Utils.cmd "nssm remove cardano-wallet-#{env}-#{session_name} confirm"
|
data/lib/cardano-up/utils.rb
CHANGED
@@ -11,6 +11,11 @@ module CardanoUp
|
|
11
11
|
res.gsub("\n", ' ').strip
|
12
12
|
end
|
13
13
|
|
14
|
+
# Check if screen command is available
|
15
|
+
def self.screen?
|
16
|
+
cmd('which screen').chomp.length.positive?
|
17
|
+
end
|
18
|
+
|
14
19
|
def self.wget(url, file = nil)
|
15
20
|
file ||= File.basename(url)
|
16
21
|
resp = HTTParty.get(url)
|
@@ -61,40 +66,21 @@ module CardanoUp
|
|
61
66
|
|
62
67
|
##
|
63
68
|
# Latest binary url for latest release or particular tag, from master or pr num.
|
64
|
-
# @param release [String] - 'latest' | /^v20.{2}-.{2}-.{2}/
|
69
|
+
# @param release [String] - 'latest' | /^v20.{2}-.{2}-.{2}/
|
65
70
|
# @raise CardanoUp::VersionNotSupportedError
|
66
71
|
def self.get_binary_url(release = 'latest')
|
67
|
-
|
68
|
-
|
72
|
+
raise CardanoUp::VersionNotSupportedError, release unless release == 'latest' || release =~ /^v20.{2}-.{2}-.{2}/
|
73
|
+
|
74
|
+
tag = release == 'latest' ? latest_tag : release
|
75
|
+
if linux?
|
76
|
+
file = "cardano-wallet-#{tag}-linux64.tar.gz"
|
77
|
+
elsif mac?
|
78
|
+
file = "cardano-wallet-#{tag}-macos-intel.tar.gz"
|
79
|
+
elsif win?
|
80
|
+
file = "cardano-wallet-#{tag}-win64.zip"
|
69
81
|
end
|
70
82
|
|
71
|
-
|
72
|
-
if release == 'latest' || release =~ /^v20.{2}-.{2}-.{2}/
|
73
|
-
tag = release == 'latest' ? latest_tag : release
|
74
|
-
if linux?
|
75
|
-
file = "cardano-wallet-#{tag}-linux64.tar.gz"
|
76
|
-
elsif mac?
|
77
|
-
file = "cardano-wallet-#{tag}-macos-intel.tar.gz"
|
78
|
-
elsif win?
|
79
|
-
file = "cardano-wallet-#{tag}-win64.zip"
|
80
|
-
end
|
81
|
-
url = "#{CardanoUp::BINS_BASE_URL}/releases/download/#{tag}/#{file}"
|
82
|
-
else
|
83
|
-
if linux?
|
84
|
-
os = 'linux.musl.cardano-wallet-linux64'
|
85
|
-
elsif mac?
|
86
|
-
os = 'macos.intel.cardano-wallet-macos-intel'
|
87
|
-
elsif win?
|
88
|
-
os = 'linux.windows.cardano-wallet-win64'
|
89
|
-
end
|
90
|
-
|
91
|
-
url = if release == 'master'
|
92
|
-
"#{CardanoUp::HYDRA_BASE_URL}/#{os}/latest/download-by-type/file/binary-dist"
|
93
|
-
else
|
94
|
-
"#{CardanoUp::HYDRA_BASE_URL}-pr-#{release}/#{os}/latest/download-by-type/file/binary-dist"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
url
|
83
|
+
"#{CardanoUp::BINS_BASE_URL}/releases/download/#{tag}/#{file}"
|
98
84
|
end
|
99
85
|
|
100
86
|
##
|
data/lib/cardano-up/version.rb
CHANGED
data/lib/cardano-up.rb
CHANGED
@@ -27,7 +27,6 @@ require 'cardano-up/tail'
|
|
27
27
|
module CardanoUp
|
28
28
|
CONFIGS_BASE_URL = 'https://book.world.dev.cardano.org/environments'
|
29
29
|
BINS_BASE_URL = 'https://github.com/input-output-hk/cardano-wallet'
|
30
|
-
HYDRA_BASE_URL = 'https://hydra.iohk.io/job/Cardano/cardano-wallet'
|
31
30
|
ENVS = %w[mainnet preview preprod shelley-qa
|
32
31
|
staging vasil-qa vasil-dev mixed testnet].freeze
|
33
32
|
CONFIG_FILES = ['alonzo-genesis.json', 'byron-genesis.json', 'shelley-genesis.json',
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cardano-up
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Stachyra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.21.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.21.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubyzip
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.46'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '1.
|
110
|
+
version: '1.46'
|
111
111
|
description: |-
|
112
112
|
Cardano Up lets you get all essential Cardano
|
113
113
|
tools on your system: cardano-node, cardano-cli, cardano-wallet,
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
- !ruby/object:Gem::Version
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
|
-
rubygems_version: 3.
|
165
|
+
rubygems_version: 3.3.7
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: Lightweight manager for Cardano binaries and configs.
|