Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Add --no-auto-update while run scripts/build to disable autoupdate - #8721

Merged
maxbrunsfeld merged 1 commit into
atom:masterfrom
scv119:autoupdate
Sep 24, 2015
Merged

maxbrunsfeld merged 1 commit into
atom:masterfrom
scv119:autoupdate

Conversation

@scv119

@scv119 scv119 commented Sep 9, 2015

Copy link
Copy Markdown
Contributor

Add --no-auto-update to script/build as an option to disable Atom autoupdate.

This PR create a new grunt task that set _enableAutoUpdate to Atom's package.json while building. And in AutoupdateManager, it loads package.json and check if _enableAutoupdate is set.

I verified that script/build --no-auto-update will set "_enableAutoUpdate" : false in Atom's package.json whereas script/build will set "_enableAutoUpdate" : true.

However, it seems that the build generated by script/build won't trigger autoupdate even if I made the the version to be 1.0.9 instead of 1.0.9-somehash.

Any thought on how to verify the autoupdate feature using script/build?

cc @bolinfest @maxbrunsfeld @kevinsawicki

@scv119

scv119 commented Sep 17, 2015

Copy link
Copy Markdown
Contributor Author

I noticed that there is no way to just check the update but not update it without touching electron code. So I instead disable the periodically check if no-autoupdate is set, whereas user could still click the check update button to trigger autoupdate manually.

Also, do you have any suggestions on how to test that? I tried to hardcode the version number as 1.0.3 instead of something like 1.0.12-hash before building, but the autoupdate just doesn’t do anything.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

I tried to hardcode the version number as 1.0.3 instead of something like 1.0.12-hash before building, but the autoupdate just doesn’t do anything.

If the app's version is just 1.x.y, the auto-update should run. What is the output of this command from your built version of Atom?

remote.require("app").getVersion()

What you've done looks good so far. There are a couple of changes I'd like you to make:

  • Rather than passing the @resourcePath into the AutoUpdateManager, so that it can read the package.json and possibly disable itself, I would rather pass a boolean disabled flag into the AutoUpdateManager if auto update has been disabled in the package.json, or the version string has a SHA in it.
  • When Atom has been built with --no-auto-update, the 'Atom' application menu should not have a Check for Update option. You could add an isDisabled method to AutoUpdateManager that can be checked in ApplicationMenu::getDefaultTemplate.

@scv119
scv119 force-pushed the autoupdate branch 3 times, most recently from 49e6327 to d94d095 Compare September 18, 2015 21:32
@scv119

scv119 commented Sep 18, 2015

Copy link
Copy Markdown
Contributor Author

@maxbrunsfeld ready for review again.

I still can't trigger autoupdate, here is what I did:

  1. I checkout tag v1.0.13
  2. I apply this patch to v1.0.13 scv119@e9e46f9
  3. run pkill Atom && rm -rf /Applications/Atom.app
  4. run ./script/build to get Atom.app
  5. open /Applications/Atom.app

Here I verified the version is 1.0.1, but the Check for Update doesn't do anything if I click it.

But I verified that the Application menu worked as expected.

@scv119
scv119 force-pushed the autoupdate branch 4 times, most recently from dfee2d2 to b5f64e0 Compare September 22, 2015 17:55
@scv119

scv119 commented Sep 22, 2015

Copy link
Copy Markdown
Contributor Author

Here is how I tested:

  • apply this patch (scv119@32c758b) to the commit.
  • run ./script/build to get Atom.app
  • verified that 2015-09-22 11:05:05.692 Atom[93618:5819640] called showed up while starting Atom using atom -f, and this log also showed up when Check for Update is clicked.
    • However, this didn't actually autoupdate Atom, which I suspect something related to this error Error Downloading Update: Could not get code signature for running application.
  • run ./script/build --no-auto-update to get Atom.app without autoupdater.
  • verified that .... called didn't show up while starting Atom using atom -f
  • verified that Check for Update didn't show up in Atom menu.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Here is how I tested

@scv119 👍 Ok, that sounds good to me.

We can merge this as soon as you resolve the conflicts.

@scv119

scv119 commented Sep 22, 2015

Copy link
Copy Markdown
Contributor Author

@maxbrunsfeld rebased :), thanks!

maxbrunsfeld pushed a commit that referenced this pull request Sep 24, 2015
Add --no-auto-update while run `scripts/build` to disable autoupdate
@maxbrunsfeld
maxbrunsfeld merged commit a97029c into atom:master Sep 24, 2015
@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Thanks @scv119!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants