Skip to content
Permalink
Browse files

[FIXED JENKINS-13126] Option to create empty directories

  • Loading branch information
bap2000 committed Sep 28, 2012
1 parent 934f4a8 commit 42df64142b9c97c32f5f99352782549bed5c69cf
@@ -42,14 +42,14 @@

public BapFtpTransfer(final String sourceFiles, final String remoteDirectory, final String removePrefix, final boolean asciiMode,
final boolean remoteDirectorySDF, final boolean flatten) {
this(sourceFiles, null, remoteDirectory, removePrefix, asciiMode, remoteDirectorySDF, flatten, false, false);
this(sourceFiles, null, remoteDirectory, removePrefix, asciiMode, remoteDirectorySDF, flatten, false, false, false);
}

@DataBoundConstructor
public BapFtpTransfer(final String sourceFiles, final String excludes, final String remoteDirectory, final String removePrefix,
final boolean asciiMode, final boolean remoteDirectorySDF, final boolean flatten, final boolean cleanRemote,
final boolean noDefaultExcludes) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes);
final boolean noDefaultExcludes, final boolean makeEmptyDirs) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes, makeEmptyDirs);
this.asciiMode = asciiMode;
}

@@ -30,14 +30,6 @@ public FormValidation doCheckSourceFiles(@QueryParameter final String value) {
return FormValidation.validateRequired(value);
}

public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}

public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();
}

public jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages getCommonFieldNames() {
return new jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages();
}
@@ -42,11 +42,13 @@
private final boolean flatten;
private final boolean cleanRemote;
private final boolean noDefaultExcludes;
private final boolean makeEmptyDirs;

