Skip to content

Commit

Permalink
Proper semver check in update
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyman727 committed Feb 17, 2016
1 parent ee1a243 commit 5798738
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var async = require('async');
var colors = require('colors');
var inquirer = require('inquirer');
var sprintf = require('sprintf-js').sprintf;
var semver = require('semver');

// Internal
var discover = require('./discover');
Expand Down Expand Up @@ -846,7 +847,6 @@ controller.update = function(opts) {
return versionFromSHA.then(function(currentVersionInfo) {
var build = updates.findBuild(builds, 'version', version);
var verifiedVersion;

// If the update is forced or this version was requested,
// and a valid build exists for the version provided.
if (version && build) {
Expand All @@ -872,7 +872,7 @@ controller.update = function(opts) {
}

// Check if the current build is the same or newer if this isn't a forced update
if (!opts.force && currentVersionInfo.version >= verifiedVersion) {
if (!opts.force && semver.gte(currentVersionInfo.version, verifiedVersion)) {
// If it's not, close the Tessel connection and print the error message
var message = tessel.name + ' is already on the latest firmware version (' + currentVersionInfo.version + '). You can force an update with "t2 update --force".';

Expand Down

0 comments on commit 5798738

Please sign in to comment.