removed pnews module
authorJean-Philippe Orsini <orsinije@fr.ibm.com>
Sun, 15 Oct 2017 19:03:39 +0000 (21:03 +0200)
committerJean-Philippe Orsini <orsinije@fr.ibm.com>
Sun, 15 Oct 2017 19:03:39 +0000 (21:03 +0200)
13 files changed:
pnews/.gitignore [deleted file]
pnews/pom.xml [deleted file]
pnews/run.sh [deleted file]
pnews/src/main/java/pnews/Article.java [deleted file]
pnews/src/main/java/pnews/Category.java [deleted file]
pnews/src/main/java/pnews/HTML.java [deleted file]
pnews/src/main/resources/style.css [deleted file]
pnews/src/main/scripts/pnews.sh [deleted file]
war/pom.xml
war/src/main/java/pnews/Article.java [new file with mode: 0644]
war/src/main/java/pnews/Category.java [new file with mode: 0644]
war/src/main/java/pnews/HTML.java [new file with mode: 0644]
war/src/main/resources/style.css [new file with mode: 0644]

diff --git a/pnews/.gitignore b/pnews/.gitignore
deleted file mode 100644 (file)
index 2061c9e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-target
-.classpath
-.project
diff --git a/pnews/pom.xml b/pnews/pom.xml
deleted file mode 100644 (file)
index 89277c0..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project>
-        <modelVersion>4.0.0</modelVersion>
-        <groupId>pnews</groupId>
-        <artifactId>pnews-core</artifactId>
-        <version>1.0</version>
-        <packaging>jar</packaging>
-        <name>pnews-core</name>
-
-        <properties>
-                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-                <maven.compiler.source>1.7</maven.compiler.source>
-                <maven.compiler.target>1.7</maven.compiler.target>
-        </properties>
-
-        <dependencies>
-                <dependency>
-                        <groupId>com.rometools</groupId>
-                        <artifactId>rome</artifactId>
-                        <version>1.8.0</version>
-                </dependency>
-                <dependency>
-                        <groupId>org.jsoup</groupId>
-                        <artifactId>jsoup</artifactId>
-                        <version>1.10.3</version>
-                </dependency>
-        </dependencies>
-
-        <build>
-                <plugins>
-                        <plugin>
-                                <groupId>org.apache.maven.plugins</groupId>
-                                <artifactId>maven-dependency-plugin</artifactId>
-                                <version>2.10</version>
-                                <executions>
-                                        <execution>
-                                                <id>copy-dependencies</id>
-                                                <phase>package</phase>
-                                                <goals>
-                                                        <goal>copy-dependencies</goal>
-                                                </goals>
-                                                <configuration>
-                                                        <outputDirectory>${project.build.directory}</outputDirectory>
-                                                        <overWriteReleases>false</overWriteReleases>
-                                                </configuration>
-                                        </execution>
-                                </executions>
-                        </plugin>
-                        <plugin>
-                                <artifactId>maven-resources-plugin</artifactId>
-                                <version>3.0.1</version>
-                                <executions>
-                                        <execution>
-                                                <id>copy-resources</id>
-                                                <phase>process-resources</phase>
-                                                <goals>
-                                                        <goal>copy-resources</goal>
-                                                </goals>
-                                                <configuration>
-                                                        <outputDirectory>${basedir}/target/</outputDirectory>
-                                                        <resources>
-                                                                <resource>
-                                                                        <directory>src/main/scripts</directory>
-                                                                        <filtering>true</filtering>
-                                                                </resource>
-                                                        </resources>
-                                                </configuration>
-                                        </execution>
-                                </executions>
-                        </plugin>
-                        <plugin>
-                                <groupId>org.apache.maven.plugins</groupId>
-                                <artifactId>maven-jar-plugin</artifactId>
-                                <version>3.0.2</version>
-                                <configuration>
-                                        <archive>
-                                                <manifest>
-                                                        <addClasspath>true</addClasspath>
-                                                        <mainClass>pnews.Main</mainClass>
-                                                </manifest>
-                                        </archive>
-                                </configuration>
-                        </plugin>
-                        <plugin>
-                                <groupId>org.apache.maven.plugins</groupId>
-                                <artifactId>maven-antrun-plugin</artifactId>
-                                <version>1.6</version>
-                                <executions>
-                                        <execution>
-                                                <id>fix-shell-permissions</id>
-                                                <phase>process-resources</phase>
-                                                <configuration>
-                                                        <target>
-                                                                <chmod file="target/pnews.sh" perm="755"/>
-                                                        </target>
-                                                </configuration>
-                                                <goals>
-                                                        <goal>run</goal>
-                                                </goals>
-                                        </execution>
-                                </executions>
-                        </plugin>
-                </plugins>
-          </build>
-</project>
diff --git a/pnews/run.sh b/pnews/run.sh
deleted file mode 100755 (executable)
index ede7e9b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-
-set -e
-
-DEST_DIR=`realpath $1`
-TMP_DIR="/tmp/$$.tmp"
-
-mkdir -p "$TMP_DIR"
-
-cd $TMP_DIR
-git clone https://git.wpitchoune.net/pnews.git
-
-cd pnews
-
-mvn clean install
-
-target/pnews.sh
-
-cp -p *html style.css $DEST_DIR
-
-rm -rf "$TMP_DIR"
diff --git a/pnews/src/main/java/pnews/Article.java b/pnews/src/main/java/pnews/Article.java
deleted file mode 100644 (file)
index 0b54205..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package pnews;
-
-import java.util.Date;
-
-public class Article {
-        public final String title;
-        public final String description;
-        public final String thumbnail;
-        public final String link;
-        public final Category category;
-        public final Date publicationDate;
-        public final String website;
-        
-        public Article(String link, Category category, String title, String description, String thumbnail, Date publicationDate, String website) {
-                this.link = link;
-                this.title = title;
-                this.description = description;
-                this.thumbnail = thumbnail;
-                this.category = category;
-                this.publicationDate = publicationDate;
-                this.website = website;
-        }
-}
diff --git a/pnews/src/main/java/pnews/Category.java b/pnews/src/main/java/pnews/Category.java
deleted file mode 100644 (file)
index 7a8106f..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package pnews;
-
-public enum Category {
-        TOP("top"),
-        FRANCE("france"),
-        SPORT("sport"),
-        EUROPE("europe"),
-        ECO("eco"),
-        ESSONNE("essonne"),
-        TECHNOLOGIE("technologie"),
-        PEOPLE("people");
-        
-        private final String id;
-                
-        private Category(String id) {
-                this.id = id;
-        }
-        
-        public String getId() {
-                return id;
-        }
-}
diff --git a/pnews/src/main/java/pnews/HTML.java b/pnews/src/main/java/pnews/HTML.java
deleted file mode 100644 (file)
index 74df5e7..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-package pnews;
-
-import java.util.List;
-
-public class HTML {
-       private static void appendA(StringBuffer buf, String child, String href, String cl) {
-               buf.append("<a href='");
-               buf.append(href);
-               buf.append("'");
-               if (cl != null) {
-                       buf.append(" class='");
-                       buf.append(cl);
-                       buf.append('\'');
-               }
-               buf.append('>');
-               buf.append(child);
-               buf.append("</a>");
-       }
-       
-       private static void appendDiv(StringBuffer buf, String child) {
-               buf.append("<div>");
-               buf.append(child);
-               buf.append("</div>\n");
-       }
-       
-       private static void appendP(StringBuffer buf, String child) {
-               buf.append("<p>");
-               buf.append(child);
-               buf.append("</p>\n");
-       }
-       
-       private static void append(StringBuffer buf, Article a) {               
-               buf.append("<div class='article'>\n");
-               
-               buf.append("<h2>");
-               if (a.thumbnail != null) {
-                       buf.append("<img class='left' src='");
-                       buf.append(a.thumbnail);
-                       buf.append("'/>\n");
-               }
-               appendA(buf, a.title, "redirect?url="+a.link, null);
-               buf.append("</h2>\n");
-               
-               buf.append("<div class='article-info'>" + a.website + " - " + a.publicationDate + "</div>");
-               
-               if (a.description != null) {
-                       buf.append("<p>");
-                       buf.append(a.description);
-                       buf.append("</p>");
-               }
-               
-               buf.append("</div>\n");         
-       }
-       
-       private static void appendMenu(StringBuffer buf, Category catActive) {
-               String cl;
-               
-               buf.append("<nav>\n");
-               buf.append("<ul>\n");
-
-               for (Category cat: Category.values()) {
-                       buf.append("<li>");
-                       
-                       if (cat.equals(catActive))
-                               cl = "active";
-                       else
-                               cl = null;
-                       
-                       appendA(buf, cat.getId(), cat.getId(), cl);
-                       buf.append("</li>");
-               }
-               
-               buf.append("</ul>\n");
-               buf.append("</nav>\n");
-       }
-       
-       public static String toHTML(List<Article> articles, Category catActive) {
-               StringBuffer buf;
-               
-               buf = new StringBuffer();
-               buf.append("<!DOCTYPE html>\n");
-               buf.append("<html lang='fr'>\n");
-               buf.append("<head>\n");
-               buf.append("<meta charset=\"UTF-8\">\n");
-               buf.append("<link rel='stylesheet' href='style.css' />\n");
-               buf.append("<title>PNews</title>\n");
-               buf.append("</head>\n");
-               buf.append("<body>\n");
-               
-               appendMenu(buf, catActive);
-               
-               for (Article e: articles)
-                       append(buf, e);
-               
-               buf.append("</body>\n");
-               buf.append("</html>\n");
-       
-               return buf.toString();
-       }
-}
diff --git a/pnews/src/main/resources/style.css b/pnews/src/main/resources/style.css
deleted file mode 100644 (file)
index 85a880d..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-a {
-        text-decoration: none;
-        color: black;
-}
-
-body {
-        margin: 0 0 0 0;
-        padding: 1em 1em 1em 1em;
-        background-color: #eee;
-        font-family: sans-serif;
-}
-
-nav {
-        font-size: 125%;
-        margin: 0 0 0 0;
-        padding: 0 0 0 0;
-}
-
-a.active {
-        text-decoration: none;
-        border-bottom: 4px solid black;
-}
-
-div {
-        margin: 0em 0em 0em 0em;
-        padding: 0 0 0 0;
-}
-
-div.article {
-        margin-bottom: 1em;
-}
-
-.article-info {
-        font-size: 80%;
-        color: #bbb;
-}
-
-img {
-        margin: 0em 1em 1em 0em;
-        padding: 0 0 0 0;
-        width: 8em;
-}
-
-p {
-        margin: 1em 1em 1em 1em;
-        padding: 0 0 0 0;
-}
-
-.left {
-        float: left;
-}
-
-h2 {
-        clear: left;
-        margin: 0 0 0 0;
-        padding: 0 0 0 0;
-}
-
-nav ul {
-        list-style-type: none;
-        padding: 0 0 0 0;
-}
-
-nav ul li {
-        display: inline;
-        margin: 0em 1em 0 0;
-        padding: 0 0 0 0;
-        text-transform: uppercase;
-}
diff --git a/pnews/src/main/scripts/pnews.sh b/pnews/src/main/scripts/pnews.sh
deleted file mode 100755 (executable)
index fbad98b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -e
-
-SDIR=`dirname $0`
-
-java -classpath rome-1.8.0.jar -jar $SDIR/pnews-1.0.jar
index 379bbc3..3b1f825 100644 (file)
                         <scope>provided</scope>
                 </dependency>
                 <dependency>
