Skip to content

Commit

Permalink
Display a message if an update is available.
Browse files Browse the repository at this point in the history
  • Loading branch information
lprhodes committed Mar 17, 2018
1 parent af6a9b8 commit 57de31e
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 53 deletions.
7 changes: 3 additions & 4 deletions helpers/checkForUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ const options = {
};


const checkForUpdates = (log) => {
const checkForUpdates = () => {
versionCheck (options, (update, error) => {
if (error) throw error;

// if (error) throw error;
if (update) {
log(`\x1b[32m[UPDATE AVAILABLE] \x1b[30mVersion ${update.tag_name} of homebridge-broadlink-rm is available: ${update.html_url}`);
console.log(`\x1b[32m[UPDATE AVAILABLE] \x1b[0mVersion ${update.tag_name} of homebridge-broadlink-rm is available. The release notes can be found here: \x1b[4mhttps://github.com/lprhodes/homebridge-broadlink-rm/releases/\x1b[0m`);
}
});
}
Expand Down
135 changes: 95 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@
},
"dependencies": {
"broadlinkjs-rm": "^0.2.6",
"chai": "^4.1.2",
"github-version-checker": "^1.2.0",
"homebridge-platform-helper": "1.0.5",
"ping": "^0.2.2",
"uuid": "^3.2.1",
"chai": "^4.1.2"
"uuid": "^3.2.1"
},
"devDependencies": {
"hap-nodejs": "^0.4.41",
Expand Down
14 changes: 7 additions & 7 deletions platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform {
setTimeout(() => {
console.log('')
console.log(`**************************************************************************************************************`)
console.log(`** Welcome to version ${npmPackage.version} of the Homebridge Broadlink RM Plugin!`)
console.log(`** Find out what's in the latest release here: https://github.com/lprhodes/homebridge-broadlink-rm/releases`)
console.log(`** Welcome to version \x1b[32m${npmPackage.version}\x1b[0m of the \x1b[34mHomebridge Broadlink RM Plugin\x1b[0m!`)
console.log('')
console.log(`** Find out what's in the latest release here: \x1b[4mhttps://github.com/lprhodes/homebridge-broadlink-rm/releases\x1b[0m`)
console.log(`** `)
console.log(`** Keep up to date with this plugin along with everything HomeKit and homebridge`)
console.log(`** by signing up to our newsletter at http://workswith.io`)
console.log(`** If you like this plugin then please star it on GitHub or better yet buy me a drink using Paypal \x1b[4mhttps://paypal.me/lprhodes\x1b[0m or crypto \x1b[4mhttps://goo.gl/bEn1RW\x1b[0m.`)
console.log(`** `)
console.log(`** If you like this plugin then please star it on GitHub or better yet; [buy me a drink](https://paypal.me/lprhodes).`)
console.log(`** Keep up to date with this plugin along with everything HomeKit and homebridge`)
console.log(`** by signing up to my newsletter at \x1b[4mhttp://workswith.io\x1b[0m`)
console.log(`**`)
console.log(`** You can disable this message by adding "hideWelcomeMessage": true to the config (see config-sample.json).`)
console.log(`**`)
Expand All @@ -49,8 +50,7 @@ const BroadlinkRMPlatform = class extends HomebridgePlatform {
const { config, log } = this;

this.showMessage();

checkForUpdates(log);
setTimeout(checkForUpdates, 1800);

if (!config.accessories) config.accessories = []

Expand Down

0 comments on commit 57de31e

Please sign in to comment.