diff --git a/atom.sh b/atom.sh index cd1137051..80e186fd4 100755 --- a/atom.sh +++ b/atom.sh @@ -66,14 +66,17 @@ if [ $OS == 'Mac' ]; then open -a "$ATOM_PATH/$ATOM_APP_NAME" -n --args --executed-from="$(pwd)" --pid=$$ "$@" fi elif [ $OS == 'Linux' ]; then - ATOM_PATH='/opt/Atom/atom' + SCRIPT=`readlink -f "$0"` + USR_DIRECTORY=`readlink -f $(dirname $SCRIPT)/..` + ATOM_PATH="$USR_DIRECTORY/share/atom/atom" + [ -x "$ATOM_PATH" ] || ATOM_PATH='/tmp/atom-build/Atom/atom' if [ $EXPECT_OUTPUT ]; then "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" exit $? else - nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > /dev/null & + nohup "$ATOM_PATH" --executed-from="$(pwd)" --pid=$$ "$@" > /dev/null 2>&1 & fi fi diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 118824f1f..307dfb1a5 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -39,35 +39,33 @@ module.exports = (grunt) -> if process.platform is 'win32' appName = 'Atom' tmpDir = os.tmpdir() - installRoot = process.env.ProgramFiles buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build') symbolsDir = path.join(buildDir, 'Atom.breakpad.syms') shellAppDir = path.join(buildDir, appName) contentsDir = shellAppDir appDir = path.join(shellAppDir, 'resources', 'app') atomShellDownloadDir = path.join(os.tmpdir(), 'atom-cached-atom-shells') + installDir = path.join(process.env.ProgramFiles, appName) else if process.platform is 'darwin' appName = 'Atom.app' tmpDir = '/tmp' - installRoot = '/Applications' buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build') symbolsDir = path.join(buildDir, 'Atom.breakpad.syms') shellAppDir = path.join(buildDir, appName) contentsDir = path.join(shellAppDir, 'Contents') appDir = path.join(contentsDir, 'Resources', 'app') atomShellDownloadDir = '/tmp/atom-cached-atom-shells' + installDir = path.join('/Applications', appName) else appName = 'Atom' tmpDir = '/tmp' - installRoot = '/opt' buildDir = grunt.option('build-dir') ? path.join(tmpDir, 'atom-build') symbolsDir = path.join(buildDir, 'Atom.breakpad.syms') shellAppDir = path.join(buildDir, appName) contentsDir = shellAppDir appDir = path.join(shellAppDir, 'resources', 'app') atomShellDownloadDir = '/tmp/atom-cached-atom-shells' - - installDir = path.join(installRoot, appName) + installDir = process.env.INSTALL_PREFIX ? '/usr/local' coffeeConfig = options: diff --git a/build/tasks/install-task.coffee b/build/tasks/install-task.coffee index 273e1b5ef..6ad119b83 100644 --- a/build/tasks/install-task.coffee +++ b/build/tasks/install-task.coffee @@ -15,7 +15,16 @@ module.exports = (grunt) -> createShortcut = path.resolve 'script', 'create-shortcut.cmd' runas('cmd', ['/c', createShortcut, path.join(installDir, 'atom.exe'), 'Atom']) - else + else if process.platform is 'darwin' rm installDir mkdir path.dirname(installDir) cp shellAppDir, installDir + else + binDir = path.join(installDir, 'bin') + shareDir = path.join(installDir, 'share', 'atom') + + mkdir binDir + cp 'atom.sh', path.join(binDir, 'atom') + rm shareDir + mkdir path.dirname(shareDir) + cp shellAppDir, shareDir diff --git a/build/tasks/mkdeb-task.coffee b/build/tasks/mkdeb-task.coffee new file mode 100644 index 000000000..2d503ac7f --- /dev/null +++ b/build/tasks/mkdeb-task.coffee @@ -0,0 +1,31 @@ +fs = require 'fs' +path = require 'path' +_ = require 'underscore-plus' + +fillTemplate = (filePath, data) -> + template = _.template(String(fs.readFileSync(filePath + '.in'))) + filled = template(data) + fs.writeFileSync(filePath, filled) + +module.exports = (grunt) -> + {spawn} = require('./task-helpers')(grunt) + + grunt.registerTask 'mkdeb', 'Create debian package', -> + done = @async() + + {name, version, description} = grunt.file.readJSON('package.json') + section = 'devel' + arch = 'amd64' + maintainer = 'GitHub ' + data = {name, version, description, section, arch, maintainer} + + control = path.join('resources', 'linux', 'debian', 'control') + fillTemplate(control, data) + desktop = path.join('resources', 'linux', 'Atom.desktop') + fillTemplate(desktop, data) + icon = path.join('resources', 'atom.png') + buildDir = grunt.config.get('atom.buildDir') + + cmd = path.join('script', 'mkdeb') + args = [version, control, desktop, icon, buildDir] + spawn({cmd, args}, done) diff --git a/package.json b/package.json index 9f4782340..d3ecefcad 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "atom", "productName": "Atom", "version": "0.77.0", + "description": "A hackable text editor for the 21st Century.", "main": "./src/browser/main.js", "repository": { "type": "git", diff --git a/resources/linux/Atom.desktop.in b/resources/linux/Atom.desktop.in new file mode 100644 index 000000000..e88ed122f --- /dev/null +++ b/resources/linux/Atom.desktop.in @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Atom +Comment=<%= description %> +Exec=/usr/share/atom/atom %U +Icon=atom +Type=Application +StartupNotify=true +Categories=GNOME;GTK;Utility;TextEditor; diff --git a/resources/linux/debian/control.in b/resources/linux/debian/control.in new file mode 100644 index 000000000..cf670e62b --- /dev/null +++ b/resources/linux/debian/control.in @@ -0,0 +1,8 @@ +Package: <%= name %> +Version: <%= version %> +Section: <%= section %> +Priority: optional +Architecture: <%= arch %> +Installed-Size: `du -ks usr|cut -f 1` +Maintainer: <%= maintainer %> +Description: <%= description %> diff --git a/script/bootstrap b/script/bootstrap index a747b0e50..5fbd39981 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var nodeMinorVersion = process.versions.node.split('.')[1] if (nodeMinorVersion !== '10') { diff --git a/script/build b/script/build index 5130d385a..1f0f123ce 100755 --- a/script/build +++ b/script/build @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var cp = require('./utils/child-process-wrapper.js'); var path = require('path'); diff --git a/script/cibuild b/script/cibuild index 6c7cb8ef5..4191500ad 100755 --- a/script/cibuild +++ b/script/cibuild @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var cp = require('./utils/child-process-wrapper.js'); var fs = require('fs'); var path = require('path'); diff --git a/script/clean b/script/clean index db1e5c578..499477833 100755 --- a/script/clean +++ b/script/clean @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var cp = require('./utils/child-process-wrapper.js'); var path = require('path'); var os = require('os'); diff --git a/script/grunt b/script/grunt index 1523b2fed..851cad0b1 100755 --- a/script/grunt +++ b/script/grunt @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var cp = require('./utils/child-process-wrapper.js'); var path = require('path'); diff --git a/script/mkdeb b/script/mkdeb new file mode 100755 index 000000000..66ce9686b --- /dev/null +++ b/script/mkdeb @@ -0,0 +1,31 @@ +#!/bin/bash +# mkdeb version control-file-path deb-file-path + +SCRIPT=`readlink -f "$0"` +ROOT=`readlink -f $(dirname $SCRIPT)/..` +cd $ROOT + +VERSION="$1" +CONTROL_FILE="$2" +DESKTOP_FILE="$3" +ICON_FILE="$4" +DEB_PATH="$5" + +TARGET_ROOT="`mktemp -d`" +TARGET="$TARGET_ROOT/atom-$VERSION" + +mkdir -p "$TARGET/usr" +env INSTALL_PREFIX="$TARGET/usr" script/grunt install + +mkdir -p "$TARGET/DEBIAN" +mv "$CONTROL_FILE" "$TARGET/DEBIAN/control" + +mkdir -p "$TARGET/usr/share/applications" +mv "$DESKTOP_FILE" "$TARGET/usr/share/applications" + +mkdir -p "$TARGET/usr/share/pixmaps" +cp "$ICON_FILE" "$TARGET/usr/share/pixmaps" + +dpkg-deb -b "$TARGET" +mv "$TARGET_ROOT/atom-$VERSION.deb" "$DEB_PATH" +rm -rf $TARGET_ROOT diff --git a/script/test b/script/test index cb32a470b..2c3b37147 100755 --- a/script/test +++ b/script/test @@ -1,4 +1,4 @@ -#!/usr/bin/env node --harmony_collections +#!/usr/bin/env node var safeExec = require('./utils/child-process-wrapper.js').safeExec; var path = require('path'); diff --git a/src/browser/main.coffee b/src/browser/main.coffee index cd3483dd0..5cff80f4f 100644 --- a/src/browser/main.coffee +++ b/src/browser/main.coffee @@ -9,12 +9,7 @@ optimist = require 'optimist' nslog = require 'nslog' dialog = require 'dialog' -console.log = (args...) -> - # TODO: Make NSLog work as expected - output = args.map((arg) -> JSON.stringify(arg)).join(" ") - nslog(output) - if process.platform isnt 'darwin' - fs.writeFileSync('debug.log', output, flag: 'a') +console.log = nslog process.on 'uncaughtException', (error={}) -> nslog(error.message) if error.message?