diff --git a/.gitignore b/.gitignore index 7b9e66caf1..c6befdab3f 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,6 @@ cache # Tests .test settings.json + +# IDEs +.idea \ No newline at end of file diff --git a/__tests__/SetupStore-test.js b/__tests__/SetupStore-test.js index 1410a883b0..b26471e2c8 100644 --- a/__tests__/SetupStore-test.js +++ b/__tests__/SetupStore-test.js @@ -12,7 +12,7 @@ describe('SetupStore', function () { pit('downloads virtualbox if it is not installed', function () { virtualBox.installed.mockReturnValue(false); setupUtil.download.mockReturnValue(Promise.resolve()); - util.packagejson.mockReturnValue({'virtualbox-filename': ''}); + setupUtil.virtualBoxFileName.mockReturnValue(''); util.supportDir.mockReturnValue(''); return setupStore.steps().download.run().then(() => { expect(setupUtil.download).toBeCalled(); @@ -24,7 +24,7 @@ describe('SetupStore', function () { virtualBox.version.mockReturnValue(Promise.resolve('4.3.16')); setupUtil.compareVersions.mockReturnValue(-1); setupUtil.download.mockReturnValue(Promise.resolve()); - util.packagejson.mockReturnValue({'virtualbox-filename': ''}); + setupUtil.virtualBoxFileName.mockReturnValue(''); util.supportDir.mockReturnValue(''); return setupStore.steps().download.run().then(() => { expect(setupUtil.download).toBeCalled(); @@ -34,10 +34,11 @@ describe('SetupStore', function () { describe('install step', function () { util.exec.mockReturnValue(Promise.resolve()); - setupUtil.copyBinariesCmd.mockReturnValue('copycmd'); - setupUtil.fixBinariesCmd.mockReturnValue('fixcmd'); + util.execProper.mockReturnValue(Promise.resolve()); + setupUtil.copyBinariesCmd.mockReturnValue(Promise.resolve()); + setupUtil.fixBinariesCmd.mockReturnValue(Promise.resolve()); virtualBox.killall.mockReturnValue(Promise.resolve()); - setupUtil.installVirtualBoxCmd.mockReturnValue('installvb'); + setupUtil.installVirtualBoxCmd.mockReturnValue(Promise.resolve()); setupUtil.macSudoCmd.mockImplementation(cmd => 'macsudo ' + cmd); pit('installs virtualbox if it is not installed', function () { @@ -45,7 +46,9 @@ describe('SetupStore', function () { util.exec.mockReturnValue(Promise.resolve()); return setupStore.steps().install.run().then(() => { expect(virtualBox.killall).toBeCalled(); - expect(util.exec).toBeCalledWith('macsudo copycmd && fixcmd && installvbcmd'); + expect(setupUtil.copyBinariesCmd).toBeCalled(); + expect(setupUtil.fixBinariesCmd).toBeCalled(); + expect(setupUtil.installVirtualBoxCmd).toBeCalled(); }); }); @@ -54,7 +57,9 @@ describe('SetupStore', function () { setupUtil.compareVersions.mockReturnValue(0); setupUtil.needsBinaryFix.mockReturnValue(true); return setupStore.steps().install.run().then(() => { - expect(util.exec).toBeCalledWith('macsudo copycmd && fixcmd'); + expect(setupUtil.copyBinariesCmd).toBeCalled(); + expect(setupUtil.fixBinariesCmd).toBeCalled(); + expect(setupUtil.installVirtualBoxCmd).not.toBeCalled(); }); }); }); diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..79ad0eb510 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,21 @@ +# Test against this version of Node.js +environment: + nodejs_version: "0.10" + +# Install scripts. (runs after repo cloning) +install: + # Get the latest stable version of Node.js or io.js + - ps: Install-Product node $env:nodejs_version + # Updating NPM to avoid permission issues: http://www.appveyor.com/docs/lang/nodejs-iojs#locking-errors-eperm-eexist-tgz-lock + - npm -g install npm@2 + - set PATH=%APPDATA%\npm;%PATH% + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm test \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 2836301e15..d08a68aa5a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,6 +2,7 @@ var babel = require('gulp-babel'); var changed = require('gulp-changed'); var concat = require('gulp-concat'); var cssmin = require('gulp-cssmin'); +var rename = require('gulp-rename'); var downloadatomshell = require('gulp-download-atom-shell'); var fs = require('fs'); var gulp = require('gulp'); @@ -167,11 +168,56 @@ gulp.task('settings', function () { string_src('settings.json', JSON.stringify(settings)).pipe(gulp.dest('dist/osx/' + options.appFilename.replace(' ', '\ ').replace('(','\(').replace(')','\)') + '/Contents/Resources/app')); }); -gulp.task('release', function () { - runSequence('download', 'dist', ['copy', 'images', 'js', 'styles', 'settings'], 'sign', 'zip'); +gulp.task('download-deps', function () { + if(process.platform === 'win32') { + return gulp.src('').pipe( + shell(['powershell.exe -ExecutionPolicy unrestricted -File util\\deps.ps1']) + ); + } else { + return gulp.src('').pipe( + shell(['./util/deps']) + ); + } }); -gulp.task('default', ['download', 'copy', 'js', 'images', 'styles'], function () { +gulp.task('copy-icns', ['download'], function () { + if(process.platform === 'win32') { + return gulp.src(options.icon) + .pipe(rename('atom.icns')) + .pipe(gulp.dest('./cache/resources')); + } else { + return gulp.src(options.icon) + .pipe(rename('atom.icns')) + .pipe(gulp.dest('./cache/Atom.app/Contents/Resources')); + } +}); + +gulp.task('copy-plist', ['download'], function (done) { + if(process.platform === 'darwin') { + return gulp.src('./util/Info.plist') + .pipe(gulp.dest('./cache/Atom.app/Contents')); + } else { + done(); + } +}); + +gulp.task('reset', function () { + if(process.platform === 'win32') { + return gulp.src('').pipe( + shell(['powershell.exe -ExecutionPolicy unrestricted -Command "Start-Process powershell -verb runas -ArgumentList \\\"-ExecutionPolicy unrestricted -file c:\\Users\\Dominik\\Documents\\GitHub\\kitematic\\util\\reset.ps1\\\" -Wait"']) + ); + } else { + return gulp.src('').pipe( + shell(['./util/reset']) + ); + } +}); + +gulp.task('release', function () { + runSequence('download-deps', 'download', 'copy-icns', 'copy-plist', 'dist', ['copy', 'images', 'js', 'styles', 'settings'], 'sign', 'zip'); +}); + +gulp.task('default', ['download-deps', 'download', 'copy-icns', 'copy-plist', 'copy', 'js', 'images', 'styles'], function () { gulp.watch('src/**/*.js', ['js']); gulp.watch('index.html', ['copy']); gulp.watch('styles/**/*.less', ['styles']); @@ -181,7 +227,14 @@ gulp.task('default', ['download', 'copy', 'js', 'images', 'styles'], function () var env = process.env; env.NODE_ENV = 'development'; - gulp.src('').pipe(shell(['./cache/Atom.app/Contents/MacOS/Atom .'], { - env: env - })); + + if(process.platform === 'win32') { + gulp.src('').pipe(shell(['cache\\atom.exe .'], { + env: env + })); + } else { + gulp.src('').pipe(shell(['./cache/Atom.app/Contents/MacOS/Atom .'], { + env: env + })); + } }); diff --git a/index.html b/index.html index 86d233b8db..2301b021e4 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,6 @@