-
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.
Merge pull request #28 from javajon/update
Added lint command. Updated linux archetype. Fixed solver download
- Loading branch information
Showing
27 changed files
with
1,208 additions
and
203 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
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 |
---|---|---|
|
@@ -4,16 +4,13 @@ Upcoming considerations to improve _Solver_: | |
|
||
## Near term feature goals and issues | ||
|
||
- Add .cypress tests to archetypes. | ||
- More archetypes for `solver create`, currently just `linux`, `basic` may be next. | ||
- Test command line for oddball values. | ||
- More archetypes for `solver create`, currently just `linux` and `basic` maybe next. | ||
- Enhance help descriptions for each command and parameter. | ||
- Add more unit tests. | ||
- `solver check` to be finished: | ||
- implement checks for author and challenge contexts. | ||
- Encourage authors in documentation to add pre-commit hook to reject commit if `solver check` returns error code. Will provide recipe. | ||
- An authoring check is needed to see if `solutions.sh` is newer than `solutions.sh.enc`. | ||
- `solver check` needs a `--fix` switch for the fixable problems it encounters. | ||
- Add more unit tests for oddball CLI values. | ||
- `solver lint` is improving: | ||
- Many checks exist for authoring mode. Considering checks when in challenge context. | ||
- Encourage authors in documentation to add pre-commit hook to reject commit if `solver lint` returns error code. Will provide a recipe. | ||
- `solver lint` could offer a `--fix` switch to correct some of the problems it encounters. | ||
|
||
The current commands for _Solver_ are marked with their implementation and testing status: | ||
|
||
|
@@ -33,15 +30,16 @@ The current commands for _Solver_ are marked with their implementation and testi | |
| ✔ | request_hint | internal call by `hint.sh` only | | ||
| ✔ | request_advance_task | internal call by verify.sh only | | ||
| ✔ | create | Create a Challenge project from the given archetype when in authoring context | | ||
| 🤔 todo | check | Verify the required artifacts for the challenge are present and valid. Can check authoring and Challenge environments. | | ||
| ✔ | lint | Verify the required artifacts for the challenge are present and valid. Can check-in authoring mode. Checking Challenge mode after decryption is proposed. | | ||
|
||
## Longer-term feature goals | ||
|
||
- ☢ The CLI binary (Linux native) is currently above the 9MB limit for scenario asset size. The CLI binary has been compressed using UPX, but so far cannot be distilled below 9MB. For the time being it is recommended to `wget` the tool from the GitHub release page when the challenge starts. This can potentially lead to the challenge not working if GitHub fails to deliver the artifact due to issues such as GitHub stability, rate limiting, or pure networking. | ||
- Currently assuming all solutions are in a sh file, instead, consider putting all contents in a `solutions` directory into an encrypted zip. | ||
- ☢ The CLI binary (Linux native) is currently above the 9MB limit for scenario asset size. The CLI binary has been compressed using UPX, but so far cannot be distilled below 10.6MB. For the time being it is recommended to `wget` the tool from the GitHub release page when the challenge starts. This can potentially lead to the challenge not working if GitHub fails to deliver the artifact due to issues such as GitHub stability, rate limiting, or pure networking. | ||
- Currently assuming all solutions are in a single sh file, instead, consider putting all contents in a `solutions` directory into an encrypted zip. | ||
- Perhaps a verbose logging switch currently logs in `/var/log/solver.log`. | ||
- OSX and Windows native binary on the release page, a container image is currently encouraged | ||
- Add .cypress tests to archetypes. Cypress tests will call `solver all`. Currently, Cypress testing is generally not working for scenarios or challenges. May be helpful to layer in BBD with Cucumber with Cypress. | ||
|
||
## Your Feedback is Important | ||
## Your feedback is important | ||
|
||
Your insights as a Challenge author around the authoring process and how to improve this utility and the rest of the platform are important. When you have feedback please consider adding an [issue](https://github.com/javajon/katacoda-solver/issues) to this project. Issues beyond the scope of authoring challenges with _Solver_ and more about Katacoda may be emailed to [email protected]. |
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
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,31 @@ | ||
package com.katacoda.solver.models; | ||
|
||
public class CheckItem { | ||
private final Status status; | ||
private final String message; | ||
|
||
/** | ||
* Messages such as from script validator that appear at end of report. | ||
*/ | ||
private String appendix = ""; | ||
|
||
public CheckItem(Status status, String message) { | ||
this.status = status; | ||
this.message = message; | ||
} | ||
|
||
public Status getStatus() { | ||
return status; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setAppendix(String appendix) { | ||
this.appendix = appendix; | ||
} | ||
public String getAppendix() { | ||
return appendix; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/katacoda/solver/models/CheckItemBuilder.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,20 @@ | ||
package com.katacoda.solver.models; | ||
|
||
public class CheckItemBuilder { | ||
private Status status = Status.Undetermined; | ||
private String message = ""; | ||
|
||
public CheckItemBuilder status(Status status) { | ||
this.status = status; | ||
return this; | ||
} | ||
|
||
public CheckItemBuilder message(String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
|
||
public CheckItem create() { | ||
return new CheckItem(status, message); | ||
} | ||
} |
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,48 @@ | ||
package com.katacoda.solver.models; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class Node<T> { | ||
|
||
private T data = null; | ||
|
||
private List<Node<T>> children = new ArrayList<>(); | ||
|
||
private Node<T> parent = null; | ||
|
||
public Node(T data) { | ||
this.data = data; | ||
} | ||
|
||
public Node<T> add(Node<T> child) { | ||
child.setParent(this); | ||
this.children.add(child); | ||
return child; | ||
} | ||
|
||
public void add(List<Node<T>> children) { | ||
children.forEach(each -> each.setParent(this)); | ||
this.children.addAll(children); | ||
} | ||
|
||
public List<Node<T>> getChildren() { | ||
return children; | ||
} | ||
|
||
public T getData() { | ||
return data; | ||
} | ||
|
||
public void setData(T data) { | ||
this.data = data; | ||
} | ||
|
||
private void setParent(Node<T> parent) { | ||
this.parent = parent; | ||
} | ||
|
||
public Node<T> getParent() { | ||
return parent; | ||
} | ||
} |
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,32 @@ | ||
package com.katacoda.solver.models; | ||
|
||
import io.quarkus.runtime.util.StringUtil; | ||
import picocli.CommandLine; | ||
|
||
public enum Status { | ||
Undetermined('☐', "white"), | ||
Info('ⓘ', "green"), | ||
Pass('✅', "green"), | ||
Warning('⚠', "yellow"), | ||
Fixed((char)0xD83D, "blue"), | ||
Error('❌', "red"); | ||
|
||
public static int indent = 1; | ||
private final char icon; | ||
private final String color; | ||
|
||
Status(char icon, String color) { | ||
this.icon = icon; | ||
this.color = color; | ||
} | ||
|
||
public String message(String message) { | ||
String indentSpaces = new String(new char[indent]).replace('\0', ' '); | ||
|
||
if (this == Status.Undetermined) { | ||
return String.format("%-10s%s%s", "", indentSpaces, message); | ||
} | ||
|
||
return CommandLine.Help.Ansi.AUTO.string(String.format("@|bold,%s %s %-8s%s%s|@", color, icon, name(), indentSpaces, message)); | ||
} | ||
} |
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,29 @@ | ||
package com.katacoda.solver.models; | ||
|
||
public class Tallies { | ||
private int pass; | ||
private int warning; | ||
private int error; | ||
|
||
public void add(Status status) { | ||
switch (status) { | ||
case Pass: | ||
pass++; | ||
break; | ||
case Warning: | ||
warning++; | ||
break; | ||
case Error: | ||
error++; | ||
break; | ||
} | ||
} | ||
|
||
public String report() { | ||
return String.format("Passes: %d, Warnings: %d, Errors: %d", pass, warning, error); | ||
} | ||
|
||
public boolean hasErrors() { | ||
return error > 0; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/katacoda/solver/models/mapping/AssetFile.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,22 @@ | ||
package com.katacoda.solver.models.mapping; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class AssetFile { | ||
private String file = ""; | ||
private String target = ""; | ||
private String chmod = ""; | ||
|
||
public String getChmod() { | ||
return chmod; | ||
} | ||
|
||
public String getTarget() { | ||
return target; | ||
} | ||
|
||
public String getFile() { | ||
return file; | ||
} | ||
} |
Oops, something went wrong.