mantis-cli 14.2.0__tar.gz → 14.3.0__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.
Files changed (27) hide show
  1. {mantis-cli-14.2.0/mantis_cli.egg-info → mantis-cli-14.3.0}/PKG-INFO +1 -1
  2. mantis-cli-14.3.0/mantis/__init__.py +1 -0
  3. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/helpers.py +17 -7
  4. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/logic.py +1 -1
  5. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/managers.py +1 -1
  6. {mantis-cli-14.2.0 → mantis-cli-14.3.0/mantis_cli.egg-info}/PKG-INFO +1 -1
  7. mantis-cli-14.2.0/mantis/__init__.py +0 -1
  8. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/.gitignore +0 -0
  9. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/LICENSE +0 -0
  10. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/MANIFEST.in +0 -0
  11. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/README.md +0 -0
  12. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/TODO +0 -0
  13. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/__main__.py +0 -0
  14. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/command_line.py +0 -0
  15. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/crypto.py +0 -0
  16. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/environment.py +0 -0
  17. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/extensions/__init__.py +0 -0
  18. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/extensions/django.py +0 -0
  19. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/extensions/nginx.py +0 -0
  20. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis/extensions/postgres.py +0 -0
  21. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis_cli.egg-info/SOURCES.txt +0 -0
  22. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis_cli.egg-info/dependency_links.txt +0 -0
  23. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis_cli.egg-info/entry_points.txt +0 -0
  24. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis_cli.egg-info/requires.txt +0 -0
  25. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/mantis_cli.egg-info/top_level.txt +0 -0
  26. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/setup.cfg +0 -0
  27. {mantis-cli-14.2.0 → mantis-cli-14.3.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mantis-cli
3
- Version: 14.2.0
3
+ Version: 14.3.0
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -0,0 +1 @@
1
+ VERSION = '14.3.0'
@@ -83,35 +83,45 @@ def random_string(n=10):
83
83
  return ''.join(random.choice(chars) for _ in range(n))
84
84
 
85
85
 
86
- def find_config():
87
- DEFAULT_PATH = 'configs/mantis.json'
86
+ def find_config(environment_id=None):
88
87
  env_path = os.environ.get('MANTIS_CONFIG', None)
89
88
 
90
89
  if env_path and env_path != '':
91
90
  CLI.info(f'Mantis config defined by environment variable $MANTIS_CONFIG: {env_path}')
92
91
  return env_path
93
92
 
94
- CLI.warning('Environment variable $MANTIS_CONFIG not found. Looking for file mantis.json...')
93
+ CLI.info('Environment variable $MANTIS_CONFIG not found. Looking for file mantis.json...')
95
94
  paths = os.popen('find . -name mantis.json').read().strip().split('\n')
96
95
 
97
96
  # Remove empty strings
98
97
  paths = list(filter(None, paths))
99
98
 
99
+ # Count found mantis files
100
100
  total_mantis_files = len(paths)
101
101
 
102
+ # No mantis file found
102
103
  if total_mantis_files == 0:
103
- CLI.warning(f'mantis.json file not found. Using default value: {DEFAULT_PATH}')
104
+ DEFAULT_PATH = 'configs/mantis.json'
105
+ CLI.info(f'mantis.json file not found. Using default value: {DEFAULT_PATH}')
104
106
  return DEFAULT_PATH
105
107
 
108
+ # Single mantis file found
106
109
  if total_mantis_files == 1:
107
110
  CLI.info(f'Found 1 mantis.json file: {paths[0]}')
108
111
  return paths[0]
109
112
 
110
- paths_per_line = "\n".join(paths)
111
- CLI.warning(f'Found {total_mantis_files} mantis.json files:')
113
+ # Multiple mantis files found
114
+ CLI.info(f'Found {total_mantis_files} mantis.json files:')
112
115
 
113
116
  for index, path in enumerate(paths):
114
- CLI.info(f'[{index+1}] {path}')
117
+ config_connections = load_config(path).get('connections', {}).keys()
118
+ connection_for_environment_exists = environment_id in config_connections
119
+
120
+ if connection_for_environment_exists:
121
+ CLI.success(f'[{index+1}] {path}')
122
+ else:
123
+ CLI.warning(f'[{index+1}] {path}')
124
+
115
125
  CLI.danger(f'[0] Exit now and define $MANTIS_CONFIG environment variable')
116
126
 
117
127
  path_index = None
@@ -55,7 +55,7 @@ def get_extension_classes(extensions):
55
55
 
56
56
  def get_manager(environment_id, mode):
57
57
  # config file
58
- config_file = find_config()
58
+ config_file = find_config(environment_id)
59
59
  config = load_config(config_file)
60
60
 
61
61
  # class name of the manager
@@ -24,7 +24,7 @@ class BaseManager(object):
24
24
  self.config_file = config_file
25
25
 
26
26
  if not config_file:
27
- self.config_file = find_config()
27
+ self.config_file = find_config(self.environment_id)
28
28
 
29
29
  config = load_config(self.config_file)
30
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mantis-cli
3
- Version: 14.2.0
3
+ Version: 14.3.0
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -1 +0,0 @@
1
- VERSION = '14.2.0'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes