diff --git a/.mvn_exec_node b/.mvn_exec_node
new file mode 100644
index 0000000..e69de29
diff --git a/package.json b/package.json
index 6c551aa..1f02bbc 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,9 @@
"remark-preset-lint-recommended": "6.1.3"
},
"scripts": {
- "lint-md": "remark ."
+ "lint-md": "remark .",
+ "mvnbuild": "",
+ "mvntest": ""
},
"remarkConfig": {
"plugins": [
diff --git a/pom.xml b/pom.xml
index a2fd917..ceb62fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
org.jvnet.hudson.plugins
analysis-pom
- 6.10.0
+ 6.12.0
@@ -119,33 +119,6 @@
-
- com.github.eirslett
- frontend-maven-plugin
- 1.13.4
-
-
- install node and npm
-
- install-node-and-npm
-
- generate-resources
-
- v18.12.0
-
-
-
- npm install
-
- npm
-
- generate-resources
-
- install
-
-
-
-
org.apache.maven.plugins
maven-resources-plugin
diff --git a/release.sh b/release.sh
new file mode 100755
index 0000000..a6af542
--- /dev/null
+++ b/release.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+git pull
+git push
+mvn -B clean release:prepare release:perform
diff --git a/src/main/java/io/jenkins/plugins/fontawesome/FontAwesomeIcons.java b/src/main/java/io/jenkins/plugins/fontawesome/FontAwesomeIcons.java
index 2ed7803..997d5a6 100644
--- a/src/main/java/io/jenkins/plugins/fontawesome/FontAwesomeIcons.java
+++ b/src/main/java/io/jenkins/plugins/fontawesome/FontAwesomeIcons.java
@@ -1,25 +1,36 @@
package io.jenkins.plugins.fontawesome;
-import edu.umd.cs.findbugs.annotations.CheckForNull;
-import org.apache.commons.lang3.StringUtils;
-
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.nio.file.*;
-import java.util.*;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;
+import org.apache.commons.lang3.StringUtils;
+
+import edu.umd.cs.findbugs.annotations.CheckForNull;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
+import io.jenkins.plugins.fontawesome.SvgTag.FontAwesomeStyle;
+
/**
* Utility to work with icons provided by the font-awesome-api-plugin.
*
* @author strangelookingnerd
*/
public final class FontAwesomeIcons {
-
private static final Logger LOGGER = Logger.getLogger(FontAwesomeIcons.class.getName());
private static final String SVG_FILE_ENDING = ".svg";
private static final String IMAGES_SYMBOLS_PATH = "images/symbols/";
@@ -29,7 +40,9 @@ public final class FontAwesomeIcons {
/**
* Takes an icon name and generates an icon class name from it.
*
- * @param icon the icon name
+ * @param icon
+ * the icon name
+ *
* @return the icon class name
*/
public static String getIconClassName(final String icon) {
@@ -39,8 +52,7 @@ public static String getIconClassName(final String icon) {
/**
* Get all available icons provided by the font-awesome-api-plugin.
*
- * @return a sorted map of available icons with icon name as key and the icon
- * class name as value.
+ * @return a sorted map of available icons with icon name as key and the icon class name as value.
*/
public static Map getAvailableIcons() {
return getAvailableIcons(null);
@@ -49,15 +61,17 @@ public static Map getAvailableIcons() {
/**
* Get all available icons provided by the font-awesome-api-plugin filtered by their style.
*
- * @param filter the style to filter
- * @return a sorted map of available icons with icon name as key and the icon
- * class name as value filtered by the given style.
+ * @param filter
+ * the style to filter
+ *
+ * @return a sorted map of available icons with icon name as key and the icon class name as value filtered by the
+ * given style.
*/
- public static Map getAvailableIcons(final SvgTag.FontAwesomeStyle filter) {
+ public static Map getAvailableIcons(@CheckForNull final FontAwesomeStyle filter) {
return getIconsFromClasspath(filter);
}
- private static Map getIconsFromClasspath(final SvgTag.FontAwesomeStyle filter) {
+ private static Map getIconsFromClasspath(@CheckForNull final FontAwesomeStyle filter) {
try {
Enumeration urls = FontAwesomeIcons.class.getClassLoader().getResources(IMAGES_SYMBOLS_PATH);
@@ -85,18 +99,23 @@ private static Map getIconsFromClasspath(final SvgTag.FontAwesom
return new LinkedHashMap<>();
}
- private static Map collectIcons(final Path path, @CheckForNull final SvgTag.FontAwesomeStyle filter) throws IOException {
+ @SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
+ private static Map collectIcons(
+ @CheckForNull final Path path, @CheckForNull final FontAwesomeStyle filter) throws IOException {
Map icons = new LinkedHashMap<>();
if (path != null) {
- try (Stream stream = filter == null ? Files.walk(path, 2) : Files.walk(path.resolve(filter.name().toLowerCase(Locale.ENGLISH)), 1)) {
- stream.filter(icon -> icon != null && icon.getFileName() != null && StringUtils.endsWith(icon.getFileName().toString(), SVG_FILE_ENDING))
+ try (Stream stream = findIcons(path, filter)) {
+ stream.filter(icon -> icon != null && icon.getFileName() != null && StringUtils.endsWith(
+ icon.getFileName().toString(), SVG_FILE_ENDING))
.sorted().forEach(icon -> {
- if (icon.getParent() != null && icon.getParent().getFileName() != null && icon.getFileName() != null) {
- String iconName = icon.getParent().getFileName() + "/" + StringUtils.removeEnd(icon.getFileName().toString(), SVG_FILE_ENDING);
- icons.put(iconName, getIconClassName(iconName));
- }
- }
+ if (icon.getParent() != null && icon.getParent().getFileName() != null
+ && icon.getFileName() != null) {
+ String iconName = icon.getParent().getFileName() + "/" + StringUtils.removeEnd(
+ icon.getFileName().toString(), SVG_FILE_ENDING);
+ icons.put(iconName, getIconClassName(iconName));
+ }
+ }
);
}
}
@@ -104,8 +123,15 @@ private static Map collectIcons(final Path path, @CheckForNull
return icons;
}
+ private static Stream findIcons(final Path path, @CheckForNull final FontAwesomeStyle filter) throws IOException {
+ if (filter == null) {
+ return Files.walk(path, 2);
+ }
+
+ return Files.walk(path.resolve(filter.name().toLowerCase(Locale.ENGLISH)), 1);
+ }
+
private FontAwesomeIcons() {
// hidden
}
-
}