Skip to content

Commit fe4c044

Browse files
authoredMar 16, 2024
Fix: make GYB setup executable and GYB on path (#14)
2 parents 46c6370 + 51fb62c commit fe4c044

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed
 

‎.devcontainer/postAttach.sh

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
set -eu
33

44
pre-commit install --install-hooks
5+
6+
echo -e "\nexport PATH=$PATH:/home/compiler/admin/.config/gyb" >> ~/.bashrc

‎compiler_admin/commands/init.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def init(args: Namespace) -> int:
2828
See https://github.com/taers232c/GAMADV-XTD3/wiki/How-to-Install-Advanced-GAM
2929
3030
Args:
31-
admin_user (str): The Compiler admin with which to initialize a new project.
31+
username (str): The Compiler admin with which to initialize a new project.
3232
3333
gam (bool): If True, initialize a new GAM project.
3434
@@ -37,10 +37,10 @@ def init(args: Namespace) -> int:
3737
Returns:
3838
A value indicating if the operation succeeded or failed.
3939
"""
40-
if not hasattr(args, "admin_user"):
41-
raise ValueError("admin_user is required")
40+
if not hasattr(args, "username"):
41+
raise ValueError("username is required")
4242

43-
admin_user = args.admin_user
43+
admin_user = args.username
4444
res = RESULT_SUCCESS
4545

4646
if getattr(args, "gam", False):
@@ -58,6 +58,8 @@ def init(args: Namespace) -> int:
5858
with gyb.open("w+") as dest:
5959
res += subprocess.call(("curl", "-s", "-S", "-L", "https://gyb-shortn.jaylee.us/gyb-install"), stdout=dest)
6060

61+
res += subprocess.call(("chmod", "+x", str(gyb.absolute())))
62+
6163
# install, giving values to some options
6264
# https://github.com/GAM-team/got-your-back/blob/main/install-gyb.sh
6365
#

‎tests/commands/test_init.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ def test_clean_config_dir(mocker, mock_GAM_CONFIG_PATH, mock_rmtree):
5555
def test_init_admin_user_required():
5656
args = Namespace()
5757

58-
with pytest.raises(ValueError, match="admin_user is required"):
58+
with pytest.raises(ValueError, match="username is required"):
5959
init(args)
6060

6161

6262
def test_init_default(mock_clean_config_dir, mock_google_CallGAMCommand, mock_subprocess_call):
63-
args = Namespace(admin_user="username")
63+
args = Namespace(username="username")
6464
init(args)
6565

6666
assert mock_clean_config_dir.call_count == 0
@@ -69,7 +69,7 @@ def test_init_default(mock_clean_config_dir, mock_google_CallGAMCommand, mock_su
6969

7070

7171
def test_init_gam(mock_GAM_CONFIG_PATH, mock_clean_config_dir, mock_google_CallGAMCommand):
72-
args = Namespace(admin_user="username", gam=True, gyb=False)
72+
args = Namespace(username="username", gam=True, gyb=False)
7373
init(args)
7474

7575
mock_clean_config_dir.assert_called_once()
@@ -78,7 +78,7 @@ def test_init_gam(mock_GAM_CONFIG_PATH, mock_clean_config_dir, mock_google_CallG
7878

7979

8080
def test_init_gyb(mock_GYB_CONFIG_PATH, mock_clean_config_dir, mock_subprocess_call):
81-
args = Namespace(admin_user="username", gam=False, gyb=True)
81+
args = Namespace(username="username", gam=False, gyb=True)
8282
init(args)
8383

8484
mock_clean_config_dir.assert_called_once()

0 commit comments

Comments
 (0)