-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
652 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
github() { | ||
curl --location \ | ||
https://api.github.com/repos/${github.repo.folder}/releases \ | ||
--header "Content-Type: application/json" \ | ||
--header "Authorization: bearer ${github.token}" \ | ||
--data "$1" | ||
} | ||
|
||
create_tag() { | ||
git tag "v${project.version}" | ||
git push origin "v${project.version}" | ||
} | ||
|
||
create_release() { | ||
RELEASE_DATA=$( github '{ | ||
"tag_name": "v${project.version}", | ||
"name": "Version ${project.version}", | ||
"draft": false, | ||
"prerelease": true | ||
}' ) | ||
UPLOAD_URL_TEMPLATE=$( echo "$RELEASE_DATA" | jq -r '.upload_url' ) | ||
} | ||
|
||
upload_file() { | ||
UPLOAD_BASE_URL="${UPLOAD_URL_TEMPLATE/\{*\}/}" | ||
UPLOAD_URL="${UPLOAD_BASE_URL}?name=${project.build.finalName}.jar" | ||
UPLOAD_DATA=$( curl --location \ | ||
"${UPLOAD_URL}" \ | ||
--header "Content-Type: application/java-archive" \ | ||
--header "Authorization: bearer ${github.token}" \ | ||
--data-binary "@${project.build.directory}/${project.build.finalName}.jar" | ||
) | ||
DOWNLOAD_URL=$( echo "$UPLOAD_DATA" | jq -r '.browser_download_url' ) | ||
} | ||
|
||
push_update() { | ||
|
||
local WORKTREE="update-worktree" | ||
|
||
cd "$( dirname "$0" )" | ||
if [ -d "$WORKTREE" ] | ||
then | ||
rm -fr "$WORKTREE" | ||
fi | ||
git clone \ | ||
--no-tags \ | ||
--branch update \ | ||
--single-branch "${basedir}" \ | ||
"${WORKTREE}" | ||
cp update.properties "${WORKTREE}" | ||
cd "${WORKTREE}" | ||
|
||
git add update.properties | ||
git commit -m "Set update file to version ${project.version}" | ||
git remote add github git@github.com:${github.repo.folder}.git | ||
git push origin update:update | ||
git push github update:update | ||
} | ||
|
||
run_command() { | ||
local CMD="$1" | ||
shift | ||
echo === "$@" ======================= | ||
"$CMD" && echo --- OK /"$@" ------------------- || | ||
echo --- ERROR /"$@" ---------------- | ||
echo | ||
} | ||
|
||
run_command create_tag "Creating tag" | ||
run_command create_release "Creating release" | ||
run_command upload_file "Uploading plugin file" | ||
run_command push_update "Uploading update information" |
51 changes: 51 additions & 0 deletions
51
src/main/java/br/ufes/inf/nemo/ufo/protege/HierarchyNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package br.ufes.inf.nemo.ufo.protege; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* | ||
* @author luciano | ||
*/ | ||
public class HierarchyNode { | ||
|
||
private final String iri; | ||
private final String parentIri; | ||
private final int index; | ||
private final Set<String> children = new HashSet<>(); | ||
|
||
public HierarchyNode(String iri, String parentIri, int index) { | ||
this.iri = iri; | ||
this.parentIri = parentIri; | ||
this.index = index; | ||
} | ||
|
||
public String getIri() { | ||
return iri; | ||
} | ||
|
||
public String getParentIri() { | ||
return parentIri; | ||
} | ||
|
||
public int getIndex() { | ||
return index; | ||
} | ||
|
||
public Set<String> getChildren() { | ||
return children; | ||
} | ||
|
||
public boolean contains(String iri) { | ||
return children.contains(iri); | ||
} | ||
|
||
public int compareTo(HierarchyNode other) { | ||
return other == null ? -1 : Integer.signum(index - other.index); | ||
} | ||
} |
Oops, something went wrong.