Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
added alwaysSyncIfNewer setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Jun 11, 2017
1 parent 41e189d commit 4dd18ae
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log (vs-deploy)

## 9.23.0 (June 11th, 2017; sync when open)

* added `alwaysSyncIfNewer` [package setting](https://github.com/mkloubert/vs-deploy/wiki#packages-) for [sync when open](https://github.com/mkloubert/vs-deploy/wiki/sync_when_open)

## 9.22.0 (June 11th, 2017; fastCheckOnSync)

* added missing `fastCheckOnSync` for [global settings](https://github.com/mkloubert/vs-deploy/wiki#settings--) and [packages](https://github.com/mkloubert/vs-deploy/wiki#packages-)
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vs-deploy",
"displayName": "Deploy",
"description": "Commands for deploying files of your workspace to a destination.",
"version": "9.22.0",
"version": "9.23.0",
"publisher": "mkloubert",
"engines": {
"vscode": "^1.6.0"
Expand Down Expand Up @@ -151,6 +151,11 @@
"description": "Indicates if target list is shown, even if there is only one entry.",
"default": false
},
"alwaysSyncIfNewer": {
"type": "boolean",
"description": "Always synchronize a local file with a newer one when using 'sync when open' in a package.",
"default": false
},
"button": {
"type": "object",
"description": "Settings for the 'quick deploy button' in the status bar.",
Expand Down Expand Up @@ -1103,6 +1108,11 @@
"type": "boolean",
"description": "Use workspace start time for 'sync when open' for that package or not.",
"default": false
},
"alwaysSyncIfNewer": {
"type": "boolean",
"description": "Always synchronize a local file with a newer one when using 'sync when open' in that package.",
"default": false
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,10 @@ export interface DeployConfiguration extends vscode.WorkspaceConfiguration {
* Indicates if target list is shown, even if there is only one entry.
*/
alwaysShowTargetList?: boolean;
/**
* Always synchronize a local file with a newer one when using 'sync when open' in a package.
*/
alwaysSyncIfNewer?: boolean;
/**
* Settings for a "quick deploy button".
*/
Expand Down Expand Up @@ -1150,6 +1154,10 @@ export enum DeployOperationKind {
* A package.
*/
export interface DeployPackage extends Applyable, CanLoadFrom, ConditionalItem, Hideable, Inheritable, MachineItem, PlatformItem, Sortable {
/**
* Always synchronize a local file with a newer one when using 'sync when open' in that package.
*/
alwaysSyncIfNewer?: boolean;
/**
* Settings for a "package button".
*/
Expand Down
5 changes: 4 additions & 1 deletion src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ export function syncFileWhenOpen(file: string): Promise<any> {
});

packagesAndFilters.forEach(pf => {
let alwaysSyncIfNewer = deploy_helpers.toBooleanSafe(pf.package.alwaysSyncIfNewer,
deploy_helpers.toBooleanSafe(cfg.alwaysSyncIfNewer));

let timeToCompareWithLocalFile: Moment.Moment;
if (deploy_helpers.toBooleanSafe(cfg.useWorkspaceStartTimeForSyncWhenOpen,
deploy_helpers.toBooleanSafe(pf.package.useWorkspaceStartTimeForSyncWhenOpen))) {
Expand Down Expand Up @@ -231,7 +234,7 @@ export function syncFileWhenOpen(file: string): Promise<any> {
if (remoteFileIsNewer) {
// sync local with remote file ...

if (timeToCompareWithLocalFile.isAfter(fileStats.mtime)) {
if (alwaysSyncIfNewer || timeToCompareWithLocalFile.isAfter(fileStats.mtime)) {
// ... if local not changed
// since the current session

Expand Down

0 comments on commit 4dd18ae

Please sign in to comment.