Skip to content

Commit

Permalink
👗 Cut nsis 0.0.173
Browse files Browse the repository at this point in the history
  • Loading branch information
albertzak committed Feb 17, 2019
1 parent 3336827 commit 2c8300e
Show file tree
Hide file tree
Showing 11 changed files with 3,876 additions and 4,948 deletions.
230 changes: 0 additions & 230 deletions app/electron/Gruntfile.js

This file was deleted.

31 changes: 31 additions & 0 deletions app/electron/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '{build}'

branches:
only:
- master

shallow_clone: true

environment:
nodejs_version: '10.15.1'

install:
- ps: >-
Install-Product node $env:nodejs_version
choco install autoit.commandline
choco install yarn
echo "node version"
node --version
- cmd: >-
cd app\electron\
yarn
build_script:
- ps: >-
cmd /c 'yarn run release 2>&1'
29 changes: 16 additions & 13 deletions app/electron/compileAutoIt.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
const path = require('path')
const childProcess = require('child_process')

const main = () => {
const main = async (afterPackContext) => {
console.log('[compileAutoIt]', afterPackContext)

const au3Path = path.join(__dirname, 'assets', 'generateEoswinReports.au3')
const exePath = path.join(__dirname, 'build', 'javascript', 'generateEoswinReports.exe')
const exePath = path.join(afterPackContext.appOutDir, 'generateEoswinReports.exe')

compile(au3Path, exePath)
.then(() => console.log('[compile] Success'))
.catch(code => {
console.error('[compile] Compiler exited with code', code)
process.exit(code)
})
try {
await compile(au3Path, exePath)
} catch (code) {
throw new Error(`[compileAutoIt] Compiler exited with code ${code}`)
}

console.log('[compileAutoIt] Success')
}

const compile = (input, output) => {
Expand All @@ -21,22 +24,22 @@ const compile = (input, output) => {
'/console'
]

console.log('[compile] Compiling: Aut2exe', args)
console.log('[compileAutoIt] Compiling: Aut2exe', args)

const compiler = childProcess.spawn('Aut2exe', args)
compiler.stdout.setEncoding('utf8')

compiler.stdout.on('data', d =>
console.log('[compile]', d)
console.log('[compileAutoIt]', d)
)

compiler.stderr.on('data', d =>
console.error('[compile] error:', d)
console.error('[compileAutoIt] error:', d)
)

return new Promise((resolve, reject) => {
compiler.on('close', code => {
console.log('[compile] Compiler exited with code', code)
console.log('[compileAutoIt] Compiler exited with code', code)

if (code === 0) {
resolve(output)
Expand All @@ -47,4 +50,4 @@ const compile = (input, output) => {
})
}

main()
module.exports = main
2 changes: 1 addition & 1 deletion app/electron/main/manifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { app } = require('electron')

module.exports = {
appId: 'com.squirrel.rslnd.rosalind',
appId: 'com.rslnd.rosalind',
name: 'Rosalind',
productName: 'Rosalind',
version: app.getVersion()
Expand Down
22 changes: 9 additions & 13 deletions app/electron/main/updater.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
const { app, autoUpdater, ipcMain } = require('electron')
const { app, ipcMain } = require('electron')
const { autoUpdater } = require('electron-updater')
const logger = require('./logger')
const manifest = require('./manifest')
const settings = require('./settings')
const shortcuts = require('./shortcuts')
const { captureException } = require('@sentry/electron')

autoUpdater.logger = logger

let updateDownloaded = false
let mainWindow = null

Expand Down Expand Up @@ -58,29 +61,22 @@ const handleStartupEvent = () => {
const start = () => {
if (process.platform !== 'win32') { return }

logger.info('[Updater] Setting feed URL')
const feedBaseUrl = (settings && settings.updateUrl) || 'https://update.rslnd.com'
const feedUrl = feedBaseUrl + '/update/' + process.platform + '/v' + manifest.version
autoUpdater.setFeedURL(feedUrl)

autoUpdater.on('error', (err) => {
if (err) {
if (typeof err === 'string' && err.indexOf('Remote release File is empty or corrupted') > -1) { return }
if (typeof err === 'object' && err.message && err.message.indexOf('Remote release File is empty or corrupted') > -1) { return }
captureException(err)
logger.error('[Updater] Errored with', err)
}
})

autoUpdater.on('update-available', () => {
logger.info('[Updater] New update available')
autoUpdater.on('update-available', info => {
logger.info(`[Updater] New update available: ${info.version}`)
})

autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName, releaseDate, updateURL) => {
logger.info('[Updater] New update downloaded', { event, releaseNotes, releaseName, releaseDate, updateURL })
autoUpdater.on('update-downloaded', info => {
logger.info(`[Updater] New update downloaded: ${info.version}`)

if (mainWindow) {
mainWindow.webContents.send('update/available', { newVersion: releaseName })
mainWindow.webContents.send('update/available', { newVersion: info.version })
}

updateDownloaded = true
Expand Down
Loading

0 comments on commit 2c8300e

Please sign in to comment.