-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RHMHCP-CLI #3,#5] - init command and hooks #9
Conversation
@@ -0,0 +1,10 @@ | |||
# Tells the .editorconfg plugin to stop searching once it finds this file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep code indents standard.
@@ -0,0 +1,43 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some simple eslint rules - no need to be strict yet, but should try follow some guide.
|
||
Copyright (c) 2010-2017 Google, Inc. http://angularjs.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we want to remove this? 😂
* @return {Promise<Object>} | ||
*/ | ||
exports.generateConfig = function (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main new addition here. It will generate a new config. Should probably add some assert
calls?
* @return {String} | ||
*/ | ||
exports.getCordovaLocation = function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense to have these so we can change cordova.location
etc without needing to change these calls elsewhere
@@ -1,7 +1,7 @@ | |||
exports.get = get; | |||
exports.set = set; | |||
var def = { | |||
"configFile": "rhmhcp.json" | |||
"RHM_HCP_CFG": "rhmhcp.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be an env-var? Changed to match env var casing standards just in case
.then(() => log.progress('project initialisation complete!')); | ||
} | ||
|
||
if (isRhmcpReady()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick check to ask user if they want to override existing rhmcp.json
* @param {Object} args | ||
*/ | ||
function verifyArgs (args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe support more args from the plugin, such as autoupdate
?
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to clean logging approaches up.
{ | ||
type: 'list', | ||
name: 'cordova.location', | ||
message: 'Where is the Cordova executable located? Local is recommended to avoid versioning issues.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows user to choose cordova installed in node_modules, global, or custom binary location.
* Add any required hooks to the project. For now the hook simply ensures the rhmcp.json file is copied into www/ | ||
* @return {Promise<undefined>} | ||
*/ | ||
function addHooks () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add more hooks here if necessary later.
const mkdirSync = require('mkdirp').sync; | ||
const fs = require('fs'); | ||
const join = require('path').join; | ||
const et = require('elementtree'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used to update config.xml
. Seems like cordova-cli uses this too
cli/lib/platforms/cordova/util.js
Outdated
* We might need to resolve strings such as "local" or "global" to an actual path | ||
* @return {String} | ||
*/ | ||
function resolveCordovaLocation () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses the setting chosen by the user on init
to determine which cordova binary to use.
@@ -1,24 +1,30 @@ | |||
{ | |||
"name": "rhmhcp-cli", | |||
"version": "1.0.0", | |||
"description": "RedHat Mobile Hot Code Push Command Line", | |||
"version": "0.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think 0.1.0
is best for "unstable"?
This is the start for #3 and #5 features. Here's what it looks like in usage:
Asks user what cordova binary we should use, installs hcp plugin, updates config.xml, adds before hook - done.