@DataBoundConstructor
public FtpOverrideTransferDefaults(final String sourceFiles, final String excludes, final String removePrefix,
final String remoteDirectory, final boolean flatten, boolean remoteDirectorySDF,
final boolean cleanRemote, final boolean asciiMode, final boolean noDefaultExcludes) {
final boolean cleanRemote, final boolean asciiMode, final boolean noDefaultExcludes,
final boolean makeEmptyDirs) {
this.asciiMode = asciiMode;
this.cleanRemote = cleanRemote;
this.excludes = excludes;
@@ -56,6 +58,7 @@ public FtpOverrideTransferDefaults(final String sourceFiles, final String exclud
this.removePrefix = removePrefix;
this.sourceFiles = sourceFiles;
this.noDefaultExcludes = noDefaultExcludes;
this.makeEmptyDirs = makeEmptyDirs;
}

public String getSourceFiles() {
@@ -94,6 +97,10 @@ public boolean isNoDefaultExcludes() {
return noDefaultExcludes;
}

public boolean isMakeEmptyDirs() {
return makeEmptyDirs;
}

public FtpOverrideTransferDefaultsDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(FtpOverrideTransferDefaultsDescriptor.class);
}
@@ -106,14 +113,6 @@ public String getDisplayName() {
return "FtpOverrideTransferDefaultsDescriptor - not visible ...";
}

public boolean canUseExcludes() {
return BPTransfer.canUseExcludes();
}

public boolean canUseNoDefaultExcludes() {
return BPTransfer.canUseNoDefaultExcludes();
}

public jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages getCommonFieldNames() {
return new jenkins.plugins.publish_over.view_defaults.BPTransfer.Messages();
}
@@ -46,17 +46,17 @@

<f:advanced>

<j:if test="${descriptor.canUseExcludes()}">
<f:entry title="${m.excludes()}" field="excludes">
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
</j:if>

<j:if test="${descriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>
<f:entry title="${m.excludes()}" field="excludes">
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>

<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>

<f:entry title="${m.makeEmptyDirs()}" field="makeEmptyDirs">
<f:checkbox default="${defaults.transfer.makeEmptyDirs}"/>
</f:entry>

<f:entry title="${m.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
@@ -0,0 +1,28 @@
<!--
~ The MIT License
~
~ Copyright (C) 2012 by Anthony Robinson
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<div>
<p>The default behaviour of this plugin is to match files, and then create any directories required to preserve the paths to the files.<br />
Selecting this option will create any directories that match the Source files pattern, even if empty.</p>
</div>
@@ -37,16 +37,15 @@
<f:entry title="${m.remoteDirectory()}" field="remoteDirectory">
<f:textbox default="${defaults.transfer.remoteDirectory}"/>
</f:entry>
<j:if test="${descriptor.canUseExcludes()}">
<f:entry title="${m.excludes()}" field="excludes">
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
</j:if>
<j:if test="${descriptor.canUseNoDefaultExcludes()}">
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
</j:if>
<f:entry title="${m.excludes()}" field="excludes">
<f:textbox default="${defaults.transfer.excludes}"/>
</f:entry>
<f:entry title="${m.noDefaultExcludes()}" field="noDefaultExcludes">
<f:checkbox default="${defaults.transfer.noDefaultExcludes}"/>
</f:entry>
<f:entry title="${m.makeEmptyDirs()}" field="makeEmptyDirs">
<f:checkbox default="${defaults.transfer.makeEmptyDirs}"/>
</f:entry>
<f:entry title="${m.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
@@ -75,9 +75,9 @@ public void dontTestRoundTrip() throws Exception {
// public void testConfigureGlobal() throws Exception {}

private BapFtpPublisherPlugin createPlugin(final String config1, final String config2) {
final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "/pub", "target", true, false, true, false, false);
final BapFtpTransfer transfer2 = new BapFtpTransfer("*", null, "", "WebApp", false, true, false, false, false);
final BapFtpTransfer transfer3 = new BapFtpTransfer("dave", null, "", "", false, true, true, false, false);
final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "/pub", "target", true, false, true, false, false, false);
final BapFtpTransfer transfer2 = new BapFtpTransfer("*", null, "", "WebApp", false, true, false, false, false, false);
final BapFtpTransfer transfer3 = new BapFtpTransfer("dave", null, "", "", false, true, true, false, false, false);
final ArrayList<BapFtpTransfer> transfers1 = new ArrayList<BapFtpTransfer>();
transfers1.add(transfer1);
transfers1.add(transfer2);
@@ -72,7 +72,7 @@ public FTPClient createFTPClient() {
};
new JenkinsTestHelper().setGlobalConfig(testHostConfig);
final String dirToIgnore = "target";
final BapFtpTransfer transfer = new BapFtpTransfer("**/*", null, "sub-home", dirToIgnore, true, false, false, false, false);
final BapFtpTransfer transfer = new BapFtpTransfer("**/*", null, "sub-home", dirToIgnore, true, false, false, false, false, false);
final ArrayList transfers = new ArrayList(Collections.singletonList(transfer));
final BapFtpPublisher publisher = new BapFtpPublisher(testHostConfig.getName(), false, transfers, false, false, null, null, null);
final ArrayList publishers = new ArrayList(Collections.singletonList(publisher));
@@ -52,13 +52,13 @@ public void testLoadR0x1() throws Exception {
assertEquals(createHostConfiguration("b", expectedConfigBPort, expectedConfigBTimeout, true), configurations.get(1));

final BapFtpTransfer transfer1 = new BapFtpTransfer("**/*", null, "'helloo-${BUILD_NUMBER}'-MMDD", "target",
true, true, true, false, false);
true, true, true, false, false, false);
final ArrayList<BapFtpTransfer> transfers1 = new ArrayList<BapFtpTransfer>();
transfers1.add(transfer1);
final BapFtpPublisher publisher1 = new BapFtpPublisher("Config b", true, transfers1, false, false, null, null, null);
final BapFtpTransfer transfer21 = new BapFtpTransfer("target\\images\\*", null, "", "", false, false, false, false, false);
final BapFtpTransfer transfer21 = new BapFtpTransfer("target\\images\\*", null, "", "", false, false, false, false, false, false);
final BapFtpTransfer transfer22 = new BapFtpTransfer("target\\logs\\**\\*", null, "serverlogs", "target\\logs",
true, false, true, false, false);
true, false, true, false, false, false);
final ArrayList<BapFtpTransfer> transfers2 = new ArrayList<BapFtpTransfer>();
transfers2.add(transfer21);
transfers2.add(transfer22);

0 comments on commit 42df641

Please sign in to comment.
You can’t perform that action at this time.