| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from api_data_source import APIDataSource | 5 from api_data_source import APIDataSource |
| 6 from api_list_data_source import APIListDataSource | 6 from api_list_data_source import APIListDataSource |
| 7 from compiled_file_system import CompiledFileSystem | 7 from compiled_file_system import CompiledFileSystem |
| 8 from content_providers import ContentProviders | 8 from content_providers import ContentProviders |
| 9 from document_renderer import DocumentRenderer | 9 from document_renderer import DocumentRenderer |
| 10 from empty_dir_file_system import EmptyDirFileSystem | 10 from empty_dir_file_system import EmptyDirFileSystem |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 Creates FileSystem instances backed by GitHub. | 49 Creates FileSystem instances backed by GitHub. |
| 50 |base_path| | 50 |base_path| |
| 51 The path which all HTML is generated relative to. Usually this is / | 51 The path which all HTML is generated relative to. Usually this is / |
| 52 but some servlets need to override this. | 52 but some servlets need to override this. |
| 53 ''' | 53 ''' |
| 54 self.object_store_creator = object_store_creator | 54 self.object_store_creator = object_store_creator |
| 55 | 55 |
| 56 self.compiled_fs_factory = compiled_fs_factory | 56 self.compiled_fs_factory = compiled_fs_factory |
| 57 | 57 |
| 58 self.host_file_system_provider = host_file_system_provider | 58 self.host_file_system_provider = host_file_system_provider |
| 59 host_fs_at_trunk = host_file_system_provider.GetTrunk() | 59 host_fs_at_master = host_file_system_provider.GetMaster() |
| 60 | 60 |
| 61 self.github_file_system_provider = github_file_system_provider | 61 self.github_file_system_provider = github_file_system_provider |
| 62 self.gcs_file_system_provider = gcs_file_system_provider | 62 self.gcs_file_system_provider = gcs_file_system_provider |
| 63 | 63 |
| 64 assert base_path.startswith('/') and base_path.endswith('/') | 64 assert base_path.startswith('/') and base_path.endswith('/') |
| 65 self.base_path = base_path | 65 self.base_path = base_path |
| 66 | 66 |
| 67 self.host_file_system_iterator = HostFileSystemIterator( | 67 self.host_file_system_iterator = HostFileSystemIterator( |
| 68 host_file_system_provider, | 68 host_file_system_provider, |
| 69 branch_utility) | 69 branch_utility) |
| 70 | 70 |
| 71 self.platform_bundle = PlatformBundle( | 71 self.platform_bundle = PlatformBundle( |
| 72 branch_utility, | 72 branch_utility, |
| 73 self.compiled_fs_factory, | 73 self.compiled_fs_factory, |
| 74 host_fs_at_trunk, | 74 host_fs_at_master, |
| 75 self.host_file_system_iterator, | 75 self.host_file_system_iterator, |
| 76 self.object_store_creator, | 76 self.object_store_creator, |
| 77 self.base_path) | 77 self.base_path) |
| 78 | 78 |
| 79 self.content_providers = ContentProviders( | 79 self.content_providers = ContentProviders( |
| 80 object_store_creator, | 80 object_store_creator, |
| 81 self.compiled_fs_factory, | 81 self.compiled_fs_factory, |
| 82 host_fs_at_trunk, | 82 host_fs_at_master, |
| 83 self.github_file_system_provider, | 83 self.github_file_system_provider, |
| 84 self.gcs_file_system_provider) | 84 self.gcs_file_system_provider) |
| 85 | 85 |
| 86 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry, | 86 # TODO(kalman): Move all the remaining DataSources into DataSourceRegistry, |
| 87 # then factor out the DataSource creation into a factory method, so that | 87 # then factor out the DataSource creation into a factory method, so that |
| 88 # the entire ServerInstance doesn't need to be passed in here. | 88 # the entire ServerInstance doesn't need to be passed in here. |
| 89 self.template_renderer = TemplateRenderer(self) | 89 self.template_renderer = TemplateRenderer(self) |
| 90 | 90 |
| 91 # TODO(kalman): It may be better for |document_renderer| to construct a | 91 # TODO(kalman): It may be better for |document_renderer| to construct a |
| 92 # TemplateDataSource itself rather than depending on template_renderer, but | 92 # TemplateDataSource itself rather than depending on template_renderer, but |
| 93 # for that the above todo should be addressed. | 93 # for that the above todo should be addressed. |
| 94 self.document_renderer = DocumentRenderer( | 94 self.document_renderer = DocumentRenderer( |
| 95 TableOfContentsRenderer(host_fs_at_trunk, | 95 TableOfContentsRenderer(host_fs_at_master, |
| 96 compiled_fs_factory, | 96 compiled_fs_factory, |
| 97 self.template_renderer), | 97 self.template_renderer), |
| 98 self.platform_bundle) | 98 self.platform_bundle) |
| 99 | 99 |
| 100 @staticmethod | 100 @staticmethod |
| 101 def ForTest(file_system=None, file_system_provider=None, base_path='/'): | 101 def ForTest(file_system=None, file_system_provider=None, base_path='/'): |
| 102 object_store_creator = ObjectStoreCreator.ForTest() | 102 object_store_creator = ObjectStoreCreator.ForTest() |
| 103 if file_system is None and file_system_provider is None: | 103 if file_system is None and file_system_provider is None: |
| 104 raise ValueError('Either |file_system| or |file_system_provider| ' | 104 raise ValueError('Either |file_system| or |file_system_provider| ' |
| 105 'must be specified') | 105 'must be specified') |
| (...skipping 18 matching lines...) Expand all Loading... |
| 124 store_type=TestObjectStore) | 124 store_type=TestObjectStore) |
| 125 host_file_system_provider = HostFileSystemProvider.ForLocal( | 125 host_file_system_provider = HostFileSystemProvider.ForLocal( |
| 126 object_store_creator) | 126 object_store_creator) |
| 127 return ServerInstance( | 127 return ServerInstance( |
| 128 object_store_creator, | 128 object_store_creator, |
| 129 CompiledFileSystem.Factory(object_store_creator), | 129 CompiledFileSystem.Factory(object_store_creator), |
| 130 TestBranchUtility.CreateWithCannedData(), | 130 TestBranchUtility.CreateWithCannedData(), |
| 131 host_file_system_provider, | 131 host_file_system_provider, |
| 132 GithubFileSystemProvider.ForEmpty(), | 132 GithubFileSystemProvider.ForEmpty(), |
| 133 CloudStorageFileSystemProvider(object_store_creator)) | 133 CloudStorageFileSystemProvider(object_store_creator)) |
| OLD | NEW |