Add Atom::isReleasedVersion, which determines if the version is a SHA

This commit is contained in:
Nathan Sobo 2013-12-11 12:28:20 -08:00
parent 6bb4eaee93
commit 8a8df8d6cb
2 changed files with 12 additions and 0 deletions

View File

@ -438,3 +438,11 @@ describe "the `atom` global", ->
expect(atom.config.get('core.themes')).not.toContain packageName
expect(atom.config.get('core.themes')).not.toContain packageName
expect(atom.config.get('core.disabledPackages')).not.toContain packageName
describe ".isReleasedVersion()", ->
it "returns false if the version is a SHA and true otherwise", ->
version = '0.1.0'
spyOn(atom, 'getVersion').andCallFake -> version
expect(atom.isReleasedVersion()).toBe true
version = '36b5518'
expect(atom.isReleasedVersion()).toBe false

View File

@ -361,6 +361,10 @@ class Atom
getVersion: ->
app.getVersion()
# Public: Determine whether the current version is an official release.
isReleasedVersion: ->
not /\w{7}/.test(@getVersion()) # Check if the release is a 7-character SHA prefix
getGitHubAuthTokenName: ->
'Atom GitHub API Token'