Skip to content

Commit

Permalink
Merge branch 'release/v1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeboer committed Jun 28, 2017
2 parents 57fcb10 + 6664b7d commit 475dc88
Show file tree
Hide file tree
Showing 11 changed files with 4,763 additions and 9 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/
2 changes: 1 addition & 1 deletion index.js

Large diffs are not rendered by default.

25 changes: 22 additions & 3 deletions index.js.flow
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,17 @@ class Hugo {
};

if (process.env.HOME && process.env.alfred_theme) {
let homedir = process.env.HOME || '';
let themeName = process.env.alfred_theme || '';
let alfredMajor = semver.major(process.env.alfred_version);
let homedir: string = process.env.HOME || '';
let themeName: string = process.env.alfred_theme || '';
let alfredMajor: string = '';

if (process.env.alfred_version) {
alfredMajor = process.env.alfred_version.match(/([0-9]+)\./) || '';

if (alfredMajor && alfredMajor.length > 0) {
alfredMajor = alfredMajor[1];
}
}

let themeFile = path.resolve(homedir, 'Library', 'Application Support', 'Alfred ' + alfredMajor,
'Alfred.alfredpreferences', 'themes', themeName, 'theme.json');
Expand Down Expand Up @@ -332,6 +340,7 @@ class Hugo {
await updater.checkUpdates(this._options.updateSource, this._options.updateInterval)
.catch(err => {
console.error(err);
return;
})
.then(result => {
if (!result) {
Expand All @@ -342,6 +351,16 @@ class Hugo {
let current: string = this.workflowMeta.version;
let latest: string = result.version;

if (!semver.valid(current)) {
console.error(`Version ${current} is not a valid version number.`);
return;
}

if (!semver.valid(latest)) {
console.error(`Could not determine latest version number.`);
return;
}

// Display notification
if (semver.gt(latest, current)) {
if (result.checkedOnline === true && this._options.updateNotification === true) {
Expand Down
2 changes: 1 addition & 1 deletion index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 475dc88

Please sign in to comment.