Browse Source

add "shut mono update" command

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
e9dec552d6
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
2 changed files with 47 additions and 0 deletions
  1. + 1
    - 0
      src/shut/commands/mono/__init__.py
  2. + 46
    - 0
      src/shut/commands/mono/update.py

+ 1
- 0
src/shut/commands/mono/__init__.py

@ -33,3 +33,4 @@ def mono():
from . import checks
from . import new
from . import status
from . import update

+ 46
- 0
src/shut/commands/mono/update.py

@ -0,0 +1,46 @@
# -*- coding: utf8 -*-
# Copyright (c) 2020 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
import click
from shut.commands import project
from shut.commands.commons.new import write_files
from shut.model import MonorepoModel
from shut.update import get_files
from . import mono
@mono.command()
@click.option('--dry', is_flag=True)
@click.option('-a', '--all', 'all_', is_flag=True, help='Also update any packages in the monorepo.')
def update(all_, dry):
"""
Update files auto-generated from the configuration file.
"""
monorepo = project.load_or_exit(expect=MonorepoModel)
files = get_files(monorepo)
write_files(files, monorepo.get_directory(), force=True, dry=dry)
if all_:
for package in project.packages:
files = get_files(package)
write_files(files, package.get_directory(), force=True, dry=dry)

Loading…
Cancel
Save