Skip to content

Review create default values and small rework #1100

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Podfile.prototype.__parseForDeclarations = function (text) {
// split by \n
const arr = text.split('\n');

// getting lines between "platform :ios, '11.0'"" and "target 'HelloCordova'" do
// getting lines between "platform :ios, '11.0'"" and "target 'Hello Cordova'" do
const declarationsPreRE = /platform :ios,\s+'[^']+'/;
const declarationsPostRE = /target\s+'[^']+'\s+do/;
const declarationRE = /^\s*[^#]/;
Expand Down
14 changes: 9 additions & 5 deletions lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ const ROOT = path.join(__dirname, '..');
* @returns {Promise<void>} resolves when the project has been created
*/
exports.createProject = async (project_path, package_name, project_name, opts) => {
package_name = package_name || 'my.cordova.project';
project_name = project_name || 'CordovaExample';
opts = opts || {};

// check that project path doesn't exist
// Set default values for path, package and name
project_path = path.relative(process.cwd(), project_path);
// Check if project already exists
if (fs.existsSync(project_path)) {
throw new CordovaError('Project already exists');
throw new CordovaError('Project already exists! Delete and recreate');
}

package_name = package_name || 'io.cordova.helloCordova';
project_name = project_name || 'Hello Cordova';

events.emit('log', 'Creating Cordova project for the iOS platform:');
events.emit('log', `\tPath: ${path.relative(process.cwd(), project_path)}`);
events.emit('log', `\tPath: ${project_path}`);
events.emit('log', `\tPackage: ${package_name}`);
events.emit('log', `\tName: ${project_name}`);

Expand Down
2 changes: 1 addition & 1 deletion templates/project/__PROJECT_NAME__/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<widget xmlns = "http://www.w3.org/ns/widgets"
id = "io.cordova.helloCordova"
version = "2.0.0">
<name>HelloCordova</name>
<name>Hello Cordova</name>

<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/dummyProj/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-for-media="false" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-for-media="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-in-media="false" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-in-media="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-in-web-content="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-local-networking="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="http://cordova.apache.org" allows-arbitrary-loads-in-web-content="true" allows-arbitrary-loads-in-media="true" allows-local-networking="true" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<allow-navigation href="http://cordova.apache.org" allows-arbitrary-loads-in-web-content="true" allows-arbitrary-loads-in-media="true" allows-local-networking="true" />
</widget>
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/prepare/wildcard-navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<allow-navigation href="*" />
</widget>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
under the License.
-->

<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SampleApp</name>
<access origin="*" allows-arbitrary-loads-in-web-content="true" allows-arbitrary-loads-in-media="true" allows-local-networking="true" />
</widget>
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/resource-file-support/config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/test-config-2.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/test-config-3.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="io.cordova.hellocordova.android" id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="io.cordova.helloCordova.android" id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down
2 changes: 1 addition & 1 deletion tests/spec/unit/fixtures/test-config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.cordova.helloCordova" ios-CFBundleIdentifier="io.cordova.helloCordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Hello Cordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
Expand Down