Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b26b55a061 | |||
| bac8ff71a3 | |||
| ed8a8f13d3 | |||
| 3d740e8e63 | |||
| 1eb312609c | |||
| ce3f8563c4 | |||
| 59998f3950 | |||
| e4dfa52b05 | |||
| 4080c64451 |
@@ -1,5 +1,6 @@
|
|||||||
# Commons
|
# Commons
|
||||||
/node_modules
|
/node_modules
|
||||||
|
*.log
|
||||||
|
|
||||||
# OS
|
# OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Make NPM module leaner
|
||||||
|
|
||||||
|
/scripts
|
||||||
|
.eslintrc
|
||||||
|
.npmrc
|
||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cordova-base64-to-gallery",
|
"name": "cordova-base64-to-gallery",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"description": "Cordova plugin to save base64 data as a png image into the device",
|
"description": "Cordova plugin to save base64 data as a png image into the device",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
"base64",
|
"base64",
|
||||||
"save",
|
"save",
|
||||||
"photo library",
|
"photo library",
|
||||||
|
"gallery",
|
||||||
"ecosystem:cordova",
|
"ecosystem:cordova",
|
||||||
"cordova-ios",
|
"cordova-ios",
|
||||||
"cordova-android",
|
"cordova-android",
|
||||||
@@ -56,6 +57,6 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "1.10.3",
|
"eslint": "1.10.3",
|
||||||
"libxmljs": "0.16.1"
|
"nodemsg": "1.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-8
@@ -1,5 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plugin xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-base64-to-gallery" version="2.0.1">
|
<plugin xmlns:android="http://schemas.android.com/apk/res/android" xmlns="http://www.phonegap.com/ns/plugins/1.0" id="cordova-base64-to-gallery" version="2.0.2">
|
||||||
|
|
||||||
|
<engines>
|
||||||
|
<engine name="cordova-ios" version="<3.8.0" />
|
||||||
|
</engines>
|
||||||
|
|
||||||
<name>base64ToGallery</name>
|
<name>base64ToGallery</name>
|
||||||
|
|
||||||
@@ -17,6 +21,8 @@
|
|||||||
|
|
||||||
<!-- ios -->
|
<!-- ios -->
|
||||||
<platform name="ios">
|
<platform name="ios">
|
||||||
|
<source-file compiler-flags="-fno-objc-arc" src="src/ios/Base64ToGallery.m"/>
|
||||||
|
|
||||||
<config-file parent="/*" target="config.xml">
|
<config-file parent="/*" target="config.xml">
|
||||||
<feature name="Base64ToGallery">
|
<feature name="Base64ToGallery">
|
||||||
<param name="ios-package" value="Base64ToGallery"/>
|
<param name="ios-package" value="Base64ToGallery"/>
|
||||||
@@ -25,12 +31,11 @@
|
|||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<header-file src="src/ios/Base64ToGallery.h"/>
|
<header-file src="src/ios/Base64ToGallery.h"/>
|
||||||
|
|
||||||
<source-file compiler-flags="-fno-objc-arc" src="src/ios/Base64ToGallery.m"/>
|
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
<!-- android -->
|
<!-- android -->
|
||||||
<platform name="android">
|
<platform name="android">
|
||||||
|
<source-file src="src/android/Base64ToGallery.java" target-dir="src/it/nexxa/Base64ToGallery"/>
|
||||||
|
|
||||||
<config-file parent="/*" target="AndroidManifest.xml">
|
<config-file parent="/*" target="AndroidManifest.xml">
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
@@ -41,13 +46,12 @@
|
|||||||
<param name="android-package" value="it.nexxa.base64ToGallery.Base64ToGallery"/>
|
<param name="android-package" value="it.nexxa.base64ToGallery.Base64ToGallery"/>
|
||||||
</feature>
|
</feature>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<source-file src="src/android/Base64ToGallery.java" target-dir="src/it/nexxa/Base64ToGallery"/>
|
|
||||||
|
|
||||||
</platform>
|
</platform>
|
||||||
|
|
||||||
<!-- wp8 -->
|
<!-- wp8 -->
|
||||||
<platform name="wp8">
|
<platform name="wp8">
|
||||||
|
<source-file src="src/wp8/Base64ToGallery.cs"/>
|
||||||
|
|
||||||
<config-file parent="/*" target="config.xml">
|
<config-file parent="/*" target="config.xml">
|
||||||
<feature name="Base64ToGallery">
|
<feature name="Base64ToGallery">
|
||||||
<param name="wp-package" value="Base64ToGallery"/>
|
<param name="wp-package" value="Base64ToGallery"/>
|
||||||
@@ -58,7 +62,5 @@
|
|||||||
<config-file parent="/Deployment/App/Capabilities" target="Properties/WMAppManifest.xml">
|
<config-file parent="/Deployment/App/Capabilities" target="Properties/WMAppManifest.xml">
|
||||||
<Capability Name="ID_CAP_MEDIALIB_PHOTO"/>
|
<Capability Name="ID_CAP_MEDIALIB_PHOTO"/>
|
||||||
</config-file>
|
</config-file>
|
||||||
|
|
||||||
<source-file src="src/wp8/Base64ToGallery.cs"/>
|
|
||||||
</platform>
|
</platform>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -2,18 +2,28 @@
|
|||||||
|
|
||||||
// Modules
|
// Modules
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var libxml = require('libxmljs');
|
var logger = require('nodemsg');
|
||||||
var pkg = require('../package.json');
|
var pkg = require('../package.json');
|
||||||
|
|
||||||
// CONSTS
|
// CONSTS
|
||||||
var CONFIG_FILE = 'plugin.xml';
|
var CONFIG_FILE = 'plugin.xml';
|
||||||
|
var PLUGIN_ID = 'cordova-base64-to-gallery';
|
||||||
|
var ERROR_MSG = 'No "version" attribute found - Please check '+ CONFIG_FILE +' ("version" tag must follow "id" tag)';
|
||||||
|
var REGEXP = '(id="' + PLUGIN_ID + '" )(version="\\d+[.]\\d+[.]\\d+")';
|
||||||
|
|
||||||
var version = pkg.version;
|
// Logic
|
||||||
var configContent = fs.readFileSync(CONFIG_FILE);
|
var version = pkg.version;
|
||||||
var configXML = libxml.parseXmlString(configContent);
|
var regex = new RegExp(REGEXP);
|
||||||
var configVersion = configXML.root().attr('version');
|
var config = fs.readFileSync(CONFIG_FILE, { encoding: 'utf8'});
|
||||||
|
|
||||||
|
// Exit if version tag not found
|
||||||
|
if (!regex.test(config)) {
|
||||||
|
logger.error(ERROR_MSG);
|
||||||
|
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Set version
|
// Set version
|
||||||
configVersion.value(version);
|
config = config.replace(regex, '$1version="' + version + '"');
|
||||||
|
|
||||||
fs.writeFileSync(CONFIG_FILE, configXML.toString());
|
fs.writeFileSync(CONFIG_FILE, config);
|
||||||
|
|||||||
Reference in New Issue
Block a user