| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Produces configured shell abstractions. | 5 """Produces configured shell abstractions. |
| 6 | 6 |
| 7 This module knows how to produce a configured shell abstraction based on | 7 This module knows how to produce a configured shell abstraction based on |
| 8 shell_config.ShellConfig. | 8 shell_config.ShellConfig. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 Args: | 151 Args: |
| 152 shell: The shell that is being configured. | 152 shell: The shell that is being configured. |
| 153 shell_arguments: Current list of shell arguments. | 153 shell_arguments: Current list of shell arguments. |
| 154 dev_server_config: Instance of shell_config.DevServerConfig describing the | 154 dev_server_config: Instance of shell_config.DevServerConfig describing the |
| 155 dev server to be set up. | 155 dev server to be set up. |
| 156 | 156 |
| 157 Returns: | 157 Returns: |
| 158 The updated argument list. | 158 The updated argument list. |
| 159 """ | 159 """ |
| 160 server_url = shell.serve_local_directories(dev_server_config.mappings) | 160 port = dev_server_config.port if dev_server_config.port else 0 |
| 161 server_url = shell.serve_local_directories(dev_server_config.mappings, |
| 162 port=port) |
| 161 shell_args.append('--map-origin=%s=%s' % (dev_server_config.host, server_url)) | 163 shell_args.append('--map-origin=%s=%s' % (dev_server_config.host, server_url)) |
| 162 print "Configured %s locally at %s to serve:" % (dev_server_config.host, | 164 print "Configured %s locally at %s to serve:" % (dev_server_config.host, |
| 163 server_url) | 165 server_url) |
| 164 for mapping_prefix, mapping_path in dev_server_config.mappings: | 166 for mapping_prefix, mapping_path in dev_server_config.mappings: |
| 165 print " /%s -> %s" % (mapping_prefix, mapping_path) | 167 print " /%s -> %s" % (mapping_prefix, mapping_path) |
| 166 return shell_args | 168 return shell_args |
| 167 | 169 |
| 168 | 170 |
| 169 def get_shell(shell_config, shell_args): | 171 def get_shell(shell_config, shell_args): |
| 170 """ | 172 """ |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 for (mime_type, | 221 for (mime_type, |
| 220 content_handler_url) in shell_config.content_handlers.iteritems(): | 222 content_handler_url) in shell_config.content_handlers.iteritems(): |
| 221 shell_args = append_to_argument(shell_args, '--content-handlers=', | 223 shell_args = append_to_argument(shell_args, '--content-handlers=', |
| 222 '%s,%s' % (mime_type, | 224 '%s,%s' % (mime_type, |
| 223 content_handler_url)) | 225 content_handler_url)) |
| 224 | 226 |
| 225 for dev_server_config in shell_config.dev_servers: | 227 for dev_server_config in shell_config.dev_servers: |
| 226 shell_args = _configure_dev_server(shell, shell_args, dev_server_config) | 228 shell_args = _configure_dev_server(shell, shell_args, dev_server_config) |
| 227 | 229 |
| 228 return shell, shell_args | 230 return shell, shell_args |
| OLD | NEW |