From ed8800d182ca3a696e4939c8dbff3981422cc993 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Mon, 16 Dec 2013 16:28:40 -0800 Subject: [PATCH] Install apm to apm/ from vendor/apm --- .gitignore | 1 + script/bootstrap | 12 ++++++++++-- src/command-installer.coffee | 2 +- src/package-manager.coffee | 2 +- tasks/build-task.coffee | 1 + 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2d2370139..ffb3d24ad 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ debug.log /atom-shell/ docs/output spec/fixtures/evil-files/ +/apm diff --git a/script/bootstrap b/script/bootstrap index 7ab3237d1..0cd8c77de 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,5 +1,6 @@ #!/usr/bin/env node var safeExec = require('./utils/child-process-wrapper.js').safeExec; +var fs = require('fs'); var path = require('path'); // OAuth token for atom-bot @@ -22,13 +23,20 @@ function executeCommands(commands, done, index) { done(null); } +var apmVendorPath = path.resolve(__dirname, '..', 'vendor', 'apm'); +var apmInstallPath = path.resolve(__dirname, '..', 'apm'); +if (!fs.existsSync(apmInstallPath)) + fs.mkdirSync(apmInstallPath); +if (!fs.existsSync(path.join(apmInstallPath, 'node_modules'))) + fs.mkdirSync(path.join(apmInstallPath, 'node_modules')); + var apmFlags = process.env.JANKY_SHA1 || process.argv.indexOf('--no-color') !== -1 ? '--no-color' : ''; var echoNewLine = process.platform == 'win32' ? 'echo.' : 'echo'; var commands = [ 'git submodule --quiet sync', 'git submodule --quiet update --recursive --init', - {command: 'npm install --quiet .', options: {cwd: path.resolve(__dirname, '..', 'vendor', 'apm'), ignoreStdout: true}}, - {command: 'npm install --quiet vendor/apm', options: {ignoreStdout: true}}, + {command: 'npm install --quiet', options: {cwd: apmVendorPath, ignoreStdout: true}}, + {command: 'npm install --quiet ' + apmVendorPath, options: {cwd: apmInstallPath, ignoreStdout: true}}, echoNewLine, 'node node_modules/atom-package-manager/bin/apm clean ' + apmFlags, 'node node_modules/atom-package-manager/bin/apm install --quiet ' + apmFlags, diff --git a/src/command-installer.coffee b/src/command-installer.coffee index b1515d46f..aa6a9e803 100644 --- a/src/command-installer.coffee +++ b/src/command-installer.coffee @@ -64,5 +64,5 @@ module.exports = resourcePath = null resourcePath ?= atom.getLoadSettings().resourcePath - commandPath = path.join(resourcePath, 'node_modules', '.bin', 'apm') + commandPath = path.join(resourcePath, 'apm', 'node_modules', '.bin', 'apm') @install(commandPath, callback) diff --git a/src/package-manager.coffee b/src/package-manager.coffee index a85e51e43..67aed661e 100644 --- a/src/package-manager.coffee +++ b/src/package-manager.coffee @@ -39,7 +39,7 @@ class PackageManager # Public: Get the path to the apm command getApmPath: -> - @apmPath ?= require.resolve('atom-package-manager/bin/apm') + @apmPath ?= require.resolve('../apm/node_modules/atom-package-manager/bin/apm') # Public: Get the paths being used to look for packages. # diff --git a/tasks/build-task.coffee b/tasks/build-task.coffee index c0f0ae4f2..1f95e76c4 100644 --- a/tasks/build-task.coffee +++ b/tasks/build-task.coffee @@ -21,6 +21,7 @@ module.exports = (grunt) -> cp 'atom.sh', path.join(appDir, 'atom.sh') cp 'package.json', path.join(appDir, 'package.json') + cp 'apm', path.join(appDir, 'apm') packageDirectories = [] nonPackageDirectories = [