Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b26b55a061 | ||
|
|
bac8ff71a3 | ||
|
|
ed8a8f13d3 | ||
|
|
3d740e8e63 | ||
|
|
1eb312609c | ||
|
|
ce3f8563c4 | ||
|
|
59998f3950 | ||
|
|
e4dfa52b05 | ||
|
|
4080c64451 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
# Commons
|
||||
/node_modules
|
||||
*.log
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
||||
5
.npmignore
Normal file
5
.npmignore
Normal file
@@ -0,0 +1,5 @@
|
||||
# Make NPM module leaner
|
||||
|
||||
/scripts
|
||||
.eslintrc
|
||||
.npmrc
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
18
plugin.xml
18
plugin.xml
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user