snapctl 0.26.0__tar.gz → 0.29.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of snapctl might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snapctl
3
- Version: 0.26.0
3
+ Version: 0.29.1
4
4
  Summary: Snapser CLI Tool
5
5
  Author: Ajinkya Apte
6
6
  Author-email: aj@snapser.com
@@ -443,10 +443,14 @@ snapctl snapend download --help
443
443
  # snapend-manifest(yaml, json)
444
444
  # client-sdk(unity, unreal, roblox, godot, cocos, ios-objc, ios-swift, android-java, android-kotlin, web-ts, web-js),
445
445
  # server-sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
446
- # protos(go, csharp, cpp, python)
446
+ # protos(go, csharp, cpp, raw)
447
+ # $protos-category = messages or services (only with --type protos)
448
+ # $auth-type = user or app (only with --type server-sdk)
447
449
  # Example:
448
450
  # snapctl snapend download gx5x6bc0 --category snapend-manifest --type yaml
449
451
  # snapctl snapend download gx5x6bc0 --category client-sdk --type unity
452
+ # snapctl snapend download gx5x6bc0 --category server-sdk --type unity --auth-type app
453
+ # snapctl snapend download gx5x6bc0 --category protos --type raw --protos-category messages
450
454
  snapctl snapend download $snapend_id --category $category --type $type
451
455
  ```
452
456
 
@@ -455,10 +459,10 @@ snapctl snapend download $snapend_id --category $category --type $type
455
459
  Clone a Snapend from an existing manifest. Passing the blocking flag ensures your CLI command waits till the new Snapend is up.
456
460
 
457
461
  ```
458
- # Help for the download command
462
+ # Help for the clone command
459
463
  snapctl snapend clone --help
460
464
 
461
- # Download your Snapend SDK and Protos
465
+ # Clone your Snapend
462
466
  # $gameId = Game Id
463
467
  # $snapendName = Name of your new Snapend
464
468
  # $env = One of development, staging
@@ -475,10 +479,10 @@ Apply changes to your Snapend from a manifest. You should have the latest manife
475
479
  a user stomping over someone elses changes. Passing the blocking flag ensures your CLI command waits till the update is complete.
476
480
 
477
481
  ```
478
- # Help for the download command
482
+ # Help for the apply command
479
483
  snapctl snapend apply --help
480
484
 
481
- # Download your Snapend SDK and Protos
485
+ # Apply changes to a snapend via manifest
482
486
  # $pathToManifest = Path to the manifest file; should include the file name
483
487
  # Example:
484
488
  # snapctl snapend apply --manifest-path "C:\Users\name\Downloads\snapser-ox1bcyim-manifest.json" --blocking
@@ -426,10 +426,14 @@ snapctl snapend download --help
426
426
  # snapend-manifest(yaml, json)
427
427
  # client-sdk(unity, unreal, roblox, godot, cocos, ios-objc, ios-swift, android-java, android-kotlin, web-ts, web-js),
428
428
  # server-sdk(csharp, cpp, lua, ts, go, python, kotlin, java, c, node, js, perl, php, closure, ruby, rust),
429
- # protos(go, csharp, cpp, python)
429
+ # protos(go, csharp, cpp, raw)
430
+ # $protos-category = messages or services (only with --type protos)
431
+ # $auth-type = user or app (only with --type server-sdk)
430
432
  # Example:
431
433
  # snapctl snapend download gx5x6bc0 --category snapend-manifest --type yaml
432
434
  # snapctl snapend download gx5x6bc0 --category client-sdk --type unity
435
+ # snapctl snapend download gx5x6bc0 --category server-sdk --type unity --auth-type app
436
+ # snapctl snapend download gx5x6bc0 --category protos --type raw --protos-category messages
433
437
  snapctl snapend download $snapend_id --category $category --type $type
434
438
  ```
435
439
 
@@ -438,10 +442,10 @@ snapctl snapend download $snapend_id --category $category --type $type
438
442
  Clone a Snapend from an existing manifest. Passing the blocking flag ensures your CLI command waits till the new Snapend is up.
439
443
 
440
444
  ```
441
- # Help for the download command
445
+ # Help for the clone command
442
446
  snapctl snapend clone --help
443
447
 
444
- # Download your Snapend SDK and Protos
448
+ # Clone your Snapend
445
449
  # $gameId = Game Id
446
450
  # $snapendName = Name of your new Snapend
447
451
  # $env = One of development, staging
@@ -458,10 +462,10 @@ Apply changes to your Snapend from a manifest. You should have the latest manife
458
462
  a user stomping over someone elses changes. Passing the blocking flag ensures your CLI command waits till the update is complete.
459
463
 
460
464
  ```
