From 47e03b57dd8cb27b24533624484dfdbfd631bfcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Wed, 21 Sep 2016 16:39:17 +0200 Subject: [PATCH 1/6] [CORE-1684] add support for multiple domains; --- README.rst | 18 ++++++-- syncano_cli/hosting/command.py | 27 ++++++++--- syncano_cli/hosting/commands.py | 45 +++++++++++------- syncano_cli/hosting/exceptions.py | 4 +- tests/test_hosting_commands.py | 76 ++++++++++++++++--------------- 5 files changed, 104 insertions(+), 66 deletions(-) diff --git a/README.rst b/README.rst index 9961533..58068e7 100644 --- a/README.rst +++ b/README.rst @@ -263,19 +263,19 @@ Syncano Hosting Syncano Hosting is a simple way to host your static files on Syncano servers. The CLI supports it in the following way: -This command will list files for currently hosted website:: +This command will list files for currently defined hostings in the instance:: syncano hosting list +This command will list files for currently hosted website (in `default` hosting):: + + syncano hosting list files + This command will publish all files inside ** to the default Syncano Hosting instance. When publishing the whole directory, the structure will be mapped on Syncano.:: syncano hosting publish -This command will unpublish currently published hosting:: - - syncano hosting unpublish - This command will permamently delete the hosting:: @@ -289,6 +289,14 @@ This command will update single file:: syncano hosting update hosting/file/path local/file/path +For each of the above command you can specify the domain to change just after hosting command, example:: + + syncano hosting --domain staging publish + +Will create a new hosting which will be available under: `--staging.syncano.site` +If this hosting is also a default one, it will be available under: `.syncano.site`. + + Custom Sockets ============== diff --git a/syncano_cli/hosting/command.py b/syncano_cli/hosting/command.py index e81aff5..c15cbdc 100644 --- a/syncano_cli/hosting/command.py +++ b/syncano_cli/hosting/command.py @@ -4,18 +4,31 @@ import click from syncano_cli.base.command import BaseInstanceCommand -from syncano_cli.hosting.exceptions import NoDefaultHostingFoundException, PathNotFoundException, UnicodeInPathException +from syncano_cli.hosting.exceptions import NoHostingFoundException, PathNotFoundException, UnicodeInPathException class HostingCommands(BaseInstanceCommand): VALID_PATH_REGEX = re.compile(r'^(?!/)([a-zA-Z0-9\-\._]+/{0,1})+(? Date: Wed, 21 Sep 2016 16:44:29 +0200 Subject: [PATCH 2/6] [CORE-1684] correct README; --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 58068e7..8a780f7 100644 --- a/README.rst +++ b/README.rst @@ -263,11 +263,11 @@ Syncano Hosting Syncano Hosting is a simple way to host your static files on Syncano servers. The CLI supports it in the following way: -This command will list files for currently defined hostings in the instance:: +This command will list currently defined hostings in the instance:: syncano hosting list -This command will list files for currently hosted website (in `default` hosting):: +This command will list files for currently hosted website (for `default` hosting):: syncano hosting list files From 88dc5ad3f66f672d54f47cd19229838b860c1cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Wed, 21 Sep 2016 19:33:36 +0200 Subject: [PATCH 3/6] [CORE-1684] correct domain option in tests; --- tests/test_hosting_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_hosting_commands.py b/tests/test_hosting_commands.py index e95fd0b..b80ce75 100644 --- a/tests/test_hosting_commands.py +++ b/tests/test_hosting_commands.py @@ -69,5 +69,5 @@ def _delete_hosting(self, domain=None): @classmethod def _extend_args(cls, args, domain): if domain: - args.insert(1, '--domains') + args.insert(1, '--domain') args.insert(2, domain) From fc6efbaddc9d62b22f0dc082b7788d7261e21dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Wed, 21 Sep 2016 19:55:45 +0200 Subject: [PATCH 4/6] [CORE-1684] add domain to delete file in tests; --- tests/test_hosting_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_hosting_commands.py b/tests/test_hosting_commands.py index b80ce75..7c984c5 100644 --- a/tests/test_hosting_commands.py +++ b/tests/test_hosting_commands.py @@ -13,7 +13,7 @@ def _base_test(self, domain): self.assertIn('css/page.css', result.output) # test single file deletion; - self._delete_single_file('css/page.css') + self._delete_single_file('css/page.css', domain=domain) result = self._get_list_files_output(domain=domain) self.assertNotIn('css/page.css', result.output) From 3afb6e54f9c4cdfdbe9795a2a24f2138f63795de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Wed, 21 Sep 2016 20:49:13 +0200 Subject: [PATCH 5/6] [CORE-1684] correct test assert; --- tests/test_hosting_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_hosting_commands.py b/tests/test_hosting_commands.py index 7c984c5..0177093 100644 --- a/tests/test_hosting_commands.py +++ b/tests/test_hosting_commands.py @@ -26,7 +26,7 @@ def _base_test(self, domain): # test hosting delete; self._delete_hosting(domain=domain) result = self._get_list_files_output(domain=domain) - self.assertIn('Hosting with domain `default` - not found. Exit.', result.output) + self.assertIn('Hosting with domain `{}` - not found. Exit.'.format(domain or 'default'), result.output) # recreate hosting; self._publish_files(domain=domain) From 335163861663abdeb410b09a9a0ab05c0baf4bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Opa=C5=82czy=C5=84ski?= Date: Wed, 21 Sep 2016 21:46:16 +0200 Subject: [PATCH 6/6] [CORE-1684] correct test assert; --- tests/test_execute_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_execute_commands.py b/tests/test_execute_commands.py index 22099af..9a0a8c6 100644 --- a/tests/test_execute_commands.py +++ b/tests/test_execute_commands.py @@ -42,7 +42,7 @@ def test_script_endpoint(self): 'execute', '{}_test_script_endpoint'.format(name_prefix) ], obj={}) - self.assertEqual(result.output, '12\n') + self.assertIn('12\n', result.output) def test_script_endpoint_with_payload(self): name_prefix = 'payload_response'