-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc8a6a8
commit 33571f2
Showing
7 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
try { | ||
var fs = require('fs'); | ||
var glob = require('glob'); | ||
var PACKAGE_JSON = process.cwd() + '/package.json'; | ||
var package = JSON.parse(fs.readFileSync(PACKAGE_JSON)); | ||
var APP_NAME = package.name; | ||
var PACKAGE_GRADLE = process.cwd() + '/node_modules/react-native-rabbitmq/android/build.gradle' | ||
var VERSION = checkVersion(); | ||
|
||
if (VERSION < 0.40) { | ||
glob('**/RCTReactNativeRabbitMq.h',{}, function(err, files) { | ||
if(Array.isArray(files)) { | ||
var target = process.cwd() + '/' + files[0]; | ||
console.log('\033[92mPatching .. \033[97m' + target); | ||
var data = fs.readFileSync(target); | ||
fs.writeFileSync(target, String(data).replace(/\/\/#define OLDER_IMPORT/, '#define OLDER_IMPORT')); | ||
console.log('done.') | ||
} | ||
}) | ||
} | ||
|
||
function checkVersion() { | ||
console.log('react-native-rabbitmq checking app version ..'); | ||
return parseFloat(/\d\.\d+(?=\.)/.exec(package.dependencies['react-native'])); | ||
} | ||
|
||
} catch(err) { | ||
console.log( | ||
'\033[95mreact-native-rabbitmq\033[97m link \033[91mFAILED \033[97m\nCould not automatically link package :'+ | ||
err.stack) | ||
} |