Skip to content

Commit

Permalink
CB-12546: move check_reqs to templates directory and update module re…
Browse files Browse the repository at this point in the history
…ferences.
  • Loading branch information
filmaj committed Mar 20, 2017
1 parent 6395eda commit d40c224
Show file tree
Hide file tree
Showing 19 changed files with 1,079 additions and 14 deletions.
2 changes: 1 addition & 1 deletion bin/check_reqs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 1 addition & 3 deletions bin/lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions bin/templates/cordova/lib/emulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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' +
Expand Down
2 changes: 1 addition & 1 deletion bin/templates/cordova/lib/list-devices
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion bin/templates/cordova/lib/list-emulator-images
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion bin/templates/cordova/lib/list-started-emulators
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions node_modules/pseudomap/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions node_modules/pseudomap/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions node_modules/pseudomap/map.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 85 additions & 0 deletions node_modules/pseudomap/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions node_modules/pseudomap/pseudomap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d40c224

Please sign in to comment.