Skip to content

Commit

Permalink
deleted all flare related functionalities (#79)
Browse files Browse the repository at this point in the history
* deleted all flare related functionalities

* redid setup.cfg

---------

Co-authored-by: Christos <[email protected]>
  • Loading branch information
Grashalmbeisser and Grashalmbeisser authored Nov 21, 2023
1 parent 504bafb commit 2d650ef
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 417 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ ask viur-cli to install either vi or the scriptor into your project
```sh
$ viur build release
```
build all flare and npm apps and produce a release that can be deployed
build all npm apps and produce a release that can be deployed

```sh
$ viur build app [appname]
Expand All @@ -87,11 +87,10 @@ $ viur env
check the environment you are in right now, show versions of viur-cli, viur-core and vi etc.

```sh
$ viur project {add|remove|list|addFlare}
$ viur project {add|remove|list}
```
with this you can manage your project.json or generate a new one. You can add or remove targets to/from the
project.json, list what has been added to the project.json, add a flare application with `addFlare`
to be built when running `viur build release`.
project.json, list what has been added to the project.json, to be built when running `viur build release`.

```sh
$ viur update {requirements}
Expand Down Expand Up @@ -119,11 +118,10 @@ Commands:
In order to use the packaged tools, you can run:

```sh
$ viur tool {2to3|flare|pyodide|ssl-fix}
$ viur tool {2to3|pyodide|ssl-fix}
```
Scripts:
- `2to3` viur porting script
- `flare` flare build script
- `pyodide` run the get_pyodide command
- `ssl-fix` ssl fix for MacOS

Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package_dir =
packages = find:
python_requires = >=3.11
install_requires =
watchgod==0.8.2
app_server==0.9.6
python-minifier==2.9.0
click==8.1.7
Expand All @@ -36,5 +35,4 @@ where = src
console_scripts =
viur = viur_cli:cli
viur-2to3 = viur_cli.scripts.viur_2to3:main
flare = viur_cli.scripts.flare:main
get-pyodide = viur_cli.scripts.get_pyodide:main
11 changes: 3 additions & 8 deletions src/viur_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def cli(ctx):


@cli.command()
@click.argument("action", type=click.Choice(['add', 'remove', 'list', 'addFlare', 'scanNpm']))
@click.argument("action", type=click.Choice(['add', 'remove', 'list', 'scanNpm']))
def project(action):
"""
Manage project.json and generate if missing.
Expand All @@ -68,31 +68,26 @@ def project(action):
:param action: str
The action to perform on 'project.json' and project configuration. It can be one of the following:
- 'add': Add project information to 'project.json.'
- 'addFlare': Add project information to Flare configuration.
- 'add': Add project information to 'project.json.
- 'remove': Remove project information from 'project.json.'
- 'list': List project information.
Example Usage:
```shell
viur-cli project add
viur-cli project addFlare
viur-cli project remove
viur-cli project list
```
Note:
- When using the 'add' or 'addFlare' actions, you can provide additional information as needed.
- When using the 'add' actions, you can provide additional information as needed.
- The 'list' action displays project information in a formatted JSON format.
:return: None
"""
project_config = get_config()
if action == "add":
add_to_config()
elif action == "addFlare":
_projectconf = add_to_flare_config(project_config)
write_config(_projectconf)
elif action == "remove":
remove_from_config()
click.echo(click.style(json.dumps(project_config, indent=4, sort_keys=True), fg="cyan"))
Expand Down
64 changes: 0 additions & 64 deletions src/viur_cli/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,57 +136,6 @@ def remove_from_config():
except:
raise click.ClickException(click.style(f"{configname} not found", fg="red"))


def add_to_flare_config(projectconf):
"""
Add a new Flare app configuration to project.json.
This function is used to add a new Flare app configuration to the project.json file. It prompts for the app name,
source, and target.
:param projectconf: dict
The project configuration where the Flare app configuration will be added.
:return: dict
The updated project configuration with the new Flare app configuration.
"""
if "default" not in projectconf:
raise click.ClickException(click.style("default entry is missing", fg="red"))

if "builds" not in projectconf["default"]:
projectconf["default"].update({"builds": {}})

projectconf["default"]["builds"].update({
click.prompt('name'): {
"kind": "flare",
"source": click.prompt('source'),
"target": click.prompt('target')
}
})

return projectconf


def remove_from_flare_config(flareAppName):
"""
Remove a Flare app configuration from project.json.
This function allows the removal of an existing Flare app configuration from the project.json file.
It prompts for the Flare app name to remove.
:param flareAppName: str
The name of the Flare app to remove from the project configuration.
:return: None
"""
global projectConfig
try:
del projectConfig["default"]["builds"][flareAppName]
write_config(projectConfig)
except:
raise click.ClickException(click.style(f"{flareAppName} not found", fg="red"))


def fetch_core_version():
"""
Fetch the version of the 'viur-core' package.
Expand Down Expand Up @@ -239,19 +188,6 @@ def update_config(path=None):
if projectConfig["default"]["format"] == "1.0.0":
projectConfig["default"]["format"] = "1.0.1"

# Version 1.1.0

if "flare" in projectConfig["default"]:
builds = projectConfig["default"]["flare"].copy()
for k, v in builds.items():
builds[k]["kind"] = "flare"

projectConfig["default"]["builds"] = builds
del projectConfig["default"]["flare"]

if projectConfig["default"]["format"] == "1.0.1":
projectConfig["default"]["format"] = "1.1.0"

# Version 1.1.1

if projectConfig["default"]["format"] == "1.1.0":
Expand Down
Loading

0 comments on commit 2d650ef

Please sign in to comment.