From 09626a398f79fb46d0a61af6fcbddc258c5e3477 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 15:00:32 +0300 Subject: [PATCH 01/30] UserAgentAdded --- src/main/java/org/lesscss/HttpResource.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/lesscss/HttpResource.java b/src/main/java/org/lesscss/HttpResource.java index 042a23f..13934dd 100644 --- a/src/main/java/org/lesscss/HttpResource.java +++ b/src/main/java/org/lesscss/HttpResource.java @@ -41,7 +41,11 @@ public long lastModified() { } public InputStream getInputStream() throws IOException { - return url.toURL().openStream(); + + URL u = url.toURL(); + URLConnection uc = u.openConnection(); + uc.addRequestProperty("User-Agent", "Java"); + return uc.getInputStream(); } public Resource createRelative(String relativeResourcePath) throws IOException { From b86fce6f411e775ae965145b1cb19ecf8e5a9b39 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 15:41:14 +0300 Subject: [PATCH 02/30] pom new locations --- pom.xml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 70324cf..26d86a3 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,13 @@ 4.0.0 - org.lesscss + ru.send-to.less lesscss - 1.7.0.1.2-SNAPSHOT + 1.7.0.1.1-SNAPSHOT jar - Official LESS CSS Compiler for Java - Official LESS CSS Compiler for Java - http://github.com/marceloverdijk/lesscss-java + Fork of official LESS CSS Compiler for Java + Fork of official LESS CSS Compiler for Java with codepen.io imports + http://github.com/nleva/lesscss-java org.sonatype.oss @@ -242,15 +242,10 @@ - - GitHub - http://github.com/marceloverdijk/lesscss-java/issues - - - scm:git:git@github.com:marceloverdijk/lesscss-java.git - scm:git:git@github.com:marceloverdijk/lesscss-java.git - http://github.com/marceloverdijk/lesscss-java + scm:git:git@github.com:nleva/lesscss-java.git + scm:git:git@github.com:nleva/lesscss-java.git + http://github.com/nleva/lesscss-java From 638d8a5798df935541fbfa3cbc25a361a11767fe Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 16:33:33 +0300 Subject: [PATCH 03/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 26d86a3..6609737 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -29,7 +29,7 @@ junit junit - 4.10 + 4.12 test @@ -40,20 +40,20 @@ org.mockito - mockito-core - 1.9.0 + mockito-all + 1.10.19 test org.powermock powermock-module-junit4 - 1.4.11 + 1.6.6 test org.powermock powermock-api-mockito - 1.4.11 + 1.6.6 test @@ -86,12 +86,12 @@ org.apache.maven.plugins maven-surefire-plugin - 2.17 + 2.19.1 org.apache.maven.surefire surefire-junit47 - 2.17 + 2.19.1 From 4ebedc17bc80f46907a754c853347de987693213 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 16:43:42 +0300 Subject: [PATCH 04/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6609737..bd988e3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From e26772bbedb0cb8816ab0b022068fce368cdb67f Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 16:45:34 +0300 Subject: [PATCH 05/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bd988e3..6609737 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From d6ae92e7c65f44580e22c414b60606fdd854a8e0 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 16:57:36 +0300 Subject: [PATCH 06/30] pom --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 6609737..e2f5277 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -243,8 +243,8 @@ - scm:git:git@github.com:nleva/lesscss-java.git - scm:git:git@github.com:nleva/lesscss-java.git + scm:git:https://github.com/nleva/lesscss-java.git + scm:git:https://github.com/nleva/lesscss-java.git http://github.com/nleva/lesscss-java From 32a9fc69e98f3114094c127e9f644b9a0ae0972b Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 16:59:22 +0300 Subject: [PATCH 07/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e2f5277..f6d7105 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 4f1be43546d5dda18c49fc47605e85b7168bff58 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:12:09 +0300 Subject: [PATCH 08/30] pom --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e2f5277..79a0dd2 100644 --- a/pom.xml +++ b/pom.xml @@ -243,9 +243,9 @@ - scm:git:https://github.com/nleva/lesscss-java.git - scm:git:https://github.com/nleva/lesscss-java.git - http://github.com/nleva/lesscss-java + https://github.com/nleva/lesscss-java + scm:git:https://github.com/nleva/lesscss-java.git + scm:git:https://github.com/nleva/lesscss-java.git From c1e65ffc81d7fee1a22c8f3e1bc9d0e7478fb039 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:17:53 +0300 Subject: [PATCH 09/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f6d7105..e2f5277 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 9e65c8af1e1bd696d132c2a7d26a06d91ab4bbac Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:20:49 +0300 Subject: [PATCH 10/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 79a0dd2..41185f9 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From fbfa7bb27d4b8dcd28535e1bb02a982a75f7cbc4 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:24:45 +0300 Subject: [PATCH 11/30] pom --- pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 41185f9..9ba182f 100644 --- a/pom.xml +++ b/pom.xml @@ -211,6 +211,7 @@ + marceloverdijk Marcel Overdijk @@ -240,6 +241,13 @@ 0 + + nleva + Lev Nadeinsky + n.lev.a@ya.ru + +3 + + From e1c5e79d67bd0f8a59893bccbce851823893c982 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:26:09 +0300 Subject: [PATCH 12/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba182f..72ed360 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 5ee9bba54bd61b3f38d6ee34539c3ae6e4423e53 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 17:38:01 +0300 Subject: [PATCH 13/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72ed360..9ba182f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 03bfb5d555ff27e70ae681fb539c5f742e0160d4 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 19:34:29 +0300 Subject: [PATCH 14/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba182f..72ed360 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 7c4f5b064e63b2e42131bba60a206690b6f41039 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 19:36:24 +0300 Subject: [PATCH 15/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72ed360..9ba182f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 02227e0213e0748f48f4136931108ea92dbf2aa6 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 20:32:10 +0300 Subject: [PATCH 16/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba182f..72ed360 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From ee4221df0317e5e9167b9b52533b4f6fe1c70598 Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 20:33:45 +0300 Subject: [PATCH 17/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72ed360..9ba182f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1-SNAPSHOT + 1.7.0.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From 3529596e5eb06e04682a33aea873d90fc1760c8c Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 20:35:58 +0300 Subject: [PATCH 18/30] pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9ba182f..20b8c7d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1 + 1.7.0.1.1.1-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From ece775de84cd791bbb5e56a3b56d7bc58888921b Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 20:37:21 +0300 Subject: [PATCH 19/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 20b8c7d..aae7db3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.1-SNAPSHOT + 1.7.0.1.1.1 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From c649358549e75b3251d6e3d3da8e252dbf34c46e Mon Sep 17 00:00:00 2001 From: nleva Date: Tue, 27 Dec 2016 20:37:29 +0300 Subject: [PATCH 20/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aae7db3..afe730a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.1 + 1.7.0.1.1.2-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports From c1f540eed0d793411ebe7688540135feb6aa46aa Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 14:58:44 +0300 Subject: [PATCH 21/30] simple urls cache --- pom.xml | 14 +- src/main/java/org/lesscss/HttpResource.java | 154 ++++++++++++------ src/test/java/org/lesscss/LessSourceTest.java | 6 + 3 files changed, 117 insertions(+), 57 deletions(-) diff --git a/pom.xml b/pom.xml index afe730a..ea0bac8 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ commons-io commons-io - 2.4 + 2.5 junit @@ -98,17 +98,17 @@ org.apache.maven.plugins maven-compiler-plugin - 2.3.2 + 3.6.0 UTF-8 - 1.5 - 1.5 + 1.8 + 1.8 org.apache.maven.plugins maven-failsafe-plugin - 2.16 + 2.19.1 @@ -121,7 +121,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.8 + 2.10.4 UTF-8 ${basedir}/src/main/javadoc/stylesheet.css @@ -139,7 +139,7 @@ org.apache.maven.plugins maven-source-plugin - 2.1.2 + 3.0.1 javadoc-jar diff --git a/src/main/java/org/lesscss/HttpResource.java b/src/main/java/org/lesscss/HttpResource.java index 13934dd..e96b9ce 100644 --- a/src/main/java/org/lesscss/HttpResource.java +++ b/src/main/java/org/lesscss/HttpResource.java @@ -1,62 +1,116 @@ package org.lesscss; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; +import java.nio.ByteBuffer; +import java.nio.file.Files; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; public class HttpResource implements Resource { - URI url; - - public HttpResource(String url) throws URISyntaxException { - this.url = new URI( url ); - } - - public HttpResource(URI url) { - this.url = url; - } - - public boolean exists() { - try { - URL u = url.toURL(); - URLConnection connection = u.openConnection(); - connection.connect(); - return true; - } catch (IOException e) { - return false; - } - } - - public long lastModified() { - try { - URL u = url.toURL(); - URLConnection connection = u.openConnection(); - return connection.getLastModified(); - } catch( IOException e ) { - return 0; - } - } - - public InputStream getInputStream() throws IOException { - - URL u = url.toURL(); - URLConnection uc = u.openConnection(); - uc.addRequestProperty("User-Agent", "Java"); - return uc.getInputStream(); - } - - public Resource createRelative(String relativeResourcePath) throws IOException { - try { - return new HttpResource(url.resolve(new URI(relativeResourcePath))); - } catch (URISyntaxException e) { - throw (IOException)new IOException( "Could not resolve " + url + " against " + relativeResourcePath ).initCause(e); - } - } - - public String getName() { - return url.toASCIIString(); - } + private static final String LESSCSS_FOLDER = "/.lesscss/"; + URI url; + + public HttpResource(String url) throws URISyntaxException { + this.url = new URI(url); + } + + public HttpResource(URI url) { + this.url = url; + } + + public boolean exists() { + try { + URL u = url.toURL(); + URLConnection connection = u.openConnection(); + connection.connect(); + return true; + } catch (IOException e) { + return false; + } + } + + public long lastModified() { + try { + URL u = url.toURL(); + URLConnection connection = u.openConnection(); + return connection.getLastModified(); + } catch (IOException e) { + return 0; + } + } + + public InputStream getInputStream() throws IOException { + + URL u = url.toURL(); + String proto = u.getProtocol(); + switch (proto.toLowerCase()) { + case "http": + case "https": + return getFromCache(u); + default: + break; + } + return u.openStream(); + } + + private InputStream getFromCache(URL u) throws IOException { + System.out.println(u); + String fileName = u.getHost()+"/"+u.getFile(); + String home = System.getProperty("user.home"); + final String pathname = home + LESSCSS_FOLDER + fileName; + File file = new File(pathname); + String etag = ""; + try { + final byte[] attribute = (byte[]) Files.getAttribute(file.toPath(), "user:ETag"); + etag = new String(attribute) + ""; + } catch (Exception notImportant) { +// e.printStackTrace(); + } + HttpURLConnection uc = (HttpURLConnection) u.openConnection(); + uc.addRequestProperty("User-Agent", "Java.LesscssCompiler"); + + swapToFile(file, uc, etag); + return new FileInputStream(file); + } + + private void swapToFile(File file, HttpURLConnection uc, String etag) + throws IOException, FileNotFoundException { + uc.addRequestProperty("If-None-Match", etag); + if (uc.getResponseCode() == 304) { + return; + } + String newEtag = uc.getHeaderField("ETag"); + InputStream is = uc.getInputStream(); + + final FileOutputStream output = FileUtils.openOutputStream(file, false); + IOUtils.copy(is, output, 65535); + output.close(); + + Files.setAttribute(file.toPath(), "user:ETag", ByteBuffer.wrap(newEtag.getBytes())); + } + + public Resource createRelative(String relativeResourcePath) throws IOException { + try { + return new HttpResource(url.resolve(new URI(relativeResourcePath))); + } catch (URISyntaxException e) { + throw (IOException) new IOException("Could not resolve " + url + " against " + relativeResourcePath) + .initCause(e); + } + } + + public String getName() { + return url.toASCIIString(); + } } diff --git a/src/test/java/org/lesscss/LessSourceTest.java b/src/test/java/org/lesscss/LessSourceTest.java index 8d18a4d..3b500b5 100644 --- a/src/test/java/org/lesscss/LessSourceTest.java +++ b/src/test/java/org/lesscss/LessSourceTest.java @@ -71,6 +71,12 @@ public void setUp() throws Exception { sourceFile = new File(sourceUrl.getFile()); } + @Test + public void testHttpResourceCaching() throws Exception { + HttpResource resource = new HttpResource("http://codepen.io/OldMan/pen/QGooEg.less"); + System.out.println(resource.getInputStream().available()); + } + @Test public void testNewLessSourceWithoutImports() throws Exception { From 0466bd1fb54f5df13c4f7d73550ee84f954fd7ff Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 15:00:41 +0300 Subject: [PATCH 22/30] code 304 to use cache --- src/main/java/org/lesscss/HttpResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/lesscss/HttpResource.java b/src/main/java/org/lesscss/HttpResource.java index e96b9ce..a1bbdc5 100644 --- a/src/main/java/org/lesscss/HttpResource.java +++ b/src/main/java/org/lesscss/HttpResource.java @@ -88,7 +88,7 @@ private InputStream getFromCache(URL u) throws IOException { private void swapToFile(File file, HttpURLConnection uc, String etag) throws IOException, FileNotFoundException { uc.addRequestProperty("If-None-Match", etag); - if (uc.getResponseCode() == 304) { + if (uc.getResponseCode() != 304) { return; } String newEtag = uc.getHeaderField("ETag"); From 16cd3a9fd96fa67382f6047f3d4f996321da1325 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 15:14:38 +0300 Subject: [PATCH 23/30] pom versions update --- pom.xml | 4 ++-- src/test/java/org/lesscss/LessSourceTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ea0bac8..198e4e8 100644 --- a/pom.xml +++ b/pom.xml @@ -153,7 +153,7 @@ org.codehaus.mojo animal-sniffer-maven-plugin - 1.8 + 1.15 test @@ -165,7 +165,7 @@ org.codehaus.mojo.signature - java15 + java18 1.0 diff --git a/src/test/java/org/lesscss/LessSourceTest.java b/src/test/java/org/lesscss/LessSourceTest.java index 3b500b5..73359ae 100644 --- a/src/test/java/org/lesscss/LessSourceTest.java +++ b/src/test/java/org/lesscss/LessSourceTest.java @@ -71,7 +71,7 @@ public void setUp() throws Exception { sourceFile = new File(sourceUrl.getFile()); } - @Test +// @Test public void testHttpResourceCaching() throws Exception { HttpResource resource = new HttpResource("http://codepen.io/OldMan/pen/QGooEg.less"); System.out.println(resource.getInputStream().available()); From 1ca4d275b8ee7f765801ce1746851f3febabfe29 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 22:02:51 +0300 Subject: [PATCH 24/30] release plugin --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index 198e4e8..96655b3 100644 --- a/pom.xml +++ b/pom.xml @@ -83,6 +83,18 @@ + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + + lesscss-java/target/** + + + org.apache.maven.plugins maven-surefire-plugin From 1c385cf96fb4f10b13cdc6895003c97ff2cfc993 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 22:48:54 +0300 Subject: [PATCH 25/30] pom --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 96655b3..f5525d8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.2-SNAPSHOT + 1.7.0.1.1.3-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -266,6 +266,7 @@ https://github.com/nleva/lesscss-java scm:git:https://github.com/nleva/lesscss-java.git scm:git:https://github.com/nleva/lesscss-java.git - + lesscss-1.7.0.1.1.2 + From 580fe5ae836f2b11aa7f2497af0a5a3e6a3329f6 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 22:51:13 +0300 Subject: [PATCH 26/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1.3 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index f5525d8..a646e08 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.3-SNAPSHOT + 1.7.0.1.1.3 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -266,7 +266,7 @@ https://github.com/nleva/lesscss-java scm:git:https://github.com/nleva/lesscss-java.git scm:git:https://github.com/nleva/lesscss-java.git - lesscss-1.7.0.1.1.2 + lesscss-1.7.0.1.1.3 From 74d8ffda76a9bc230b6315a3135bd7ada6c955d0 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 22:51:22 +0300 Subject: [PATCH 27/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a646e08..9e3f3a5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.3 + 1.7.0.1.1.4-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -266,7 +266,7 @@ https://github.com/nleva/lesscss-java scm:git:https://github.com/nleva/lesscss-java.git scm:git:https://github.com/nleva/lesscss-java.git - lesscss-1.7.0.1.1.3 + lesscss-1.7.0.1.1.2 From e4e0ba006f0482bc5f95291683f9236eda97a8b9 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 23:20:55 +0300 Subject: [PATCH 28/30] 304 code fix --- src/main/java/org/lesscss/HttpResource.java | 3 ++- src/test/java/org/lesscss/LessSourceTest.java | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/lesscss/HttpResource.java b/src/main/java/org/lesscss/HttpResource.java index a1bbdc5..49cdaf5 100644 --- a/src/main/java/org/lesscss/HttpResource.java +++ b/src/main/java/org/lesscss/HttpResource.java @@ -82,13 +82,14 @@ private InputStream getFromCache(URL u) throws IOException { uc.addRequestProperty("User-Agent", "Java.LesscssCompiler"); swapToFile(file, uc, etag); + return new FileInputStream(file); } private void swapToFile(File file, HttpURLConnection uc, String etag) throws IOException, FileNotFoundException { uc.addRequestProperty("If-None-Match", etag); - if (uc.getResponseCode() != 304) { + if (uc.getResponseCode() == 304) { return; } String newEtag = uc.getHeaderField("ETag"); diff --git a/src/test/java/org/lesscss/LessSourceTest.java b/src/test/java/org/lesscss/LessSourceTest.java index 73359ae..8d2f00f 100644 --- a/src/test/java/org/lesscss/LessSourceTest.java +++ b/src/test/java/org/lesscss/LessSourceTest.java @@ -74,7 +74,9 @@ public void setUp() throws Exception { // @Test public void testHttpResourceCaching() throws Exception { HttpResource resource = new HttpResource("http://codepen.io/OldMan/pen/QGooEg.less"); + System.out.println(resource.getInputStream().available()); + assertEquals(true, true); } @Test From 0296bfc5a44ef94a0af7921b6d14b9c4c15b15b4 Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 23:22:46 +0300 Subject: [PATCH 29/30] [maven-release-plugin] prepare release lesscss-1.7.0.1.1.4 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 9e3f3a5..55ccfe9 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.4-SNAPSHOT + 1.7.0.1.1.4 jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -266,7 +266,7 @@ https://github.com/nleva/lesscss-java scm:git:https://github.com/nleva/lesscss-java.git scm:git:https://github.com/nleva/lesscss-java.git - lesscss-1.7.0.1.1.2 + lesscss-1.7.0.1.1.4 From f51a63af85bbf342bb79efa6f2d2e1ebcbd4e8ff Mon Sep 17 00:00:00 2001 From: nleva Date: Thu, 29 Dec 2016 23:22:52 +0300 Subject: [PATCH 30/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 55ccfe9..05f1d16 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 ru.send-to.less lesscss - 1.7.0.1.1.4 + 1.7.0.1.1.5-SNAPSHOT jar Fork of official LESS CSS Compiler for Java Fork of official LESS CSS Compiler for Java with codepen.io imports @@ -266,7 +266,7 @@ https://github.com/nleva/lesscss-java scm:git:https://github.com/nleva/lesscss-java.git scm:git:https://github.com/nleva/lesscss-java.git - lesscss-1.7.0.1.1.4 + lesscss-1.7.0.1.1.2