예제 #1
0
        // install version locally
        protected async Task InstallVersion(string assetsVersion)
        {
            // check if folder versions already exist in local file system and ignore otherwise
            string clientAssetsVersionRoot = GetClientPath(assetsVersion);
            string serverAssetsVersionRoot = GetServerPath(assetsVersion);

            if (!Directory.Exists(clientAssetsVersionRoot) || !Directory.Exists(serverAssetsVersionRoot))
            {
                // check if version exists in remote storage and error otherwise
                if (!(await storageService.Exists(assetsVersion)))
                {
                    throw new Exception("Could not find asset version in remote storage");
                }

                // TODO - make externals scripts file installable/invalidate cache and read from it (allows full frontend deployment)
                // copy versioned folder from remote storage to local storage
                await storageService.Copy($"{assetsVersion}/client", clientAssetsVersionRoot);

                await storageService.Copy($"{assetsVersion}/server", serverAssetsVersionRoot);
            }

            // change last updated version
            Models.Settings.AppClock appClock = await settingsService.GetClock();

            AssetVersion updated = new AssetVersion(assetsVersion, appClock.CurrentTime);

            await SetLastUpdatedVersion(updated);

            // cleanup orphaned versions if they exist
            await CleanOrphanedVersions();
        }
예제 #2
0
        public async Task PublishVersion(string assetsVersion)
        {
            AssetVersion previouslyPublishedVersion = await GetPublishedVersion();

            Models.Settings.AppClock appClock = await settingsService.GetClock();
            await SetPublishedVersion(new AssetVersion(assetsVersion, appClock.CurrentTime));

            if (previouslyPublishedVersion != null)
            {
                await SetPreviousPublishedVersion(previouslyPublishedVersion);
            }
        }