Skip to content

Commit

Permalink
Merge pull request #289 from rapyuta-robotics/devel
Browse files Browse the repository at this point in the history
🎉 release: v7.3.1
  • Loading branch information
pallabpain authored Mar 25, 2024
2 parents 281113a + c6a8116 commit 796f821
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 65 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Build Documentation
run: pipenv run python3 -m sphinx -M html docs/source docs/output

- name: Deploy gh-pages
if: github.repository == 'rapyuta-robotics/rapyuta-io-cli' && github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/output/html
cname: cli.rapyuta.io
force_orphan: true
# - name: Deploy gh-pages
# if: github.repository == 'rapyuta-robotics/rapyuta-io-cli' && github.event_name == 'push'
# uses: peaceiris/actions-gh-pages@v3
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/output/html
# cname: cli.rapyuta.io
# force_orphan: true
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ verify_ssl = true

[dev-packages]
pipenv-setup = "==3.1.1"
sphinx = "==4.2.0"
sphinx-click = "==3.0.1"
furo = "==2021.10.9"
sphinx = ">=5.0.0"
sphinx-click = ">=3.0.1"
furo = ">=2021.10.9"

[packages]
riocli = {path = "."}
Expand Down
87 changes: 46 additions & 41 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
autosummary_generate = True # Turn on sphinx.ext.autosummary
source_suffix = '.rst'
master_doc = 'index'
language = None
language = 'en'
exclude_patterns = []
todo_include_todos = False

Expand Down
7 changes: 3 additions & 4 deletions riocli/auth/login.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Rapyuta Robotics
# Copyright 2024 Rapyuta Robotics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
get_token,
select_organization,
select_project,
validate_token,
validate_and_set_token,
)
from riocli.constants import Colors, Symbols
from riocli.utils.context import get_root_context
Expand Down Expand Up @@ -66,9 +66,8 @@ def login(
ctx = get_root_context(ctx)

if auth_token:
if not validate_token(auth_token):
if not validate_and_set_token(ctx, auth_token):
raise SystemExit(1)
ctx.obj.data['auth_token'] = auth_token
else:
if interactive:
email = email or click.prompt('Email')
Expand Down
12 changes: 7 additions & 5 deletions riocli/auth/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Rapyuta Robotics
# Copyright 2024 Rapyuta Robotics
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -143,11 +143,10 @@ def get_token(


@with_spinner(text='Validating token...')
def validate_token(token: str, spinner=None) -> bool:
def validate_and_set_token(ctx: click.Context, token: str, spinner=None) -> bool:
"""Validates an auth token."""
config = Configuration()
if 'environment' in config.data:
os.environ['RIO_CONFIG'] = config.filepath
if 'environment' in ctx.obj.data:
os.environ['RIO_CONFIG'] = ctx.obj.filepath

client = Client(auth_token=token)

Expand All @@ -156,6 +155,9 @@ def validate_token(token: str, spinner=None) -> bool:
spinner.text = click.style(
'Token belongs to user {}'.format(user.email_id),
fg=Colors.CYAN)
# Save the token and user email_id in the context
ctx.obj.data['auth_token'] = token
ctx.obj.data['email_id'] = user.email_id
spinner.ok(Symbols.INFO)
return True
except UnauthorizedError:
Expand Down
7 changes: 4 additions & 3 deletions riocli/project/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from rapyuta_io import Client

from riocli.config import new_client, new_v2_client
from riocli.constants import Colors
from riocli.constants import Colors, Symbols
from riocli.exceptions import LoggedOut
from riocli.utils.selector import show_selection
from riocli.v2client import Client as v2Client
Expand Down Expand Up @@ -49,9 +49,10 @@ def decorated(**kwargs: typing.Any):

if guid is None:
try:
guid = find_project_guid(client, name)
organization = ctx.obj.data.get('organization_id')
guid = find_project_guid(client, name, organization)
except Exception as e:
click.secho(str(e), fg=Colors.RED)
click.secho('{} {}'.format(Symbols.ERROR, e), fg=Colors.RED)
raise SystemExit(1)

kwargs['project_name'] = name
Expand Down

0 comments on commit 796f821

Please sign in to comment.