9 Commits
2.0.1 ... 2.0.2

Author SHA1 Message Date
StefanoMagrassi
b26b55a061 Merge branch 'release-2.0.2' 2016-01-20 18:01:10 +01:00
StefanoMagrassi
bac8ff71a3 version 2.0.2 2016-01-20 18:00:59 +01:00
StefanoMagrassi
ed8a8f13d3 Merge branch 'update-version-script' 2016-01-20 17:58:34 +01:00
StefanoMagrassi
3d740e8e63 removed libxmljs and back to good ol' regex 2016-01-20 17:58:18 +01:00
StefanoMagrassi
1eb312609c Merge branch 'hotfix-gitignore' 2016-01-20 17:06:23 +01:00
StefanoMagrassi
ce3f8563c4 .log ignored 2016-01-20 17:06:13 +01:00
StefanoMagrassi
59998f3950 Merge branch 'plugin-engine-conf' 2016-01-20 17:02:20 +01:00
StefanoMagrassi
e4dfa52b05 .npmignore - leaner module 2016-01-20 17:01:25 +01:00
StefanoMagrassi
4080c64451 cordova-ios platform version
It was specified the supported version of cordova-ios platform
2016-01-20 16:59:01 +01:00
5 changed files with 36 additions and 17 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
# Commons
/node_modules
*.log
# OS
.DS_Store

5
.npmignore Normal file
View File

@@ -0,0 +1,5 @@
# Make NPM module leaner
/scripts
.eslintrc
.npmrc

View File

@@ -1,6 +1,6 @@
{
"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",
"license": "MIT",
"scripts": {
@@ -37,6 +37,7 @@
"base64",
"save",
"photo library",
"gallery",
"ecosystem:cordova",
"cordova-ios",
"cordova-android",
@@ -56,6 +57,6 @@
],
"devDependencies": {
"eslint": "1.10.3",
"libxmljs": "0.16.1"
"nodemsg": "1.0.0"
}
}

View File

@@ -1,5 +1,9 @@
<?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>
@@ -17,6 +21,8 @@
<!-- ios -->
<platform name="ios">
<source-file compiler-flags="-fno-objc-arc" src="src/ios/Base64ToGallery.m"/>
<config-file parent="/*" target="config.xml">
<feature name="Base64ToGallery">
<param name="ios-package" value="Base64ToGallery"/>
@@ -25,12 +31,11 @@
</config-file>
<header-file src="src/ios/Base64ToGallery.h"/>
<source-file compiler-flags="-fno-objc-arc" src="src/ios/Base64ToGallery.m"/>
</platform>
<!-- android -->
<platform name="android">
<source-file src="src/android/Base64ToGallery.java" target-dir="src/it/nexxa/Base64ToGallery"/>
<config-file parent="/*" target="AndroidManifest.xml">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
@@ -41,13 +46,12 @@
<param name="android-package" value="it.nexxa.base64ToGallery.Base64ToGallery"/>
</feature>
</config-file>
<source-file src="src/android/Base64ToGallery.java" target-dir="src/it/nexxa/Base64ToGallery"/>
</platform>
<!-- wp8 -->
<platform name="wp8">
<source-file src="src/wp8/Base64ToGallery.cs"/>
<config-file parent="/*" target="config.xml">
<feature name="Base64ToGallery">
<param name="wp-package" value="Base64ToGallery"/>
@@ -58,7 +62,5 @@
<config-file parent="/Deployment/App/Capabilities" target="Properties/WMAppManifest.xml">
<Capability Name="ID_CAP_MEDIALIB_PHOTO"/>
</config-file>
<source-file src="src/wp8/Base64ToGallery.cs"/>
</platform>
</plugin>

View File

@@ -2,18 +2,28 @@
// Modules
var fs = require('fs');
var libxml = require('libxmljs');
var logger = require('nodemsg');
var pkg = require('../package.json');
// CONSTS
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;
var configContent = fs.readFileSync(CONFIG_FILE);
var configXML = libxml.parseXmlString(configContent);
var configVersion = configXML.root().attr('version');
// Logic
var version = pkg.version;
var regex = new RegExp(REGEXP);
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
configVersion.value(version);
config = config.replace(regex, '$1version="' + version + '"');
fs.writeFileSync(CONFIG_FILE, configXML.toString());
fs.writeFileSync(CONFIG_FILE, config);