461
- # Help for the download command
465
+ # Help for the apply command
462
466
  snapctl snapend apply --help
463
467
 
464
- # Download your Snapend SDK and Protos
468
+ # Apply changes to a snapend via manifest
465
469
  # $pathToManifest = Path to the manifest file; should include the file name
466
470
  # Example:
467
471
  # snapctl snapend apply --manifest-path "C:\Users\name\Downloads\snapser-ox1bcyim-manifest.json" --blocking
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snapctl"
3
- version = "0.26.0"
3
+ version = "0.29.1"
4
4
  description = "Snapser CLI Tool"
5
5
  authors = ["Ajinkya Apte <aj@snapser.com>"]
6
6
  readme = "README.md"
@@ -161,16 +161,18 @@ class ByoGs:
161
161
  ) as progress:
162
162
  progress.add_task(
163
163
  description='Building your snap...', total=None)
164
+ docker_file_path = f"{self.path}/{self.dockerfile}"
164
165
  if platform == "win32":
165
166
  response = subprocess.run([
166
167
  # f"docker build --no-cache -t {tag} {path}"
167
- 'docker', 'build', '--platform', build_platform, '-t', image_tag, self.path
168
+ 'docker', 'build', '--platform', build_platform, '-t', image_tag,
169
+ '-f', docker_file_path, self.path
168
170
  ], shell=True, check=False)
169
171
  # stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
170
172
  else:
171
173
  response = subprocess.run([
172
174
  # f"docker build --no-cache -t {tag} {path}"
173
- f"docker build --platform {build_platform} -t {image_tag} {self.path}"
175
+ f"docker build --platform {build_platform} -t {image_tag} -f {docker_file_path} {self.path}"
174
176
  ], shell=True, check=False)
175
177
  # stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
176
178
  if response.returncode:
@@ -169,16 +169,18 @@ class ByoSnap:
169
169
  ) as progress:
170
170
  progress.add_task(
171
171
  description='Building your snap...', total=None)
172
+ docker_file_path = f"{self.path}/{self.dockerfile}"
172
173
  if platform == "win32":
173
174
  response = subprocess.run([
174
175
  # f"docker build --no-cache -t {tag} {path}"
175
- 'docker', 'build', '--platform', build_platform, '-t', image_tag, self.path
176
+ 'docker', 'build', '--platform', build_platform, '-t', image_tag,
177
+ '-f', docker_file_path, self.path
176
178
  ], shell=True, check=False)
177
179
  # stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
178
180
  else:
179
181
  response = subprocess.run([
180
182
  # f"docker build --no-cache -t {tag} {path}"
181
- f"docker build --platform {build_platform} -t {image_tag} {self.path}"
183
+ f"docker build --platform {build_platform} -t {image_tag} -f {docker_file_path} {self.path}"
182
184
  ], shell=True, check=False)
183
185
  # stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
184
186
  if response.returncode:
@@ -30,6 +30,7 @@ class Snapend:
30
30
  'client-sdk', 'server-sdk', 'protos', 'admin-settings', 'snapend-manifest'
31
31
  ]
32
32
  DOWNLOAD_TYPE_NOT_REQUIRED = ['admin-settings']
33
+ PROTOS_CATEGORY = ['messages', 'services']
33
34
  AUTH_TYPES = ['user', 'app']
34
35
  ENV_TYPES = ['DEVELOPMENT', 'STAGING']
35
36
  BLOCKING_CALL_SLEEP = 5
@@ -45,7 +46,7 @@ class Snapend:
45
46
  # Clone, Apply, Promote
46
47
  manifest_path: str | None,
47
48
  # Download
48
- category: str, platform_type: str, auth_type: str, snaps: str | None,
49
+ category: str, platform_type: str, protos_category: str, auth_type: str, snaps: str | None,
49
50
  # Clone, Apply, Promote, Download
50
51
  out_path: str | None,
51
52
  # Update
@@ -66,6 +67,7 @@ class Snapend:
66
67
  self.download_types: Union[
67
68
  dict[str, dict[str, str]], None
68
69
  ] = Snapend._make_download_type(category)
70
+ self.protos_category: str = protos_category
69
71
  self.auth_type: str = auth_type
70
72
  self.platform_type: str = platform_type
71
73
  self.out_path: str | None = out_path
@@ -179,14 +181,18 @@ class Snapend:
179
181
  f"download?category={self.category}"
180
182
  )
181
183
  if self.category not in Snapend.DOWNLOAD_TYPE_NOT_REQUIRED:
