def Create(self, owner, repo):
        '''Creates a GithubFileSystem. For legacy reasons this is hacked
    such that the apps samples returns the old GithubFileSystem.

    |owner| is the owner of the GitHub account, e.g. 'GoogleChrome'.
    |repo| is the repository name, e.g. 'devtools-docs'.
    '''
        if owner == 'GoogleChrome' and repo == 'chrome-app-samples':
            # NOTE: The old GitHub file system implementation doesn't support being
            # wrapped by a CachingFileSystem. It's also too slow to run on the dev
            # server, since every app API page would need to read from it.
            return OldGithubFileSystem.CreateChromeAppsSamples(
                self._object_store_creator)
        return CachingFileSystem(
            NewGithubFileSystem.Create(owner, repo,
                                       self._object_store_creator),
            self._object_store_creator)
Esempio n. 2
0
 def setUp(self):
     ConfigureFakeFetchers()
     self._base_path = os.path.join(sys.path[0], 'test_data',
                                    'github_file_system')
     self._file_system = GithubFileSystem.CreateChromeAppsSamples(
         ObjectStoreCreator.ForTest())