-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
…on with each request. Modified the extension to react on the version
@peteraba Please do the first review. |
There was a problem hiding this 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" |
There was a problem hiding this comment.
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": [] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]*)/; |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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.`; |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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() + |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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. 😉
There was a problem hiding this comment.
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?
@wwgerner please do the last review. |
}, | ||
|
||
// Attached cutom events listeners map | ||
listeners: { | ||
"ninjaprinter.result": [], | ||
"ninjaprinter.afterPrint": [], | ||
"ninjaprinter.beforePrint": [] | ||
"ninjaprinter.beforePrint": [], | ||
"ninjaprinter.versionWarning": [] |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SemanticVersion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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? :)
There was a problem hiding this comment.
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.
@CanLikeTo Please check the comments, nice development! |
LGTM |
@CanLikeTo If you want to add followups, feel free to add them :) |
No description provided.