Skip to content

Commit 3a282c7

Browse files
author
Jordan Mance
committed
Adding default figgy.json paths
1 parent 03682f7 commit 3a282c7

File tree

8 files changed

+22
-16
lines changed

8 files changed

+22
-16
lines changed

cli/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Figgy Changelog:
22

3+
## 0.0.33
4+
- Adding a set of default places to search for the figgy.json file to reduce keystrokes.
5+
36
## 0.0.32
47
- Testing release pipeline through pypi, brew, etc.
58

cli/figcli/commands/config/cleanup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
class Cleanup(ConfigCommand):
19-
_DEFAULT_PATH = './figgy.json'
2019
"""
2120
Detects orphaned ParameterStore names, replication configurations, and merge keys, then
2221
prompts the user to delete them. This is typically run after the `sync` command informs
@@ -32,7 +31,7 @@ def __init__(self, ssm: SsmDao, ddb: ConfigDao, context: ConfigContext,
3231
self._utils = Utils(colors_enabled)
3332
self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} --env dev " \
3433
f"--config /path/to/figgy.json{self.c.rs}"
35-
self._config_path = context.ci_config_path if context.ci_config_path else Cleanup._DEFAULT_PATH
34+
self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json()
3635

3736
# If user passes in --info flag, we don't need all of this to be initialized.
3837
if not hasattr(args, Utils.get_first(info)) or args.info is False:

cli/figcli/commands/config/generate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313

1414

1515
class Generate(ConfigCommand):
16-
_DEFAULT_PATH = './figgy.json'
1716

1817
def __init__(self, colors_enabled: bool, config_context: ConfigContext):
1918
super().__init__(generate, colors_enabled, config_context)
20-
self._from_path = config_context.from_path if config_context.from_path else Generate._DEFAULT_PATH
19+
self._from_path = config_context.ci_config_path if config_context.ci_config_path else Utils.find_figgy_json()
2120
self._utils = Utils(colors_enabled)
2221
self._errors_detected = False
2322
self.example = f"{self.c.fg_bl}{CLI_NAME} config {self.command_printable} " \

cli/figcli/commands/config/sync.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818

1919

2020
class Sync(ConfigCommand):
21-
_DEFAULT_PATH = './figgy.json'
2221

2322
def __init__(self, ssm_init: SsmDao, config_init: ConfigDao, colors_enabled: bool,
2423
context: ConfigContext, get: Get, put: Put):
2524
super().__init__(sync, colors_enabled, context)
2625
self._config = config_init
2726
self._ssm = ssm_init
28-
self._config_path = context.ci_config_path if context.ci_config_path else Sync._DEFAULT_PATH
27+
self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json()
2928
self._utils = Utils(colors_enabled)
3029
self._replication_only = context.replication_only
3130
self._errors_detected = False

cli/figcli/commands/config/validate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111

1212
class Validate(ConfigCommand):
13-
_DEFAULT_PATH = './figgy.json'
1413

1514
def __init__(self, ssm_init: SsmDao, colors_enabled: bool, context: ConfigContext):
1615
super().__init__(validate, colors_enabled, context)
1716
self._ssm = ssm_init
18-
self._config_path = context.ci_config_path if context.ci_config_path else Validate._DEFAULT_PATH
17+
self._config_path = context.ci_config_path if context.ci_config_path else Utils.find_figgy_json()
1918
self._utils = Utils(colors_enabled)
2019
self._replication_only = context.replication_only
2120
self._errors_detected = False

cli/figcli/config/constants.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from pathlib import Path
22

3-
VERSION = '0.0.32'
3+
VERSION = '0.0.33'
44
CLI_NAME = 'figgy'
55
PROJECT_NAME = 'figgy'
66

@@ -147,4 +147,7 @@
147147

148148
# This is only used for temporary sandbox sessions. This reduces user friction when experimenting by not having to interact
149149
# with authenticating their OS Keychain.
150-
DEFAULT_ENCRYPTION_KEY = 'wX1C0nK1glfzaWQU8SKukdS7XZgYlAMW5ueb_V3cfSE='
150+
DEFAULT_ENCRYPTION_KEY = 'wX1C0nK1glfzaWQU8SKukdS7XZgYlAMW5ueb_V3cfSE='
151+
152+
# Default paths to search for figgy.json in
153+
DEFAULT_FIGGY_JSON_PATHS = ['figgy.json', 'figgy/figgy.json', 'config/figgy.json', '_figgy/figgy.json', '.figgy/figgy.json']

cli/figcli/utils/utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ def is_mac():
9090
def is_windows():
9191
return platform.system() == WINDOWS
9292

93+
@staticmethod
94+
def find_figgy_json():
95+
for path in DEFAULT_FIGGY_JSON_PATHS:
96+
if Path(path).is_file():
97+
return path
98+
99+
return 'figgy.json'
100+
93101
@staticmethod
94102
def file_exists(path: str):
95103
return Path(path).is_file()

cli/scripts/release.sh

100644100755
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/bash
22

3-
. scripts/utils.sh
4-
5-
version=$1
6-
7-
[[ -z "$version" ]] && die "Required parameter [version] is missing." || success "Creating release tag for version: $version"
8-
3+
SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
4+
version=$(cat "$SCRIPTPATH/../figcli/config/constants.py"| grep -E "VERSION\s+=\s+" | grep -v "AUDIT" | sed -E "s#.*([0-9]+.[0-9]+.[0-9]+[a-zA-Z]?).*#\1#g")
95

106
git tag -fa "v$version" -m "Tagging commit" && git push origin --tags

0 commit comments

Comments
 (0)