Skip to content

Commit

Permalink
clean resources (#1306)
Browse files Browse the repository at this point in the history
* clean resources

* service data should build dirs if necessary

* clear up massive error reporting in junit

* ignoring failing solr test

* person PERSON diff in opencv classifications

* a hunch

* cleaned rsource test of bs

* lower case classification key

* updated pom template

* generated pom

* clean resource update

* small updates

* fixing confusion hopefully on "app"

* fixed default save config

* a little more cleanup
  • Loading branch information
supertick authored Jun 30, 2023
1 parent 30a38e8 commit 7f6874e
Show file tree
Hide file tree
Showing 21 changed files with 292 additions and 318 deletions.
2 changes: 1 addition & 1 deletion publish-github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ echo "build: $build";
# echo "token: $token";

# from - https://docs.github.com/en/rest/releases/releases#create-a-release
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $token" https://api.github.com/repos/MyRobotLab/myrobotlab/releases -d "{\"tag_name\":\"$version\",\"target_commitish\":\"develop\",\"name\":\"$version Nixie\",\"body\":\"## MyRobotLab Nixie Release\r\n\r\nOpen Source Framework for Robotics and Creative Machine Control\r\n *You know, for robots!*\r\n\r\n* Project Website http:\/\/myrobotlab.org \r\n* Project Discord https:\/\/discord.gg\/AfScp5x8r5\r\n* Download [Nixie $version](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/myrobotlab.zip)\r\n* [JavDocs](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/site\/apidocs\/org\/myrobotlab\/service\/package-summary.html)\r\n## Base Requirements\r\n\r\nYou will need Java 11 or newer. If you are only running MyRobotLab you need the JRE (Java Runtime Environment.) If you are going to be building from source, you'll need the JDK (Java Development Kit) Oracle or OpenJDK will work.\r\n \",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":true}"
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $token" https://api.github.com/repos/MyRobotLab/myrobotlab/releases -d "{\"tag_name\":\"$version\",\"target_commitish\":\"develop\",\"name\":\"$version Nixie\",\"body\":\"## MyRobotLab Nixie Release\r\n\r\nOpen Source Framework for Robotics and Creative Machine Control\r\n *You know, for robots!*\r\n\r\n* Project Website http:\/\/myrobotlab.org \r\n* Project Discord https:\/\/discord.gg\/AfScp5x8r5\r\n* Download Built Application [Nixie $version](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/myrobotlab.zip)\r\n* [JavDocs](https:\/\/build.myrobotlab.org:8443\/job\/myrobotlab\/job\/develop\/$build\/artifact\/target\/site\/apidocs\/org\/myrobotlab\/service\/package-summary.html)\r\n## Base Requirements\r\n\r\nYou will need Java 11 or newer. If you are only running MyRobotLab you need the JRE (Java Runtime Environment.) If you are going to be building from source, you'll need the JDK (Java Development Kit) Oracle or OpenJDK will work.\r\n \",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":true}"
3 changes: 2 additions & 1 deletion src/main/java/org/myrobotlab/framework/repo/ServiceData.java
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ public boolean save() {

public boolean save(String filename) {
try {

File dirs = new File(filename).getParentFile();
dirs.mkdirs();
FileOutputStream fos = new FileOutputStream(filename);
String json = CodecUtils.toJson(this);
fos.write(json.getBytes());
Expand Down
18 changes: 4 additions & 14 deletions src/main/java/org/myrobotlab/image/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,21 +277,11 @@ public static ImageIcon getImageIcon(String path) {
*
* @return current resource directory
*/
@Deprecated
@Deprecated /*Resource references do not belong here - the ServiceType and
perhaps even the ServiceName are needed in order to provide context. This
method should be removed, or parameters provided for ServiceType or
ServiceName */
public static String getResourceDir() {
// first try for the resource.dir system property
/*
* THIS CANNOT BE DONE IN TWO PLACES - ONE WILL ALWAYS BE String resourceDir
* = System.getProperty("resource.dir"); if (resourceDir != null) { //
* log.info("Returning {}", resourceDir); return resourceDir; } if
* (!FileIO.isJar()) { //
* log.info("Not in a jar...you're running in an IDE likely."); resourceDir
* = System.getProperty("user.dir") + File.separator +
* "src"+File.separator+"main"+File.separator+"resources"+File.separator+
* "resource"; } else { resourceDir = System.getProperty("user.dir") +
* File.separator + "resource"; }
*/
// log.info("Returning {}", resourceDir);
return Service.getResourceRoot();
}

Expand Down
23 changes: 0 additions & 23 deletions src/main/java/org/myrobotlab/service/ProgramAB.java
Original file line number Diff line number Diff line change
Expand Up @@ -956,29 +956,6 @@ public Set<String> initBotPaths() {
}
}
}

// check for 'local' bots in /data/ProgramAB dir

// check for dev bots
if (getResourceDir().startsWith("src")) {
log.info("in dev mode resourceDir starts with src");
// automatically look in ../ProgramAB for the cloned repo
// look for dev paths in ../ProgramAB
File devRepoCheck = new File("../ProgramAB/resource/ProgramAB/bots");
if (devRepoCheck.exists() && devRepoCheck.isDirectory()) {
log.info("found repo {} adding bot paths", devRepoCheck.getAbsoluteFile());
File[] listOfFiles = devRepoCheck.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
} else if (listOfFiles[i].isDirectory()) {
paths.add(listOfFiles[i].getAbsolutePath());
}
}
} else {
log.error("ProgramAB is a service module clone it at the same level as myrobotlab");
}
}

return paths;
}

Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/myrobotlab/service/Python.java
Original file line number Diff line number Diff line change
Expand Up @@ -1015,15 +1015,6 @@ public List<String> getScriptList() throws IOException {
* @throws IOException
*/
public void addScript(String scriptName, String code) throws IOException {
PythonConfig c = (PythonConfig)config;

File script = new File(c.scriptRootDir + fs + scriptName);

if (script.exists()) {
error("script %s already exists", scriptName);
return;
}

openedScripts.put(scriptName, new Script(scriptName, code));
broadcastState();
}
Expand Down
Loading

0 comments on commit 7f6874e

Please sign in to comment.