-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1eadee5
commit f96b115
Showing
5 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
''' | ||
Runs rdmo-admin when the rdmo module is run as a script, much like django-admin | ||
(see: https://github.com/django/django/blob/main/django/__main__.py): | ||
python -m rdmo check | ||
The main method is added as script in pyproject.toml so that | ||
rdmo-admin check | ||
works as well. Unlike django-admin, a set of generic settings is used for the | ||
management scripts. | ||
''' | ||
|
||
import os | ||
|
||
from django.core import management | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "rdmo.core.management.settings") | ||
|
||
|
||
def main(): | ||
management.execute_from_command_line() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import subprocess | ||
import sys | ||
|
||
from django.core.management.base import BaseCommand | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
subprocess.call(['/bin/bash', '-c', f'{sys.executable} -m build']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
import subprocess | ||
|
||
from django.core.management.base import BaseCommand, CommandError | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument('command', nargs="*") | ||
|
||
def handle(self, *args, **options): | ||
nvm_dir = os.getenv('NVM_DIR') | ||
|
||
if nvm_dir is None: | ||
raise CommandError('NVM_DIR is not set, is nvm.sh installed?') | ||
|
||
if not os.path.exists(nvm_dir): | ||
raise CommandError('NVM_DIR does not exist, is nvm.sh installed?') | ||
|
||
command = ' '.join(options['command']) | ||
subprocess.call(['/bin/bash', '-c', f'source {nvm_dir}/nvm.sh; npm {command}']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
''' | ||
Generic settings to be used with rdmo-admin outside of an rdmo-app. | ||
''' | ||
|
||
from rdmo.core.settings import * # noqa: F403 | ||
|
||
ROOT_URLCONF = '' | ||
|
||
DATABASES = {} |