diff --git a/.circleci/config.yml b/.circleci/config.yml
deleted file mode 100644
index b59dd67..0000000
--- a/.circleci/config.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-version: 2
-jobs:
- build:
- docker:
- - image: circleci/openjdk:8-jdk
-
- working_directory: ~/repo
-
- environment:
- JVM_OPTS: -Xmx3200m
- TERM: dumb
-
- steps:
- - checkout
- - restore_cache:
- keys:
- - kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
- # fallback to using the latest cache if no exact match is found
- - kobalt-dependencies-
-
- - run:
- name: Check Versions
- command: ./kobaltw checkVersions
-
- - save_cache:
- paths: ~/.kobalt
- key: kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
-
- - run:
- name: Assemble & Test
- command: ./kobaltw assemble test
-
- - store_artifacts:
- path: kobaltBuild/test-output/
- destination: test-output
- - store_test_results:
- path: kobaltBuild/test-output/
\ No newline at end of file
diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index 6ec2ae2..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,5 +0,0 @@
-# Set the default behavior, in case people don't have core.autocrlf set.
-* text=auto
-
-# batch files are specific to windows and always crlf
-*.bat eol=crlf
diff --git a/.gitignore b/.gitignore
index fbd6166..80a944b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,9 +4,8 @@
**/.idea/tasks.xml
**/.idea/workspace.xml
*.iws
-*.sublime-*
-.classpath
.DS_Store
+.classpath
.gradle
.kobalt
.nb-gradle
@@ -19,13 +18,12 @@
/example/libs
/gen
/gradle.properties
-/libs
/out
/proguard-project.txt
/project.properties
/target
/test-output
+Thumbs.db
ehthumbs.db
kobaltBuild
local.properties
-Thumbs.db
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
index 9480ac9..3423376 100644
--- a/.idea/copyright/profiles_settings.xml
+++ b/.idea/copyright/profiles_settings.xml
@@ -1,8 +1,5 @@
-
-
-
diff --git a/.idea/kobalt.xml b/.idea/kobalt.xml
index b117217..5bc4181 100644
--- a/.idea/kobalt.xml
+++ b/.idea/kobalt.xml
@@ -5,7 +5,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index 6b87c48..dd6ad28 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -3,6 +3,7 @@
+
diff --git a/.idea/scopes/Copyright.xml b/.idea/scopes/Copyright.xml
deleted file mode 100644
index 0727526..0000000
--- a/.idea/scopes/Copyright.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/scopes/Source.xml b/.idea/scopes/Source.xml
new file mode 100644
index 0000000..9f7d724
--- /dev/null
+++ b/.idea/scopes/Source.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
deleted file mode 100644
index e96534f..0000000
--- a/.idea/uiDesigner.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
-
- -
-
-
- -
-
-
-
-
-
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 6b6a336..aa9226e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,4 @@ cache:
- $HOME/.m2
- $HOME/.kobalt
-before_cache:
- - rm -rf .kobalt/*
-
-script: ./kobaltw clean assemble test
+script: ./kobaltw clean assemble
diff --git a/LICENSE.TXT b/LICENSE.TXT
index f30d392..84fe1dc 100644
--- a/LICENSE.TXT
+++ b/LICENSE.TXT
@@ -1,4 +1,4 @@
-Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
+Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
All rights reserved.
Redistribution and use in source and binary forms, with or without
diff --git a/README.md b/README.md
index 316d7cf..fddb4f6 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# VersionEye plug-in for [Kobalt](http://beust.com/kobalt/home/index.html)
-[](http://opensource.org/licenses/BSD-3-Clause) [](https://github.com/ethauvin/kobalt-versioneye/releases/latest) [](https://travis-ci.org/ethauvin/kobalt-versioneye) [](https://circleci.com/gh/ethauvin/kobalt-versioneye/tree/master) [ ](https://bintray.com/ethauvin/maven/kobalt-versioneye/_latestVersion)
+[](http://opensource.org/licenses/BSD-3-Clause) [](https://travis-ci.org/ethauvin/kobalt-versioneye) [ ](https://bintray.com/ethauvin/maven/kobalt-versioneye/_latestVersion)
-[](https://www.versioneye.com)
+[](https://www.versioneye.com)
The plug-in will create and update projects on [VersionEye](https://www.versioneye.com/), a service that notifies you about outdated dependencies, security vulnerabilities and license violations.
@@ -20,9 +20,9 @@ val p = project {
group = "com.example"
artifactId = name
version = "0.1"
-
+
versionEye {
-
+
}
}
```
@@ -30,7 +30,7 @@ val p = project {
To create or update your project on VersionEye, you will need an API key. If you are [signed up](https://www.versioneye.com/signup), you can find your API Key [here](https://www.versioneye.com/settings/api):
-[](https://www.versioneye.com/settings/api)
+[](https://www.versioneye.com/settings/api)
To create your project on VersionEye simply use your API Key as follows
@@ -90,17 +90,16 @@ versionEye {
The values are:
-| Value | Description | Default |
-| :----------- | :--------------------------------------------------------------------------------------------------------------------- | :---------------------------- |
-| `baseUrl` | For VersionEye Enterprise VM to use your own domain, e.g. `https://versioneye.my-company.com/` | `https://www.versioneye.com/` |
-| `colors` | To enable (`true`) or disable (`false`) colors in the plug-in output. | `true` |
-| `name` | The name of the VersionEye project, if none is specified the Kobalt project name will be used. | *none* |
-| `quiet` | To completely disable output from the plug-in. | `false` |
-| `org` | The VersionEye organization, if any. | *none* |
-| `pom` | Generate a [pom.xml](https://maven.apache.org/pom.html) for the project. See [Private vs. Public](#private-vs-public). | `false` |
-| `team` | The VersionEye team, if any. | *none* |
-| `verbose` | To enable or disable extra information in the plug-in output. | `true` |
-| `visibility` | To set the project's visibility on VersionEye, either `public` or `private` | `public` |
+| Value | Description | Default |
+| :----------- | :---------------------------------------------------------------------------------------------- | :---------------------------- |
+| `baseUrl` | For VersionEye Enterprise VM to use your own domain, e.g. `https://versioneye.my-company.com/` | `https://www.versioneye.com/` |
+| `colors` | To enable (`true`) or disable (`false`) colors in the plug-in output. | `true` |
+| `name` | The name of the VersionEye project, if none is specified the Kobalt project name will be used. | *none* |
+| `quiet` | To completely disable output from the plug-in. | `false` |
+| `org` | The VersionEye organization, if any. | *none* |
+| `team` | The VersionEye team, if any. | *none* |
+| `verbose` | To enable or disable extra information in the plug-in output. | `true` |
+| `visibility` | To set the project's visibility on VersionEye, either `public` or `private` | `public` |
Some of the parameters can be controlled temporarily from the command line, as follows:
@@ -127,27 +126,4 @@ versionEye {
| `Fail.dependenciesCheck` | Will triggered a failure on outdated dependencies. |
| `Fail.licensesUnknownCheck` | Will trigger a failure on unknown licenses. |
| `Fail.licensesCheck` | Will trigger a failure on licenses whitelist violations. Licenses and components whitelists can be configured on the [VersionEye](https://www.versioneye.com/) website. |
-| `Fail.securityCheck` | Will trigger a failure on known security vulnerabilities, on by default. |
-
-## Private vs. Public
-
-By default, projects created using the VersionEye API are private. If your project is hosted on [GitHub](https://github.com) or [BitBucket](https://bitbucket.org) and would like to make it public on VersionEye. The plug-in can generate a [pom](https://maven.apache.org/pom.html) file compatible with VersionEye, as follows:
-
-```
-versionEye {
- pom = true
-...
-}
-```
-
-and to generate the pom file, but **not** create a new project on VersionEye:
-
-```bash
-./kobaltw -Dve.create=false versionEye
-```
-
-Be sure to commit `pom.xml` on GitHub or BitBucket, and then import your project at:
-
- * https://www.versioneye.com/projects/new
-
-Finally, configure your [project key](#global-configuration).
\ No newline at end of file
+| `Fail.securityCheck` | Will trigger a failure on known security vulnerabilities, on by default. |
\ No newline at end of file
diff --git a/clean.sh b/clean.sh
deleted file mode 100644
index 552252d..0000000
--- a/clean.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-DEBUG=false
-
-rm="rm -rf"
-
-if [ "$DEBUG" = true ]; then
- rm="echo rm -rf"
-fi
-
-buildkt="kobalt/src/Build.kt"
-
-name=$(cat $buildkt | grep -m 1 "name = " | cut -d"\"" -f 2)
-group=$(cat $buildkt | grep -m 1 "group = " | cut -d"\"" -f 2)
-
-if [ -z "$1" ]; then
- version=$(cat $buildkt | grep -m 1 "version = " | cut -d"\"" -f 2)
-else
- version="$1"
-fi
-
-maven="/k/maven/repository/${group//.//}/${name}/${version}"
-kobalt="$HOME/.kobalt/cache/${group//.//}/${name}/${version}"
-localRepo="$HOME/.kobalt/localMavenRepo/${group//.//}/${name}/${version}"
-
-read -p "Delete version ${version}? " -n 1 -r
-echo
-if [[ $REPLY =~ ^[Yy]$ ]]; then
- for dir in "$kobalt" "$maven" "$localRepo"; do
- if [ -d "$dir" ]; then
- echo -e "Deleting : \e[32;1m$dir\e[0m"
- $rm "$dir"
- else
- echo -e "Not Found: \e[31;1m$dir\e[0m"
- fi
- done
-fi
\ No newline at end of file
diff --git a/example/example.iml b/example/example.iml
new file mode 100644
index 0000000..f96dda4
--- /dev/null
+++ b/example/example.iml
@@ -0,0 +1,484 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/kobalt/src/Build.kt b/example/kobalt/src/Build.kt
index 05337da..766bcc1 100644
--- a/example/kobalt/src/Build.kt
+++ b/example/kobalt/src/Build.kt
@@ -6,7 +6,6 @@ import net.thauvin.erik.kobalt.plugin.versioneye.*
// ./kobaltw versionEye
val bs = buildScript {
- repos(localMaven())
plugins("net.thauvin.erik:kobalt-versioneye:")
}
@@ -17,12 +16,20 @@ val p = project {
artifactId = name
version = "0.1"
+ sourceDirectories {
+ path("src/main/kotlin")
+ }
+
+ sourceDirectoriesTest {
+ path("src/test/kotlin")
+ }
+
dependencies {
compile("com.beust:jcommander:1.47")
//compile("org.slf4j:slf4j-api:")
compile("ch.qos.logback:logback-core:0.5")
compile("ch.qos.logback:logback-classic:1.1.7")
- compile("commons-httpclient:commons-httpclient:3.1")
+ compile("commons-httpclient:commons-httpclient:jar:3.1")
compile("com.beust:kobalt-plugin-api:0.878")
}
@@ -44,10 +51,8 @@ val p = project {
// colors = true
// name = ""
// org = ""
- pom = true
// quiet = false
// team = ""
- temp = true
// verbose = true
// visibility = "public"
diff --git a/example/kobalt/wrapper/kobalt-wrapper.properties b/example/kobalt/wrapper/kobalt-wrapper.properties
index a6a4316..f3cd7d1 100644
--- a/example/kobalt/wrapper/kobalt-wrapper.properties
+++ b/example/kobalt/wrapper/kobalt-wrapper.properties
@@ -1 +1 @@
-kobalt.version=1.0.90
+kobalt.version=1.0.6
\ No newline at end of file
diff --git a/example/pom.xml b/example/pom.xml
deleted file mode 100644
index 7b9976b..0000000
--- a/example/pom.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
- 4.0.0
- com.example
- example
- 0.1
- example
-
-
-
- com.beust
- jcommander
- 1.47
-
-
- ch.qos.logback
- logback-core
- 0.5
-
-
- ch.qos.logback
- logback-classic
- 1.1.7
-
-
- commons-httpclient
- commons-httpclient
- 3.1
-
-
- com.beust
- kobalt-plugin-api
- 0.878
-
-
- org.testng
- testng
- (0,]
- test
-
-
-
diff --git a/kobalt-versioneye.iml b/kobalt-versioneye.iml
index 939539f..0f2eb63 100644
--- a/kobalt-versioneye.iml
+++ b/kobalt-versioneye.iml
@@ -1,6 +1,6 @@
-
+
@@ -12,73 +12,10 @@
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -148,72 +85,9 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -327,6 +201,15 @@
+
+
+
+
+
+
+
+
+
@@ -363,73 +246,19 @@
-
-
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -525,6 +354,15 @@
+
+
+
+
+
+
+
+
+
@@ -588,35 +426,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -624,41 +435,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/kobalt/Build.kt.iml b/kobalt/Build.kt.iml
index a832213..66ab158 100644
--- a/kobalt/Build.kt.iml
+++ b/kobalt/Build.kt.iml
@@ -1,8 +1,8 @@
-
-
-
+
+
+
@@ -10,33 +10,22 @@
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/kobalt/src/Build.kt b/kobalt/src/Build.kt
index eb19a69..61a096a 100644
--- a/kobalt/src/Build.kt
+++ b/kobalt/src/Build.kt
@@ -1,30 +1,37 @@
import com.beust.kobalt.buildScript
-import com.beust.kobalt.localMaven
+import com.beust.kobalt.file
+import com.beust.kobalt.misc.kobaltLog
+import com.beust.kobalt.plugin.application.application
import com.beust.kobalt.plugin.packaging.assemble
-import com.beust.kobalt.plugin.publish.autoGitTag
import com.beust.kobalt.plugin.publish.bintray
-import com.beust.kobalt.profile
import com.beust.kobalt.project
import net.thauvin.erik.kobalt.plugin.versioneye.versionEye
import org.apache.maven.model.Developer
import org.apache.maven.model.License
import org.apache.maven.model.Model
import org.apache.maven.model.Scm
+import java.io.File
+
+val semver = "0.4.4"
val bs = buildScript {
- repos(localMaven())
- plugins("net.thauvin.erik:kobalt-maven-local:", "net.thauvin.erik:kobalt-versioneye:")
+ val p = with(File("kobaltBuild/libs/kobalt-versioneye-$semver.jar")) {
+ if (exists()) {
+ kobaltLog(1, " >>> Using: $path")
+ file(path)
+ } else {
+ "net.thauvin.erik:kobalt-versioneye:"
+ }
+ }
+ plugins(p)
}
-val dev by profile()
-val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api"
-
val p = project {
name = "kobalt-versioneye"
group = "net.thauvin.erik"
artifactId = name
- version = "0.4.6"
+ version = semver
pom = Model().apply {
description = "VersionEye plug-in for the Kobalt build system."
@@ -45,41 +52,83 @@ val p = project {
})
}
+ sourceDirectories {
+ path("src/main/kotlin")
+ }
+
+ sourceDirectoriesTest {
+ path("src/test/kotlin")
+ }
+
dependencies {
- compileOnly("com.beust:$kobaltDependency:")
- compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.51")
- compile("com.squareup.okhttp3:logging-interceptor:jar:3.9.0")
+ compile("com.beust:kobalt-plugin-api:")
}
dependenciesTest {
- compile("org.testng:testng:6.12")
+ compile("org.testng:testng:")
+
}
assemble {
- jar {
- fatJar = true
- }
-
- mavenJars {
- fatJar = true
- }
- }
-
- autoGitTag {
- enabled = true
- push = false
- message = "Version $version"
+ mavenJars {}
}
bintray {
publish = true
- description = "Release version $version"
- vcsTag = version
+ }
+}
+
+val example = project(p) {
+
+ name = "example"
+ group = "com.example"
+ artifactId = name
+ version = "0.1"
+ directory = "example"
+
+ sourceDirectories {
+ path("src/main/kotlin")
+ }
+
+ sourceDirectoriesTest {
+ path("src/test/kotlin")
+ }
+
+ dependencies {
+ compile("com.beust:jcommander:1.47")
+ //compile("org.slf4j:slf4j-api:")
+ compile("ch.qos.logback:logback-core:0.5")
+ compile("ch.qos.logback:logback-classic:1.1.7")
+ compile("commons-httpclient:commons-httpclient:jar:3.1")
+ compile("com.beust:kobalt-plugin-api:0.878")
+ }
+
+
+
+ dependenciesTest {
+ compile("org.testng:testng:")
+ }
+
+ assemble {
+ jar {
+ }
+ }
+
+ application {
+ mainClass = "com.example.MainKt"
}
versionEye {
- org = "thauvin"
- team = "Owners"
- pom = true
+ // baseUrl = "https://www.versioneye.com/"
+ // colors = true
+ // name = ""
+ // org = ""
+ // quiet = false
+ // team = ""
+ // verbose = true
+ // visibility = "public"
+
+ //failOn(Fail.licensesUnknownCheck, Fail.licensesCheck, Fail.securityCheck, Fail.dependenciesCheck)
}
-}
\ No newline at end of file
+}
+
diff --git a/kobalt/wrapper/kobalt-wrapper.properties b/kobalt/wrapper/kobalt-wrapper.properties
index a6a4316..f3cd7d1 100644
--- a/kobalt/wrapper/kobalt-wrapper.properties
+++ b/kobalt/wrapper/kobalt-wrapper.properties
@@ -1 +1 @@
-kobalt.version=1.0.90
+kobalt.version=1.0.6
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 22488cf..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
- 4.0.0
- net.thauvin.erik
- kobalt-versioneye
- 0.4.6
- kobalt-versioneye
- VersionEye plug-in for the Kobalt build system.
- https://github.com/ethauvin/kobalt-versioneye
-
-
- BSD 3-Clause
- https://opensource.org/licenses/BSD-3-Clause
-
-
-
-
- ethauvin
- Erik C. Thauvin
- erik@thauvin.net
-
-
-
- https://github.com/ethauvin/kobalt-versioneye.git
- git@github.com:ethauvin/kobalt-versioneye.git
- https://github.com/ethauvin/kobalt-versioneye
-
-
-
- com.squareup.okhttp3
- logging-interceptor
- 3.8.0
-
-
- org.testng
- testng
- 6.11
- test
-
-
-
diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtils.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt
similarity index 79%
rename from src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtils.kt
rename to src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt
index c3733c8..57a38fa 100644
--- a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtils.kt
+++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/Utils.kt
@@ -1,5 +1,5 @@
/*
- * VersionEyeUtils.kt
+ * Utils.kt
*
* Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
@@ -34,7 +34,7 @@ package net.thauvin.erik.kobalt.plugin.versioneye
import com.beust.kobalt.AsciiArt
import com.beust.kobalt.misc.log
-open class VersionEyeUtils private constructor() {
+open class Utils {
companion object {
// Non-colors failure
fun alt(failed: Boolean): String {
@@ -67,27 +67,6 @@ open class VersionEyeUtils private constructor() {
}
- fun red(text: String, colors: Boolean = true): String {
- if (!colors) {
- return text
- }
- return AsciiArt.RED + text + AsciiArt.RESET
- }
-
- fun yellow(text: String, colors: Boolean = true): String {
- if (!colors) {
- return text
- }
- return AsciiArt.YELLOW + text + AsciiArt.RESET
- }
-
- fun green(text: String, colors: Boolean = true): String {
- if (!colors) {
- return text
- }
- return AsciiArt.GREEN + text + AsciiArt.RESET
- }
-
fun redLight(count: Int, fail: Boolean, colors: Boolean): String {
return redLight(count.toString(), count, fail, colors)
}
@@ -96,11 +75,11 @@ open class VersionEyeUtils private constructor() {
fun redLight(text: String, count: Int, fail: Boolean, colors: Boolean): String {
if (colors) {
if (fail && count > 0) {
- return red(text)
+ return AsciiArt.RED + text + AsciiArt.RESET
} else if (count > 0) {
- return yellow(text)
+ return AsciiArt.YELLOW + text + AsciiArt.RESET
} else {
- return green(text)
+ return AsciiArt.GREEN + text + AsciiArt.RESET
}
}
return text
diff --git a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyePlugin.kt b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyePlugin.kt
index b8a86ce..4188480 100644
--- a/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyePlugin.kt
+++ b/src/main/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyePlugin.kt
@@ -44,8 +44,6 @@ import com.google.gson.JsonObject
import com.google.inject.Inject
import com.google.inject.Singleton
import okhttp3.*
-import okhttp3.logging.HttpLoggingInterceptor
-import java.io.File
import java.io.FileOutputStream
import java.nio.file.Files
import java.nio.file.Paths
@@ -56,22 +54,13 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor by configActor {
private val API_KEY_PROPERTY = "versioneye.apiKey"
- private val COLORS_PROPERTY = "ve.colors"
- private val CREATE_PROPERTY = "ve.create"
private val PROJECT_KEY_PROPERTY = "versioneye.projectKey"
- private val QUIET_PROPERTY = "ve.quiet"
+ private val COLORS_PROPERTY = "ve.colors"
private val VERBOSE_PROPERTY = "ve.verbose"
+ private val QUIET_PROPERTY = "ve.quiet"
private val debug = System.getProperty("ve.debug", "false").toBoolean()
- private val proxy = System.getProperty("ve.proxy", "-1").toInt()
-
- private val httpClient = if (!debug) {
- OkHttpClient()
- } else {
- OkHttpClient().newBuilder().addInterceptor(
- HttpLoggingInterceptor({ message -> log(2, "[HTTP] $message") })
- .apply { level = HttpLoggingInterceptor.Level.BODY }).build()
- }
+ private val httpClient = OkHttpClient()
// ITaskContributor
override fun tasksFor(project: Project, context: KobaltContext): List = taskContributor.dynamicTasks
@@ -90,15 +79,15 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor
@@ -135,25 +124,11 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor
- p.store(output, null)
+ p.store(output, "")
}
return result
@@ -210,13 +185,15 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor 0
- val isFailLicense = VersionEyeUtils.isFail(config.failSet, Fail.licensesCheck) && licenses_red > 0
- val isFailUnknown = VersionEyeUtils.isFail(config.failSet, Fail.licensesUnknownCheck) && licenses_unknown > 0
- val isFailSecurity = VersionEyeUtils.isFail(config.failSet, Fail.securityCheck) && sv_count > 0
+ val isFailDeps = Utils.isFail(config.failSet, Fail.dependenciesCheck) && out_number > 0
+ val isFailLicense = Utils.isFail(config.failSet, Fail.licensesCheck) && licenses_red > 0
+ val isFailUnknown = Utils.isFail(config.failSet, Fail.licensesUnknownCheck) && licenses_unknown > 0
+ val isFailSecurity = Utils.isFail(config.failSet, Fail.securityCheck) && sv_count > 0
// Unknown dependencies
var unknownDeps = 0
@@ -280,14 +258,14 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor UNKNOWN", unknownDeps, false, config.colors))
+ depsInfo.append(Utils.redLight(" - $depName -> UNKNOWN", unknownDeps, false, config.colors))
} else if (dep.get("outdated").asBoolean) {
if (depsInfo.isNotEmpty()) {
depsInfo.append(lf)
}
- depsInfo.append(VersionEyeUtils.redLight(" - $depName -> "
+ depsInfo.append(Utils.redLight(" - $depName -> "
+ curVer.asString, out_number, isFailDeps, config.colors)
- + VersionEyeUtils.alt(isFailDeps && !config.colors))
+ + Utils.alt(isFailDeps && !config.colors))
}
// Parse licenses
@@ -318,9 +296,9 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor = mutableSetOf(Fail.securityCheck)
var name = ""
var org = ""
- var pom = false
var quiet = false
var team = ""
- var temp = false
var verbose = true
var visibility = "public"
diff --git a/src/test/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtilsTest.kt b/src/test/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtilsTest.kt
deleted file mode 100644
index 3778931..0000000
--- a/src/test/kotlin/net/thauvin/erik/kobalt/plugin/versioneye/VersionEyeUtilsTest.kt
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * VersionEyeUtilsTest.kt
- *
- * Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 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.
- *
- * Neither the name of this project 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 COPYRIGHT HOLDER 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.
- */
-package net.thauvin.erik.kobalt.plugin.versioneye
-
-import com.beust.kobalt.AsciiArt
-import org.testng.Assert
-import org.testng.annotations.Test
-
-@Test
-class VersionEyeUtilsTest {
- val text = "This is a test"
-
- @Test
- fun alt() {
- Assert.assertEquals(VersionEyeUtils.alt(false), "", "alt(false")
- Assert.assertEquals(VersionEyeUtils.alt(true), " [FAILED]", "alt(true)")
- }
-
- @Test
- fun plural() {
- val singular = "foo"
- val plural = "s"
- Assert.assertEquals(VersionEyeUtils.plural(singular, 0, plural), singular, "plural($singular, count:0, $plural)")
- Assert.assertEquals(VersionEyeUtils.plural(singular, 1, plural), singular, "plural($singular, count:1, $plural)")
- Assert.assertEquals(VersionEyeUtils.plural(singular, 2, plural), singular + plural, "plural($singular, count:2," +
- "$plural)")
-
- val text = "vulnerabilit"
- val y = "y"
- val ies = "ies"
- Assert.assertEquals(VersionEyeUtils.plural(text, 0, ies, y), text + y, "plural($text, count:0, $ies, $y)")
- Assert.assertEquals(VersionEyeUtils.plural(text, 1, ies, y), text + y, "plural($text, count:1, $ies, $y)")
- Assert.assertEquals(VersionEyeUtils.plural(text, 2, ies, y), text + ies, "plural($text, count:2, $ies, $y)")
- }
-
- @Test
- fun red() {
- Assert.assertEquals(VersionEyeUtils.red(text), AsciiArt.RED + text + AsciiArt.RESET, "red($text)")
- Assert.assertEquals(VersionEyeUtils.red(text, false), text, "red($text)")
- }
-
- @Test
- fun yellow() {
- Assert.assertEquals(VersionEyeUtils.yellow(text), AsciiArt.YELLOW + text + AsciiArt.RESET, "yellow($text)")
- Assert.assertEquals(VersionEyeUtils.yellow(text, false), text, "yellow($text)")
- }
-
- @Test
- fun green() {
- Assert.assertEquals(VersionEyeUtils.green(text), AsciiArt.GREEN + text + AsciiArt.RESET, "green($text)")
- Assert.assertEquals(VersionEyeUtils.green(text, false), text, "green($text)")
- }
-
- @Test
- fun redLight() {
- Assert.assertEquals(VersionEyeUtils.redLight(text, 1, true, true), AsciiArt.RED + text + AsciiArt.RESET,
- "redLight($text, count:1, fail:true, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(text, 1, false, true), AsciiArt.YELLOW + text + AsciiArt.RESET,
- "redLight($text, count:1, fail:false, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(text, 0, false, true), AsciiArt.GREEN + text + AsciiArt.RESET,
- "redLight($text, count:0, fail:false, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(text, 1, false, false), text,
- "redLight($text, count:1, fail:false, colors:false)")
-
- Assert.assertEquals(VersionEyeUtils.redLight(1, true, true), AsciiArt.RED + 1 + AsciiArt.RESET,
- "redLight(count:1, fail:true, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(1, false, true), AsciiArt.YELLOW + 1 + AsciiArt.RESET,
- "redLight(count:1, fail:false, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(0, false, true), AsciiArt.GREEN + 0 + AsciiArt.RESET,
- "redLight(count:0, fail:false, colors:true)")
- Assert.assertEquals(VersionEyeUtils.redLight(1, false, false), "1",
- "redLight(count:1, fail:false, colors:false)")
- }
-}
\ No newline at end of file