182
- url += (
183
- f"&type={self.download_types[self.platform_type]['type']}"
184
- f"&subtype={self.download_types[self.platform_type]['subtype']}"
185
- )
186
- url_auth_type: str = 'user'
187
- if self.category == 'server-sdk' and self.auth_type == 'app':
188
- url_auth_type = 'app'
189
- url += f"&auth_type={url_auth_type}"
184
+ url += f"&type={self.download_types[self.platform_type]['type']}"
185
+ # If Protos, add protos category
186
+ if self.category == 'protos':
187
+ url += f"&subtype={self.protos_category}"
188
+ # If client or server SDK, add sub type and auth type
189
+ if self.category in ['client-sdk', 'server-sdk']:
190
+ url += f"&subtype={self.download_types[self.platform_type]['subtype']}"
191
+ url_auth_type: str = 'user'
192
+ if self.category == 'server-sdk' and self.auth_type == 'app':
193
+ url_auth_type = 'app'
194
+ url += f"&auth_type={url_auth_type}"
195
+ # Customize snaps
190
196
  if self.snaps:
191
197
  url += f"&snaps={self.snaps}"
192
198
  res = requests.get(
@@ -200,6 +206,11 @@ class Snapend:
200
206
  f"snapser-{self.snapend_id}-"
201
207
  f"manifest.{self.download_types[self.platform_type]['type']}"
202
208
  )
209
+ elif self.category == 'protos':
210
+ fn = (
211
+ f"snapser-{self.snapend_id}-{self.category}"
212
+ f"-{self.platform_type}-{self.protos_category}.zip"
213
+ )
203
214
  else:
204
215
  fn = (
205
216
  f"snapser-{self.snapend_id}-{self.category}"
@@ -292,6 +303,13 @@ class Snapend:
292
303
  "Please enter a valid path to save your output file"
293
304
  )
294
305
  return response
306
+ # Check the Protos category
307
+ if self.category == 'protos' and self.protos_category not in Snapend.PROTOS_CATEGORY:
308
+ response['msg'] = (
309
+ "Invalid Protos category. Valid categories are "
310
+ f"{', '.join(Snapend.PROTOS_CATEGORY)}."
311
+ )
312
+ return response
295
313
  # Check the auth type
296
314
  if self.category == 'server-sdk' and self.auth_type not in Snapend.AUTH_TYPES:
297
315
  response['msg'] = (
@@ -2,7 +2,7 @@
2
2
  Constants used by snapctl
3
3
  """
4
4
  COMPANY_NAME = 'Snapser'
5
- VERSION = '0.26.0'
5
+ VERSION = '0.29.1'
6
6
  CONFIG_FILE_MAC = '~/.snapser/config'
7
7
  CONFIG_FILE_WIN = '%homepath%\\.snapser\\config'
8
8
 
@@ -120,10 +120,22 @@ SERVER_SDK_TYPES: dict[str, dict[str, str]] = {
120
120
  }
121
121
 
122
122
  PROTOS_TYPES: dict[str, dict[str, str]] = {
123
+ 'cpp': {
124
+ 'type': 'cpp',
125
+ 'subtype': '',
126
+ },
127
+ 'csharp': {
128
+ 'type': 'csharp',
129
+ 'subtype': '',
130
+ },
123
131
  'go': {
124
132
  'type': 'go',
125
133
  'subtype': '',
126
134
  },
135
+ 'raw': {
136
+ 'type': 'raw',
137
+ 'subtype': '',
138
+ },
127
139
  }
128
140
 
129
141
  SNAPEND_MANIFEST_TYPES: dict[str, dict[str, str]] = {
@@ -468,6 +468,13 @@ def snapend(
468
468
  ", ".join(SNAPEND_MANIFEST_TYPES.keys()) + ")"
469
469
  )
470
470
  ),
471
+ protos_category: str = typer.Option(
472
+ 'messages', "--protos-category",
473
+ help=(
474
+ "(optional: download) Only applicable for --category protos --protos-category"
475
+ "Protos-Category: (" + ", ".join(Snapend.PROTOS_CATEGORY) + ")"
476
+ )
477
+ ),
471
478
  auth_type: str = typer.Option(
472
479
  'user', "--auth-type",
473
480
  help=(
@@ -538,7 +545,7 @@ def snapend(
538
545
  # Apply, Clone
539
546
  manifest_path,
540
547
  # Download
541
- category, platform_type, auth_type, snaps,
548
+ category, platform_type, protos_category, auth_type, snaps,
542
549
  # Download, Apply and Clone
543
550
  out_path,
544
551
  # Update
File without changes
File without changes
File without changes