-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add configuration to auto copy file remotely #138
Conversation
src/fileSyncer.ts
Outdated
this._configuration = config; | ||
} | ||
|
||
protected hasConfigurationChanged(oldConfig: FileCopyConfigs, newConfig: FileCopyConfigs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function name sounds like a function to detect whether there is change happens and the return type should be bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/fileSyncer.ts
Outdated
protected hasConfigurationChanged(oldConfig: FileCopyConfigs, newConfig: FileCopyConfigs) { | ||
let result = []; | ||
|
||
if (!oldConfig || oldConfig.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this conditional check can be written as oldConfig = oldConfig || []
. This empty check should also be applied to newConfig. And then go to the original logic to merge two array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/fileSyncer.ts
Outdated
public async copyFiles(configuration: FileCopyConfigs, fileName: string = null) { | ||
let servers = utilities.getSSHConfig(); | ||
|
||
if (!configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configuration = configuration || this._configuration || []
src/fileSyncer.ts
Outdated
return result; | ||
} | ||
|
||
public async copyFiles(configuration: FileCopyConfigs, fileName: string = null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is the await?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed async
src/sshRunner.ts
Outdated
// check configuration weather to sync workspace | ||
let copyWorkspace = utilities.getCodeConfiguration<boolean>('ansible', 'copyWorkspace'); | ||
if (fileSyncConfig) { | ||
for (let config of fileSyncConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (let config of (fileSyncConfig || [])) {
src/sshRunner.ts
Outdated
} catch (err) { | ||
return; | ||
// if not saved on copy, copy playbook to remote | ||
if (!config.copyOnSave) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if
- copyOnSave = false
- modified some file
- copyOnSave = true
- run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
run against old version.
|
||
let childTokens = []; | ||
child.split(/\\/).forEach((s) => childTokens = childTokens.concat(s.split(/\//).filter(i => i.length))); | ||
return parentTokens.every((t, i) => childTokens[i] === t); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need wait the forEach terminate?
Summary
add new feature:
copy local saved files to remote ssh host.
Issue Type