-                        <groupId>pnews</groupId>
-                        <artifactId>pnews-core</artifactId>
-                        <version>1.0</version>
-                </dependency>
-                <dependency>
                         <groupId>com.rometools</groupId>
                         <artifactId>rome</artifactId>
                         <version>1.8.0</version>
diff --git a/war/src/main/java/pnews/Article.java b/war/src/main/java/pnews/Article.java
new file mode 100644 (file)
index 0000000..0b54205
--- /dev/null
@@ -0,0 +1,23 @@
+package pnews;
+
+import java.util.Date;
+
+public class Article {
+        public final String title;
+        public final String description;
+        public final String thumbnail;
+        public final String link;
+        public final Category category;
+        public final Date publicationDate;
+        public final String website;
+        
+        public Article(String link, Category category, String title, String description, String thumbnail, Date publicationDate, String website) {
+                this.link = link;
+                this.title = title;
+                this.description = description;
+                this.thumbnail = thumbnail;
+                this.category = category;
+                this.publicationDate = publicationDate;
+                this.website = website;
+        }
+}
diff --git a/war/src/main/java/pnews/Category.java b/war/src/main/java/pnews/Category.java
new file mode 100644 (file)
index 0000000..7a8106f
--- /dev/null
@@ -0,0 +1,22 @@
+package pnews;
+
+public enum Category {
+        TOP("top"),
+        FRANCE("france"),
+        SPORT("sport"),
+        EUROPE("europe"),
+        ECO("eco"),
+        ESSONNE("essonne"),
+        TECHNOLOGIE("technologie"),
+        PEOPLE("people");
+        
+        private final String id;
+                
+        private Category(String id) {
+                this.id = id;
+        }
+        
+        public String getId() {
+                return id;
+        }
+}
diff --git a/war/src/main/java/pnews/HTML.java b/war/src/main/java/pnews/HTML.java
new file mode 100644 (file)
index 0000000..74df5e7
--- /dev/null
@@ -0,0 +1,100 @@
+package pnews;
+
+import java.util.List;
+
+public class HTML {
+       private static void appendA(StringBuffer buf, String child, String href, String cl) {
+               buf.append("<a href='");
+               buf.append(href);
+               buf.append("'");
+               if (cl != null) {
+                       buf.append(" class='");
+                       buf.append(cl);
+                       buf.append('\'');
+               }
+               buf.append('>');
+               buf.append(child);
+               buf.append("</a>");
+       }
+       
+       private static void appendDiv(StringBuffer buf, String child) {
+               buf.append("<div>");
+               buf.append(child);
+               buf.append("</div>\n");
+       }
+       
+       private static void appendP(StringBuffer buf, String child) {
+               buf.append("<p>");
+               buf.append(child);
+               buf.append("</p>\n");
+       }
+       
+       private static void append(StringBuffer buf, Article a) {               
+               buf.append("<div class='article'>\n");
+               
+               buf.append("<h2>");
+               if (a.thumbnail != null) {
+                       buf.append("<img class='left' src='");
+                       buf.append(a.thumbnail);
+                       buf.append("'/>\n");
+               }
+               appendA(buf, a.title, "redirect?url="+a.link, null);
+               buf.append("</h2>\n");
+               
+               buf.append("<div class='article-info'>" + a.website + " - " + a.publicationDate + "</div>");
+               
+               if (a.description != null) {
+                       buf.append("<p>");
+                       buf.append(a.description);
+                       buf.append("</p>");
+               }
+               
+               buf.append("</div>\n");         
+       }
+       
+       private static void appendMenu(StringBuffer buf, Category catActive) {
+               String cl;
+               
+               buf.append("<nav>\n");
+               buf.append("<ul>\n");
+
+               for (Category cat: Category.values()) {
+                       buf.append("<li>");
+                       
+                       if (cat.equals(catActive))
+                               cl = "active";
+                       else
+                               cl = null;
+                       
+                       appendA(buf, cat.getId(), cat.getId(), cl);
+                       buf.append("</li>");
+               }
+               
+               buf.append("</ul>\n");
+               buf.append("</nav>\n");
+       }
+       
+       public static String toHTML(List<Article> articles, Category catActive) {
+               StringBuffer buf;
+               
+               buf = new StringBuffer();
+               buf.append("<!DOCTYPE html>\n");
+               buf.append("<html lang='fr'>\n");
+               buf.append("<head>\n");
+               buf.append("<meta charset=\"UTF-8\">\n");
+               buf.append("<link rel='stylesheet' href='style.css' />\n");
+               buf.append("<title>PNews</title>\n");
+               buf.append("</head>\n");
+               buf.append("<body>\n");
+               
+               appendMenu(buf, catActive);
+               
+               for (Article e: articles)
+                       append(buf, e);
+               
+               buf.append("</body>\n");
+               buf.append("</html>\n");
+       
+               return buf.toString();
+       }
+}
diff --git a/war/src/main/resources/style.css b/war/src/main/resources/style.css
new file mode 100644 (file)
index 0000000..85a880d
--- /dev/null
@@ -0,0 +1,69 @@
+a {
+        text-decoration: none;
+        color: black;
+}
+
+body {
+        margin: 0 0 0 0;
+        padding: 1em 1em 1em 1em;
+        background-color: #eee;
+        font-family: sans-serif;
+}
+
+nav {
+        font-size: 125%;
+        margin: 0 0 0 0;
+        padding: 0 0 0 0;
+}
+
+a.active {
+        text-decoration: none;
+        border-bottom: 4px solid black;
+}
+
+div {
+        margin: 0em 0em 0em 0em;
+        padding: 0 0 0 0;
+}
+
+div.article {
+        margin-bottom: 1em;
+}
+
+.article-info {
+        font-size: 80%;
+        color: #bbb;
+}
+
+img {
+        margin: 0em 1em 1em 0em;
+        padding: 0 0 0 0;
+        width: 8em;
+}
+
+p {
+        margin: 1em 1em 1em 1em;
+        padding: 0 0 0 0;
+}
+
+.left {
+        float: left;
+}
+
+h2 {
+        clear: left;
+        margin: 0 0 0 0;
+        padding: 0 0 0 0;
+}
+
+nav ul {
+        list-style-type: none;
+        padding: 0 0 0 0;
+}
+
+nav ul li {
+        display: inline;
+        margin: 0em 1em 0 0;
+        padding: 0 0 0 0;
+        text-transform: uppercase;
+}