Skip to content

Commit e843046

Browse files
author
Igor Khomenko
committed
added cordova demo app
1 parent c8c3231 commit e843046

File tree

236 files changed

+24959
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+24959
-0
lines changed

samples/cordova/config.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>HelloCordova</name>
4+
<description>
5+
A sample Apache Cordova application that responds to the deviceready event.
6+
</description>
7+
<author email="[email protected]" href="http://cordova.io">
8+
Apache Cordova Team
9+
</author>
10+
<content src="index.html" />
11+
<plugin name="cordova-plugin-whitelist" spec="1" />
12+
<access origin="*" />
13+
<allow-intent href="http://*/*" />
14+
<allow-intent href="https://*/*" />
15+
<allow-intent href="tel:*" />
16+
<allow-intent href="sms:*" />
17+
<allow-intent href="mailto:*" />
18+
<allow-intent href="geo:*" />
19+
<platform name="android">
20+
<allow-intent href="market:*" />
21+
</platform>
22+
<platform name="ios">
23+
<allow-intent href="itms:*" />
24+
<allow-intent href="itms-apps:*" />
25+
</platform>
26+
</widget>

samples/cordova/hooks/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
-->
21+
# Cordova Hooks
22+
23+
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"prepare_queue": {
3+
"installed": [],
4+
"uninstalled": []
5+
},
6+
"config_munge": {
7+
"files": {}
8+
},
9+
"installed_plugins": {
10+
"cordova-plugin-whitelist": {
11+
"PACKAGE_NAME": "io.cordova.hellocordova"
12+
}
13+
},
14+
"dependent_plugins": {},
15+
"modules": [],
16+
"plugin_metadata": {
17+
"cordova-plugin-whitelist": "1.2.2"
18+
}
19+
}
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
3+
<name>HelloCordova</name>
4+
<description>
5+
A sample Apache Cordova application that responds to the deviceready event.
6+
</description>
7+
<author email="[email protected]" href="http://cordova.io">
8+
Apache Cordova Team
9+
</author>
10+
<content src="index.html" />
11+
<access origin="*" />
12+
<allow-intent href="http://*/*" />
13+
<allow-intent href="https://*/*" />
14+
<allow-intent href="tel:*" />
15+
<allow-intent href="sms:*" />
16+
<allow-intent href="mailto:*" />
17+
<allow-intent href="geo:*" />
18+
</widget>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
*/
21+
22+
23+
var build = require('./lib/build'),
24+
args = process.argv;
25+
26+
// provide help
27+
if ( args[2] == '--help' || args[2] == '/?' || args[2] == '-h' || args[2] == '/h' ||
28+
args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
29+
build.help();
30+
process.exit(0);
31+
} else {
32+
33+
build.run();
34+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
:: Licensed to the Apache Software Foundation (ASF) under one
2+
:: or more contributor license agreements. See the NOTICE file
3+
:: distributed with this work for additional information
4+
:: regarding copyright ownership. The ASF licenses this file
5+
:: to you under the Apache License, Version 2.0 (the
6+
:: "License"); you may not use this file except in compliance
7+
:: with the License. You may obtain a copy of the License at
8+
::
9+
:: http://www.apache.org/licenses/LICENSE-2.0
10+
::
11+
:: Unless required by applicable law or agreed to in writing,
12+
:: software distributed under the License is distributed on an
13+
:: "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
:: KIND, either express or implied. See the License for the
15+
:: specific language governing permissions and limitations
16+
:: under the License.
17+
18+
@ECHO OFF
19+
SET script_path="%~dp0build"
20+
IF EXIST %script_path% (
21+
node %script_path% %*
22+
) ELSE (
23+
ECHO.
24+
ECHO ERROR: Could not find 'build' script in 'cordova' folder, aborting...>&2
25+
EXIT /B 1
26+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
*/
21+
22+
23+
var path = require('path'),
24+
clean = require('./lib/clean'),
25+
reqs = require('./lib/check_reqs'),
26+
args = process.argv;
27+
28+
// Support basic help commands
29+
if ( args.length > 2
30+
|| args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
31+
args[2] == 'help' || args[2] == '-help' || args[2] == '/help') {
32+
console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'clean')) );
33+
process.exit(0);
34+
} else {
35+
clean.cleanProject();
36+
}
37+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version='1.0' encoding='utf-8'?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
21+
22+
</widget>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
var path = require('path'),
23+
fs = require('fs'),
24+
shjs = require('shelljs'),
25+
zip = require('adm-zip'),
26+
Q = require('q'),
27+
clean = require('./clean'),
28+
check_reqs = require('./check_reqs'),
29+
platformWwwDir = path.join('platforms', 'browser', 'www'),
30+
platformBuildDir = path.join('platforms', 'browser', 'build'),
31+
packageFile = path.join(platformBuildDir, 'package.zip');
32+
33+
/**
34+
* run
35+
* Creates a zip file int platform/build folder
36+
*/
37+
module.exports.run = function(){
38+
39+
return check_reqs.run()
40+
.then(function(){
41+
return clean.cleanProject();
42+
},
43+
function checkReqsError(err){
44+
console.error('Please make sure you meet the software requirements in order to build a browser cordova project');
45+
})
46+
.then(function(){
47+
48+
if (!fs.existsSync(platformBuildDir)) {
49+
fs.mkdirSync(platformBuildDir);
50+
}
51+
52+
// add the project to a zipfile
53+
var zipFile = zip();
54+
zipFile.addLocalFolder(platformWwwDir, '.');
55+
zipFile.writeZip(packageFile);
56+
57+
return Q.resolve();
58+
59+
});
60+
};
61+
62+
module.exports.help = function() {
63+
console.log('Usage: cordova build browser');
64+
console.log('Build will create the packaged app in \''+platformBuildDir+'\'.');
65+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
*/
21+
22+
//add methods as we determine what are the requirements
23+
24+
var Q = require('q');
25+
26+
module.exports.run = function() {
27+
return Q.resolve();
28+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env node
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
var fs = require('fs'),
23+
shjs = require('shelljs'),
24+
path = require('path'),
25+
check_reqs = require('./check_reqs'),
26+
platformBuildDir = path.join('platforms', 'browser', 'build');
27+
28+
exports.cleanProject = function(){
29+
30+
// Check that requirements are (stil) met
31+
if (!check_reqs.run()) {
32+
console.error('Please make sure you meet the software requirements in order to clean an browser cordova project');
33+
process.exit(2);
34+
}
35+
36+
console.log('Cleaning Browser project');
37+
try {
38+
if (fs.existsSync(platformBuildDir)) {
39+
shjs.rm('-r', platformBuildDir);
40+
}
41+
}
42+
catch(err) {
43+
console.log('could not remove '+platformBuildDir+' : '+err.message);
44+
}
45+
};
46+

0 commit comments

Comments
 (0)