Skip to content

Commit

Permalink
[FIXED JENKINS-13693] Add option to disable default excludes
Browse files Browse the repository at this point in the history
  • Loading branch information
bap2000 committed Jul 24, 2012
1 parent 9006514 commit 75797f3
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -64,7 +64,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>publish-over</artifactId>
<version>0.13</version>
<version>0.15-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
Expand Down
Expand Up @@ -42,13 +42,14 @@ public class BapFtpTransfer extends BPTransfer implements Describable<BapFtpTran

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);
this(sourceFiles, null, remoteDirectory, removePrefix, asciiMode, remoteDirectorySDF, flatten, 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) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote);
final boolean asciiMode, final boolean remoteDirectorySDF, final boolean flatten, final boolean cleanRemote,
final boolean noDefaultExcludes) {
super(sourceFiles, excludes, remoteDirectory, removePrefix, remoteDirectorySDF, flatten, cleanRemote, noDefaultExcludes);
this.asciiMode = asciiMode;
}

Expand Down
Expand Up @@ -34,6 +34,10 @@ 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();
}
Expand Down
Expand Up @@ -41,11 +41,12 @@ public class FtpOverrideTransferDefaults implements FtpTransferOptions, Describa
private final boolean remoteDirectorySDF;
private final boolean flatten;
private final boolean cleanRemote;
private final boolean noDefaultExcludes;

@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 cleanRemote, final boolean asciiMode, final boolean noDefaultExcludes) {
this.asciiMode = asciiMode;
this.cleanRemote = cleanRemote;
this.excludes = excludes;
Expand All @@ -54,6 +55,7 @@ public FtpOverrideTransferDefaults(final String sourceFiles, final String exclud
this.remoteDirectorySDF = remoteDirectorySDF;
this.removePrefix = removePrefix;
this.sourceFiles = sourceFiles;
this.noDefaultExcludes = noDefaultExcludes;
}

public String getSourceFiles() {
Expand Down Expand Up @@ -88,6 +90,10 @@ public boolean isAsciiMode() {
return asciiMode;
}

public boolean isNoDefaultExcludes() {
return noDefaultExcludes;
}

public FtpOverrideTransferDefaultsDescriptor getDescriptor() {
return Hudson.getInstance().getDescriptorByType(FtpOverrideTransferDefaultsDescriptor.class);
}
Expand All @@ -104,6 +110,10 @@ 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();
}
Expand Down
Expand Up @@ -52,6 +52,12 @@
</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.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
Expand Down
@@ -0,0 +1,39 @@
<?jelly escape-by-default='true'?>

<!--
~ 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.
-->

<j:jelly xmlns:j="jelly:core">

Select this option to disable the default exclude patterns.
<p>The default exclude patterns are:
<j:invokeStatic var="defaultExcludes" method="getDefaultExcludes" className="org.apache.tools.ant.DirectoryScanner"/>
<pre>
<j:forEach var="pattern" items="${defaultExcludes}">
${pattern}<br/>
</j:forEach>
</pre>
</p>

</j:jelly>
Expand Up @@ -42,6 +42,11 @@
<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.flatten()}" field="flatten">
<f:checkbox default="${defaults.transfer.flatten}"/>
</f:entry>
Expand Down
Expand Up @@ -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);
final BapFtpTransfer transfer2 = new BapFtpTransfer("*", null, "", "WebApp", false, true, false, false);
final BapFtpTransfer transfer3 = new BapFtpTransfer("dave", null, "", "", false, true, true, false);
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 ArrayList<BapFtpTransfer> transfers1 = new ArrayList<BapFtpTransfer>();
transfers1.add(transfer1);
transfers1.add(transfer2);
Expand Down
Expand Up @@ -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);
final BapFtpTransfer transfer = new BapFtpTransfer("**/*", null, "sub-home", dirToIgnore, true, 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));
Expand Down
Expand Up @@ -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);
true, true, true, 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);
final BapFtpTransfer transfer21 = new BapFtpTransfer("target\\images\\*", null, "", "", false, false, false, false, false);
final BapFtpTransfer transfer22 = new BapFtpTransfer("target\\logs\\**\\*", null, "serverlogs", "target\\logs",
true, false, true, false);
true, false, true, false, false);
final ArrayList<BapFtpTransfer> transfers2 = new ArrayList<BapFtpTransfer>();
transfers2.add(transfer21);
transfers2.add(transfer22);
Expand Down

0 comments on commit 75797f3

Please sign in to comment.