Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OMSC-1266] Ninja Printer version check #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

CanLikeTo
Copy link

No description provided.

…on with each request. Modified the extension to react on the version
@CanLikeTo
Copy link
Author

@peteraba Please do the first review.

Copy link
Contributor

@peteraba peteraba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a couple of comments, but nothing that must stop deployment.

@@ -4,14 +4,16 @@ var NinjaPrinter = {
events: {
beforePrint: "ninjaprinter.beforePrint",
afterPrint: "ninjaprinter.afterPrint",
result: "ninjaprinter.result"
result: "ninjaprinter.result",
versionWarning: "ninjaprinter.versionWarning"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor Maybe we should add trailing comma. Chrome should be fine with that.

},

// Attached cutom events listeners map
listeners: {
"ninjaprinter.result": [],
"ninjaprinter.afterPrint": [],
"ninjaprinter.beforePrint": []
"ninjaprinter.beforePrint": [],
"ninjaprinter.versionWarning": []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor Maybe we should add trailing comma. Chrome should be fine with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that invalid in JS?

@@ -1,3 +1,69 @@
class SemVer {
constructor(version) {
let semVerRegex = /(\d)+\.(\d)+\.(\d)+\-?\d*\-?g?([0-9a-f]*)/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some comments for this.


let result = version.match(semVerRegex);

if (result === null)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor opening braces on same line as the if keyword please.

this.commit = parseInt(result[4]);
}

get Major() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's this style from? doesn't look like the rest of our codebase.


if (difference !== 0) {
let message = `The NinjaPrinter extension and host versions do not match.\n
The extension version is ${difference < 0 ? 'lower' : 'higher'} than the host.`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please increase the indentation here.

<exec executable="git" outputproperty="build.version" failonerror="true">
<arg value="describe"/>
</exec>
<replaceregexp file="../java/../chrome-extension/browser/manifest.json"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following 2 tags are impossible to unravel, so please add some comment(s) describing them.

@@ -121,7 +125,8 @@ public void start() {
*/
protected MessageInterface getSuccessMessage(JsonPrintMessageInterface printMessage)
{
String response = "{\"success\":true,\"message\":\"success\", \"requestId\":\"" + printMessage.getRequestId() + "\"}";
String response = "{\"success\":true,\"message\":\"success\", \"requestId\":\"" + printMessage.getRequestId() +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this is (still) a bit ugly, but I can live with that.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peteraba Can we make it a follow up ticket to change this to use a JSON serialisation library?

try {
String jarLocation = NinjaPrinter.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath();

Manifest m = new JarFile(jarLocation).getManifest();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's gonna be interesting to write unit test(s) for. 😉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know 😞
@peteraba Can we add a follow up ticket to add unit testing and to refactor the code?

@peteraba peteraba assigned wwgerner and unassigned wwgerner and peteraba Nov 8, 2016
@peteraba
Copy link
Contributor

peteraba commented Nov 8, 2016

@wwgerner please do the last review.

},

// Attached cutom events listeners map
listeners: {
"ninjaprinter.result": [],
"ninjaprinter.afterPrint": [],
"ninjaprinter.beforePrint": []
"ninjaprinter.beforePrint": [],
"ninjaprinter.versionWarning": []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that invalid in JS?

@@ -1,3 +1,69 @@
class SemVer {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SemanticVersion?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@@ -1,7 +1,9 @@
{
"name": "Ninja Printer",
"version": "1.0.5",
"version": "1.0.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So our newer version with the version handling has a lower version? :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, I checked in the version populated by the build script on my machine. It gets overwritten based on which tag you're working in.

@wwgerner
Copy link
Contributor

@CanLikeTo Please check the comments, nice development!

@wwgerner wwgerner assigned CanLikeTo and unassigned wwgerner Nov 10, 2016
@wwgerner
Copy link
Contributor

LGTM

@wwgerner
Copy link
Contributor

@CanLikeTo If you want to add followups, feel free to add them :)

@wwgerner wwgerner assigned peteraba and unassigned CanLikeTo Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants