Skip to content

Commit

Permalink
Merge pull request #22 from skalenetwork/develop
Browse files Browse the repository at this point in the history
Beta release 24/09/19
  • Loading branch information
dmytrotkk authored Sep 24, 2019
2 parents 460e81c + 31ff2f3 commit 7a42d45
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
20 changes: 13 additions & 7 deletions cli/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def convert(self, value, param, ctx):
param, ctx)
if not all([result.scheme, result.netloc]):
self.fail(f'Expected valid url. Got {value}', param, ctx)
return value


class IpType(click.ParamType):
Expand All @@ -60,6 +61,11 @@ def convert(self, value, param, ctx):
except ValueError:
self.fail(f'expected valid ipv4/ipv6 address. Got {value}',
param, ctx)
return value


URL_TYPE = UrlType()
IP_TYPE = IpType()


@click.group()
Expand Down Expand Up @@ -106,7 +112,7 @@ def node_about(format):
@click.option(
'--ip',
prompt="Enter node public IP",
type=IpType(),
type=IP_TYPE,
help='Public IP for RPC connections & consensus (required)'
)
@click.option(
Expand All @@ -126,7 +132,7 @@ def register_node(name, ip, port):
@click.option('--install-deps', is_flag=True)
@click.option( # todo: tmp option - after stable release branch
'--mta-endpoint',
type=UrlType(),
type=URL_TYPE,
# prompt="Enter Git branch to clone",
help='MTA endpoint to connect',
default=DEFAULT_MTA_ENDPOINT
Expand All @@ -153,15 +159,15 @@ def register_node(name, ip, port):
)
@click.option( # todo: tmp option - remove after mainnet deploy
'--endpoint',
type=UrlType(),
type=URL_TYPE,
# prompt="Enter Mainnet RPC port",
help='RPC endpoint of the node in the network '
'where SKALE manager is deployed',
default=DEFAULT_ENDPOINT
)
@click.option( # todo: tmp option - remove after mainnet deploy
'--rpc-ip',
type=IpType(),
type=IP_TYPE,
# prompt="Enter Mainnet RPC IP",
help='IP of the node in the network where SKALE manager is deployed',
default=DEFAULT_RPC_IP
Expand Down Expand Up @@ -247,7 +253,7 @@ def purge_node():
prompt='Are you sure you want to update SKALE node software?')
@click.option( # todo: tmp option - after stable release branch
'--mta-endpoint',
type=UrlType(),
type=URL_TYPE,
# prompt="Enter Git branch to clone",
help='MTA endpoint to connect',
default=DEFAULT_MTA_ENDPOINT
Expand All @@ -269,15 +275,15 @@ def purge_node():
)
@click.option( # todo: tmp option - remove after mainnet deploy
'--endpoint',
type=UrlType(),
type=URL_TYPE,
# prompt="Enter Mainnet RPC port",
help='RPC endpoint of the node in the network '
'where SKALE manager is deployed',
default=DEFAULT_ENDPOINT
)
@click.option( # todo: tmp option - remove after mainnet deploy
'--rpc-ip',
type=IpType(),
type=IP_TYPE,
# prompt="Enter Mainnet RPC IP",
help='IP of the node in the network where SKALE manager is deployed',
default=DEFAULT_RPC_IP
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def cli():
@click.option('--short', is_flag=True)
def version(short):
if short:
print(__version__)
print(VERSION)
else:
print(f'SKALE Node CLI version: {__version__}')
print(f'SKALE Node CLI version: {VERSION}')


@cli.command('info', help="Show SKALE node CLI info")
Expand Down
12 changes: 10 additions & 2 deletions scripts/calculate_version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/usr/bin/env bash
VERSION=$(python setup.py --version)
USAGE_MSG='Usage: BRANCH=[BRANCH] calculate_version.sh'

if [ -z "$BRANCH" ]
then
(>&2 echo 'You should provide branch')
echo $USAGE_MSG
exit 1
fi


if [ -z $VERSION ]; then
Expand All @@ -12,12 +20,12 @@ if [[ $BRANCH == 'stable' ]]; then
exit 1
fi

git fetch --tags
git fetch --tags > /dev/null

for (( NUMBER=0; ; NUMBER++ ))
do
FULL_VERSION="$VERSION-$BRANCH.$NUMBER"
if ! [ $(git tag -l ?$FULL_VERSION) ]; then
if ! [ $(git tag -l | grep $FULL_VERSION) ]; then
echo "$FULL_VERSION" | tr / -
break
fi
Expand Down

0 comments on commit 7a42d45

Please sign in to comment.