| 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 fnmatch import fnmatch | 5 from fnmatch import fnmatch |
| 6 import mimetypes | 6 import mimetypes |
| 7 import traceback | 7 import traceback |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from api_data_source import APIDataSource | 10 from api_data_source import APIDataSource |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 branch_utility, | 63 branch_utility, |
| 64 host_file_system_creator) | 64 host_file_system_creator) |
| 65 | 65 |
| 66 self.api_list_data_source_factory = APIListDataSource.Factory( | 66 self.api_list_data_source_factory = APIListDataSource.Factory( |
| 67 self.compiled_host_fs_factory, | 67 self.compiled_host_fs_factory, |
| 68 svn_constants.API_PATH, | 68 svn_constants.API_PATH, |
| 69 svn_constants.PUBLIC_TEMPLATE_PATH) | 69 svn_constants.PUBLIC_TEMPLATE_PATH) |
| 70 | 70 |
| 71 self.api_data_source_factory = APIDataSource.Factory( | 71 self.api_data_source_factory = APIDataSource.Factory( |
| 72 self.compiled_host_fs_factory, | 72 self.compiled_host_fs_factory, |
| 73 svn_constants.API_PATH) | 73 svn_constants.API_PATH, |
| 74 self.availability_finder_factory) |
| 74 | 75 |
| 75 self.ref_resolver_factory = ReferenceResolver.Factory( | 76 self.ref_resolver_factory = ReferenceResolver.Factory( |
| 76 self.api_data_source_factory, | 77 self.api_data_source_factory, |
| 77 self.api_list_data_source_factory, | 78 self.api_list_data_source_factory, |
| 78 object_store_creator) | 79 object_store_creator) |
| 79 | 80 |
| 80 self.api_data_source_factory.SetReferenceResolverFactory( | 81 self.api_data_source_factory.SetReferenceResolverFactory( |
| 81 self.ref_resolver_factory) | 82 self.ref_resolver_factory) |
| 82 | 83 |
| 83 # Note: samples are super slow in the dev server because it doesn't support | 84 # Note: samples are super slow in the dev server because it doesn't support |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 self.api_list_data_source_factory, | 116 self.api_list_data_source_factory, |
| 116 self.intro_data_source_factory, | 117 self.intro_data_source_factory, |
| 117 self.samples_data_source_factory, | 118 self.samples_data_source_factory, |
| 118 self.sidenav_data_source_factory, | 119 self.sidenav_data_source_factory, |
| 119 self.compiled_host_fs_factory, | 120 self.compiled_host_fs_factory, |
| 120 self.ref_resolver_factory, | 121 self.ref_resolver_factory, |
| 121 svn_constants.PUBLIC_TEMPLATE_PATH, | 122 svn_constants.PUBLIC_TEMPLATE_PATH, |
| 122 svn_constants.PRIVATE_TEMPLATE_PATH, | 123 svn_constants.PRIVATE_TEMPLATE_PATH, |
| 123 base_path) | 124 base_path) |
| 124 | 125 |
| 126 self.api_data_source_factory.SetTemplateDataSource( |
| 127 self.template_data_source_factory) |
| 128 |
| 125 self.example_zipper = ExampleZipper( | 129 self.example_zipper = ExampleZipper( |
| 126 self.compiled_host_fs_factory, | 130 self.compiled_host_fs_factory, |
| 127 svn_constants.DOCS_PATH) | 131 svn_constants.DOCS_PATH) |
| 128 | 132 |
| 129 self.path_canonicalizer = PathCanonicalizer( | 133 self.path_canonicalizer = PathCanonicalizer( |
| 130 channel, | 134 channel, |
| 131 self.compiled_host_fs_factory) | 135 self.compiled_host_fs_factory) |
| 132 | 136 |
| 133 # TODO(kalman): delete content cache. | 137 # TODO(kalman): delete content cache. |
| 134 self.content_cache = self.compiled_host_fs_factory.CreateIdentity( | 138 self.content_cache = self.compiled_host_fs_factory.CreateIdentity( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 154 object_store_creator)) | 158 object_store_creator)) |
| 155 | 159 |
| 156 @staticmethod | 160 @staticmethod |
| 157 def ForLocal(): | 161 def ForLocal(): |
| 158 channel = 'trunk' | 162 channel = 'trunk' |
| 159 object_store_creator = ObjectStoreCreator(channel, | 163 object_store_creator = ObjectStoreCreator(channel, |
| 160 start_empty=False, | 164 start_empty=False, |
| 161 store_type=TestObjectStore) | 165 store_type=TestObjectStore) |
| 162 host_file_system_creator = HostFileSystemCreator.ForLocal( | 166 host_file_system_creator = HostFileSystemCreator.ForLocal( |
| 163 object_store_creator) | 167 object_store_creator) |
| 164 trunk_file_system = host_file_system_creator.Create( | 168 trunk_file_system = host_file_system_creator.Create('trunk') |
| 165 'trunk') | |
| 166 return ServerInstance( | 169 return ServerInstance( |
| 167 channel, | 170 channel, |
| 168 object_store_creator, | 171 object_store_creator, |
| 169 trunk_file_system, | 172 trunk_file_system, |
| 170 EmptyDirFileSystem(), | 173 EmptyDirFileSystem(), |
| 171 '', | 174 '', |
| 172 CompiledFileSystem.Factory(trunk_file_system, object_store_creator), | 175 CompiledFileSystem.Factory(trunk_file_system, object_store_creator), |
| 173 TestBranchUtility.CreateWithCannedData(), | 176 TestBranchUtility.CreateWithCannedData(), |
| 174 host_file_system_creator) | 177 host_file_system_creator) |
| OLD | NEW |