Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2132)

Unified Diff: chrome/common/extensions/docs/server2/server_instance.py

Issue 26418002: Docserver: Pull knowledge of host file systems into a single (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correct similarity Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/server_instance.py
diff --git a/chrome/common/extensions/docs/server2/server_instance.py b/chrome/common/extensions/docs/server2/server_instance.py
index a08b2fb2d5431eb76880242259ba845cee1fb7db..1ccdead32e2f9112df7d2f1462ea52c5dca0ccdc 100644
--- a/chrome/common/extensions/docs/server2/server_instance.py
+++ b/chrome/common/extensions/docs/server2/server_instance.py
@@ -10,7 +10,7 @@ from compiled_file_system import CompiledFileSystem
from empty_dir_file_system import EmptyDirFileSystem
from example_zipper import ExampleZipper
from features_bundle import FeaturesBundle
-from host_file_system_creator import HostFileSystemCreator
+from host_file_system_provider import HostFileSystemProvider
from host_file_system_iterator import HostFileSystemIterator
from intro_data_source import IntroDataSource
from object_store_creator import ObjectStoreCreator
@@ -27,28 +27,24 @@ class ServerInstance(object):
def __init__(self,
object_store_creator,
- host_file_system,
app_samples_file_system,
compiled_fs_factory,
branch_utility,
- host_file_system_creator,
+ host_file_system_provider,
base_path='/'):
'''
|object_store_creator|
The ObjectStoreCreator used to create almost all caches.
- |host_file_system|
- The main FileSystem instance which hosts the server, its templates, and
- most App/Extension content. Probably a SubversionFileSystem.
|app_samples_file_system|
The FileSystem instance which hosts the App samples.
|compiled_fs_factory|
Factory used to create CompiledFileSystems, a higher-level cache type
than ObjectStores. This can usually be derived from
- |object_store_creator| and |host_file_system| but under special
+ |object_store_creator| and |host_file_system_provider| but under special
circumstances a different implementation needs to be passed in.
|branch_utility|
Has knowledge of Chrome branches, channels, and versions.
- |host_file_system_creator|
+ |host_file_system_provider|
Creates FileSystem instances which host the server at alternative
revisions.
|base_path|
@@ -57,24 +53,22 @@ class ServerInstance(object):
'''
self.object_store_creator = object_store_creator
- self.host_file_system = host_file_system
-
self.app_samples_file_system = app_samples_file_system
self.compiled_host_fs_factory = compiled_fs_factory
- self.host_file_system_creator = host_file_system_creator
+ self.host_file_system_provider = host_file_system_provider
+ host_fs_at_trunk = host_file_system_provider.GetTrunk()
assert base_path.startswith('/') and base_path.endswith('/')
self.base_path = base_path
self.host_file_system_iterator = HostFileSystemIterator(
- host_file_system_creator,
- host_file_system,
+ host_file_system_provider,
branch_utility)
self.features_bundle = FeaturesBundle(
- self.host_file_system,
+ host_fs_at_trunk,
self.compiled_host_fs_factory,
self.object_store_creator)
@@ -82,11 +76,11 @@ class ServerInstance(object):
self.host_file_system_iterator,
object_store_creator,
branch_utility,
- host_file_system)
+ host_fs_at_trunk)
self.api_list_data_source_factory = APIListDataSource.Factory(
self.compiled_host_fs_factory,
- self.host_file_system,
+ host_fs_at_trunk,
svn_constants.PUBLIC_TEMPLATE_PATH,
self.features_bundle,
self.object_store_creator)
@@ -110,7 +104,7 @@ class ServerInstance(object):
if IsDevServer():
extension_samples_fs = EmptyDirFileSystem()
else:
- extension_samples_fs = self.host_file_system
+ extension_samples_fs = host_fs_at_trunk
self.samples_data_source_factory = SamplesDataSource.Factory(
extension_samples_fs,
CompiledFileSystem.Factory(extension_samples_fs, object_store_creator),
@@ -131,14 +125,14 @@ class ServerInstance(object):
self.example_zipper = ExampleZipper(
self.compiled_host_fs_factory,
- self.host_file_system,
+ host_fs_at_trunk,
svn_constants.DOCS_PATH)
self.path_canonicalizer = PathCanonicalizer(self.compiled_host_fs_factory)
self.redirector = Redirector(
self.compiled_host_fs_factory,
- self.host_file_system,
+ host_fs_at_trunk,
svn_constants.PUBLIC_TEMPLATE_PATH)
self.strings_json_path = svn_constants.STRINGS_JSON_PATH
@@ -163,26 +157,24 @@ class ServerInstance(object):
def ForTest(file_system, base_path='/'):
object_store_creator = ObjectStoreCreator.ForTest()
return ServerInstance(object_store_creator,
- file_system,
EmptyDirFileSystem(),
CompiledFileSystem.Factory(file_system,
object_store_creator),
TestBranchUtility.CreateWithCannedData(),
- HostFileSystemCreator.ForTest(file_system,
- object_store_creator),
+ HostFileSystemProvider.ForTest(file_system,
+ object_store_creator),
base_path=base_path)
@staticmethod
def ForLocal():
object_store_creator = ObjectStoreCreator(start_empty=False,
store_type=TestObjectStore)
- host_file_system_creator = HostFileSystemCreator.ForLocal(
+ host_file_system_provider = HostFileSystemProvider.ForLocal(
object_store_creator)
- trunk_file_system = host_file_system_creator.Create()
return ServerInstance(
object_store_creator,
- trunk_file_system,
EmptyDirFileSystem(),
- CompiledFileSystem.Factory(trunk_file_system, object_store_creator),
+ CompiledFileSystem.Factory(host_file_system_provider.GetTrunk(),
+ object_store_creator),
TestBranchUtility.CreateWithCannedData(),
- host_file_system_creator)
+ host_file_system_provider)

Powered by Google App Engine
This is Rietveld 408576698