mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-01 12:19:14 +01:00
improve WebCompressor
This commit is contained in:
@@ -94,7 +94,7 @@ public class WebCompressorMojo extends AbstractMojo
|
||||
for (WebCompressor compressor : compressorSet)
|
||||
{
|
||||
compressor.compress(document, inputDirectory, outputDirectory,
|
||||
encoding, outputPrefix, true);
|
||||
encoding, outputPrefix, concat);
|
||||
}
|
||||
|
||||
output = new FileOutputStream(outputFile);
|
||||
@@ -112,6 +112,17 @@ public class WebCompressorMojo extends AbstractMojo
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Set<WebCompressor> getCompressorSet()
|
||||
{
|
||||
return compressorSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -167,8 +178,41 @@ public class WebCompressorMojo extends AbstractMojo
|
||||
return outputPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isConcat()
|
||||
{
|
||||
return concat;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param compressorSet
|
||||
*/
|
||||
public void setCompressorSet(Set<WebCompressor> compressorSet)
|
||||
{
|
||||
this.compressorSet = compressorSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param concat
|
||||
*/
|
||||
public void setConcat(boolean concat)
|
||||
{
|
||||
this.concat = concat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -234,6 +278,11 @@ public class WebCompressorMojo extends AbstractMojo
|
||||
*/
|
||||
private String encoding = "UTF-8";
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private boolean concat = true;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
* @required
|
||||
@@ -241,7 +290,7 @@ public class WebCompressorMojo extends AbstractMojo
|
||||
private File inputFile;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
* @parameter default-value="${project.build.directory}/web-compressor"
|
||||
*/
|
||||
private File outputDirectory;
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
package sonia.scm;
|
||||
|
||||
import java.io.File;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.maven.WebCompressorMojo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class WebCompressorTest
|
||||
{
|
||||
|
||||
@Test
|
||||
public void compress() throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
WebCompressorMojo mojo = new WebCompressorMojo();
|
||||
mojo.setInputFile( new File("/tmp/compressor/index.html") );
|
||||
mojo.setOutputDirectory( new File("/tmp") );
|
||||
mojo.setOutputFile( new File("/tmp/index.html") );
|
||||
mojo.setOutputPrefix("");
|
||||
mojo.execute();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user