Skip to content

Commit 12acfa6

Browse files
author
Igor Polevoy
committed
#223 Lessc plugin need to be able to process more than one file - need to complete integration test
1 parent 57612cc commit 12acfa6

File tree

221 files changed

+24379
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+24379
-36
lines changed
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
2+
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.javalite</groupId>
6+
<artifactId>activeweb-lessc-integration-test</artifactId>
7+
<version>1.12-SNAPSHOT</version>
8+
<packaging>pom</packaging>
9+
<name>ActiveWeb - Lessc Maven Plugin Integration Test</name>
10+
11+
<parent>
12+
<groupId>org.javalite</groupId>
13+
<artifactId>activeweb-root</artifactId>
14+
<version>1.12-SNAPSHOT</version>
15+
</parent>
16+
17+
<properties>
18+
<proj_version>${project.version}</proj_version>
19+
</properties>
20+
21+
<build>
22+
<plugins>
23+
24+
<plugin>
25+
<groupId>org.apache.maven.plugins</groupId>
26+
<artifactId>maven-resources-plugin</artifactId>
27+
<version>2.7</version>
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.apache.maven.shared</groupId>
31+
<artifactId>maven-filtering</artifactId>
32+
<version>1.3</version>
33+
</dependency>
34+
</dependencies>
35+
<executions>
36+
<execution>
37+
<id>copy-resources1</id>
38+
<phase>process-resources</phase>
39+
<goals>
40+
<goal>copy-resources</goal>
41+
</goals>
42+
<configuration>
43+
<outputDirectory>${project.basedir}/target/test-project</outputDirectory>
44+
<resources>
45+
<resource>
46+
<directory>${project.basedir}/src/test/test-project</directory>
47+
<filtering>true</filtering>
48+
</resource>
49+
</resources>
50+
</configuration>
51+
</execution>
52+
53+
<execution>
54+
<id>copy-resources2</id>
55+
<phase>process-resources</phase>
56+
<goals>
57+
<goal>copy-resources</goal>
58+
</goals>
59+
<configuration>
60+
<outputDirectory>${project.basedir}/target/test-project-list</outputDirectory>
61+
<resources>
62+
<resource>
63+
<directory>${project.basedir}/src/test/test-project-list</directory>
64+
<filtering>true</filtering>
65+
</resource>
66+
</resources>
67+
</configuration>
68+
</execution>
69+
</executions>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
<dependencies>
74+
<dependency>
75+
<groupId>junit</groupId>
76+
<artifactId>junit</artifactId>
77+
</dependency>
78+
79+
<dependency>
80+
<groupId>org.apache.maven</groupId>
81+
<artifactId>maven-plugin-api</artifactId>
82+
<version>3.2.1</version>
83+
</dependency>
84+
85+
<dependency>
86+
<groupId>org.apache.maven</groupId>
87+
<artifactId>maven-core</artifactId>
88+
<version>3.2.3</version>
89+
</dependency>
90+
91+
<dependency>
92+
<groupId>org.apache.maven</groupId>
93+
<artifactId>maven-embedder</artifactId>
94+
<version>3.2.3</version>
95+
<scope>test</scope>
96+
</dependency>
97+
98+
99+
100+
<dependency>
101+
<groupId>org.apache.maven.plugin-tools</groupId>
102+
<artifactId>maven-plugin-annotations</artifactId>
103+
<version>3.3</version>
104+
<scope>provided</scope>
105+
</dependency>
106+
107+
<dependency>
108+
<groupId>org.apache.maven</groupId>
109+
<artifactId>maven-project</artifactId>
110+
<version>3.0-alpha-2</version>
111+
<exclusions>
112+
<exclusion>
113+
<groupId>junit</groupId>
114+
<artifactId>junit</artifactId>
115+
</exclusion>
116+
</exclusions>
117+
</dependency>
118+
119+
<dependency>
120+
<groupId>org.slf4j</groupId>
121+
<artifactId>slf4j-simple</artifactId>
122+
<version>1.7.10</version>
123+
</dependency>
124+
125+
126+
<dependency>
127+
<groupId>org.slf4j</groupId>
128+
<artifactId>slf4j-api</artifactId>
129+
<version>1.7.10</version>
130+
</dependency>
131+
</dependencies>
132+
</project>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
Copyright 2009-2014 Igor Polevoy
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package org.javalite.lessc.maven;
18+
19+
20+
import org.apache.maven.cli.MavenCli;
21+
import java.io.*;
22+
23+
public abstract class AbstractIntegrationSpec {
24+
25+
protected static String execute(String dir, String... args) throws IOException, InterruptedException {
26+
OutputStream outos = null;
27+
PrintStream outps = null;
28+
OutputStream erros = null;
29+
PrintStream errps = null;
30+
try {
31+
outos = new ByteArrayOutputStream();
32+
outps = new PrintStream(outos);
33+
erros = new ByteArrayOutputStream();
34+
errps = new PrintStream(erros);
35+
MavenCli cli = new MavenCli();
36+
int code = cli.doMain(args, dir, outps, errps);
37+
String out = outos.toString();
38+
String err = erros.toString();
39+
if (code != 0) {
40+
System.out.println("TEST MAVEN EXECUTION START >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
41+
System.out.print("Executing: mvn");
42+
for (String arg : args) {
43+
System.out.print(' ');
44+
System.out.print(arg);
45+
}
46+
System.out.println();
47+
System.out.print("Exit code: ");
48+
System.out.println(code);
49+
System.out.print(out);
50+
System.err.print(err);
51+
System.out.println("TEST MAVEN EXECUTION END <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
52+
}
53+
return out + err;
54+
} finally {
55+
closeQuietly(errps);
56+
closeQuietly(erros);
57+
closeQuietly(outps);
58+
closeQuietly(outos);
59+
}
60+
}
61+
62+
private static void closeQuietly(Closeable closeable) {
63+
try {
64+
closeable.close();
65+
} catch (Exception e) {
66+
//
67+
}
68+
}
69+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package test;
2+
3+
import org.javalite.lessc.maven.AbstractIntegrationSpec;
4+
import org.junit.BeforeClass;
5+
import org.junit.Test;
6+
7+
import java.io.IOException;
8+
9+
/**
10+
* @author Igor Polevoy on 5/22/15.
11+
*/
12+
public class IntegrationTest extends AbstractIntegrationSpec {
13+
14+
@BeforeClass
15+
public static void before() throws IOException, InterruptedException {
16+
// System.out.println(execute(".", "clean"));
17+
System.out.println(execute(".", "install"));
18+
}
19+
20+
@Test
21+
public void shouldCompileProjectWithSingleLessFile() throws IOException, InterruptedException {
22+
23+
System.out.println(">>>>>>>>>>>> hello");
24+
// execute("target/test-project", "mvn clean package", "-o");
25+
}
26+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package test;
2+
3+
import org.junit.Test;
4+
5+
/**
6+
* @author Igor Polevoy on 5/24/15.
7+
*/
8+
public class TestTest extends junit.framework.TestCase {
9+
10+
public void testBlah(){
11+
12+
System.out.println("damn it, work!!");
13+
}
14+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>org.javalite</groupId>
6+
<artifactId>activeweb-lessc-test-proj</artifactId>
7+
<packaging>jar</packaging>
8+
<version>1.0-SNAPSHOT</version>
9+
<name>Lessc Test Project</name>
10+
11+
<properties>
12+
<proj_version>1.12-SNAPSHOT</proj_version>
13+
</properties>
14+
15+
<build>
16+
<plugins>
17+
<plugin>
18+
<groupId>org.javalite</groupId>
19+
<artifactId>activeweb-lessc-maven-plugin</artifactId>
20+
<version>${proj_version}</version>
21+
<configuration>
22+
<lessConfigs>
23+
<lessConfig implementation="org.javalite.lessc.maven.LessConfig">
24+
<lesscMain>src/main/webapp/less1/bootstrap.less</lesscMain>
25+
<targetDirectory>target/web1</targetDirectory>
26+
<targetFileName>bootstrap.css</targetFileName>
27+
</lessConfig>
28+
<lessConfig implementation="org.javalite.lessc.maven.LessConfig">
29+
<lesscMain>src/main/webapp/less2/bootstrap.less</lesscMain>
30+
<targetDirectory>target/web2</targetDirectory>
31+
<targetFileName>bootstrap.css</targetFileName>
32+
</lessConfig>
33+
</lessConfigs>
34+
</configuration>
35+
<executions>
36+
<execution>
37+
<goals>
38+
<goal>compile</goal>
39+
</goals>
40+
</execution>
41+
</executions>
42+
</plugin>
43+
44+
</plugins>
45+
</build>
46+
47+
<dependencies>
48+
<dependency>
49+
<groupId>org.javalite</groupId>
50+
<artifactId>activeweb</artifactId>
51+
<version>${proj_version}</version>
52+
</dependency>
53+
54+
</dependencies>
55+
</project>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// Alerts
3+
// --------------------------------------------------
4+
5+
6+
// Base styles
7+
// -------------------------
8+
9+
.alert {
10+
padding: @alert-padding;
11+
margin-bottom: @line-height-computed;
12+
border: 1px solid transparent;
13+
border-radius: @alert-border-radius;
14+
15+
// Headings for larger alerts
16+
h4 {
17+
margin-top: 0;
18+
// Specified for the h4 to prevent conflicts of changing @headings-color
19+
color: inherit;
20+
}
21+
// Provide class for links that match alerts
22+
.alert-link {
23+
font-weight: @alert-link-font-weight;
24+
}
25+
26+
// Improve alignment and spacing of inner content
27+
> p,
28+
> ul {
29+
margin-bottom: 0;
30+
}
31+
> p + p {
32+
margin-top: 5px;
33+
}
34+
}
35+
36+
// Dismissible alerts
37+
//
38+
// Expand the right padding and account for the close button's positioning.
39+
40+
.alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0.
41+
.alert-dismissible {
42+
padding-right: (@alert-padding + 20);
43+
44+
// Adjust close link position
45+
.close {
46+
position: relative;
47+
top: -2px;
48+
right: -21px;
49+
color: inherit;
50+
}
51+
}
52+
53+
// Alternate styles
54+
//
55+
// Generate contextual modifier classes for colorizing the alert.
56+
57+
.alert-success {
58+
.alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text);
59+
}
60+
.alert-info {
61+
.alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text);
62+
}
63+
.alert-warning {
64+
.alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text);
65+
}
66+
.alert-danger {
67+
.alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text);
68+
}

0 commit comments

Comments
 (0)