CB-12546: move check_reqs to templates directory and update module references.

This commit is contained in:
filmaj
2017-03-14 14:18:00 -07:00
parent 6395eda0c8
commit d40c22441f
19 changed files with 1079 additions and 14 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
under the License.
*/
var check_reqs = require('./lib/check_reqs');
var check_reqs = require('./templates/cordova/lib/check_reqs');
check_reqs.run().done(
function success() {
+1 -3
View File
@@ -23,7 +23,7 @@ var shell = require('shelljs'),
Q = require('q'),
path = require('path'),
fs = require('fs'),
check_reqs = require('./check_reqs'),
check_reqs = require('./../templates/cordova/lib/check_reqs'),
ROOT = path.join(__dirname, '..', '..');
var MIN_SDK_VERSION = 16;
@@ -146,9 +146,7 @@ function copyScripts(projectPath) {
shell.cp('-r', srcScriptsDir, projectPath);
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'check_reqs*'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'lib', 'check_reqs.js'), path.join(projectPath, 'cordova', 'lib', 'check_reqs.js'));
shell.cp(path.join(ROOT, 'bin', 'android_sdk_version*'), destScriptsDir);
shell.cp(path.join(ROOT, 'bin', 'lib', 'android_sdk.js'), path.join(projectPath, 'cordova', 'lib', 'android_sdk.js'));
}
/**
@@ -27,7 +27,7 @@ var shelljs = require('shelljs'),
path = require('path'),
fs = require('fs'),
os = require('os'),
ROOT = path.join(__dirname, '..', '..');
ROOT = path.join(__dirname, '..', '..', '..', '..');
var CordovaError = require('cordova-common').CordovaError;
@@ -58,7 +58,8 @@ module.exports.isDarwin = function() {
return (process.platform == 'darwin');
};
// Get valid target from framework/project.properties
// Get valid target from framework/project.properties if run from this repo
// Otherwise get target from project.properties file within a generated cordova-android project
module.exports.get_target = function() {
function extractFromFile(filePath) {
var target = shelljs.grep(/\btarget=/, filePath);
+3 -4
View File
@@ -31,6 +31,7 @@ var superspawn = require('cordova-common').superspawn;
var CordovaError = require('cordova-common').CordovaError;
var shelljs = require('shelljs');
var android_sdk = require('./android_sdk');
var check_reqs = require('./check_reqs');
var Q = require('q');
var os = require('os');
@@ -200,8 +201,7 @@ module.exports.best_image = function() {
var closest = 9999;
var best = images[0];
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var project_target = require('./check_reqs').get_target().replace('android-', '');
var project_target = check_reqs.get_target().replace('android-', '');
for (var i in images) {
var target = images[i].target;
if(target) {
@@ -280,8 +280,7 @@ module.exports.start = function(emulator_ID, boot_timeout) {
return best.name;
}
// Loading check_reqs at run-time to avoid test-time vs run-time directory structure difference issue
var androidCmd = require('./check_reqs').getAbsoluteAndroidCmd();
var androidCmd = check_reqs.getAbsoluteAndroidCmd();
return Q.reject(new CordovaError('No emulator images (avds) found.\n' +
'1. Download desired System Image by running: ' + androidCmd + ' sdk\n' +
'2. Create an AVD by running: ' + androidCmd + ' avd\n' +
+1 -1
View File
@@ -22,7 +22,7 @@
var devices = require('./device');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
devices.list().done(function(device_list) {
device_list && device_list.forEach(function(dev) {
console.log(dev);
@@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_images().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu.name);
@@ -22,7 +22,7 @@
var emulators = require('./emulator');
// Usage support for when args are given
require('../lib/check_reqs').check_android().then(function() {
require('./check_reqs').check_android().then(function() {
emulators.list_started().done(function(emulator_list) {
emulator_list && emulator_list.forEach(function(emu) {
console.log(emu);