Skip to content

Commit

Permalink
Merge pull request #270 from intercom/nicolette/update-circle-image
Browse files Browse the repository at this point in the history
Update Android image for Circle CI
  • Loading branch information
nymerias authored Apr 24, 2019
2 parents 5513579 + 219739d commit 7c24b75
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

android:
docker:
- image: circleci/android:api-26-alpha
- image: circleci/android:api-28
environment:
- JVM_OPTS: -Xmx3200m
working_directory: ~/project/Example
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:

publish:
docker:
- image: circleci/android:api-26-alpha
- image: circleci/android:api-28
steps:
- checkout
- run:
Expand Down
30 changes: 14 additions & 16 deletions intercom-plugin/scripts/checkForUpdate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function fetchUpdateInfo(context, callback) {
var fs = context.requireCordovaModule('fs');
var fs = require('fs');

function fetchUpdateInfo(callback) {
var updateInfo = {
releaseDate: 0,
podUpdateDate: 0,
Expand All @@ -18,18 +18,16 @@ function fetchUpdateInfo(context, callback) {
});
}

function writeUpdateInfo(context, updateInfo, callback) {
var fs = context.requireCordovaModule('fs');
function writeUpdateInfo(updateInfo, callback) {
fs.writeFile('platforms/ios/.intercom_update', JSON.stringify(updateInfo), 'utf8', function (err,data) {
callback();
});
}

function updateIntercomIfNeeded(context, updateInfo, callback) {
var exec = context.requireCordovaModule('child_process').exec;

function updateIntercomIfNeeded(updateInfo, callback) {
var exec = require('child_process').exec;
var completion = function() {
writeUpdateInfo(context, updateInfo, function() {
writeUpdateInfo(updateInfo, function() {
callback();
});
};
Expand All @@ -48,8 +46,8 @@ function updateIntercomIfNeeded(context, updateInfo, callback) {
}
}

function fetchLatestRelease(context, callback) {
var https = context.requireCordovaModule('https');
function fetchLatestRelease(callback) {
var https = require('https');

var req = https.get({
headers: {
Expand Down Expand Up @@ -78,14 +76,14 @@ function fetchLatestRelease(context, callback) {
});
}

module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
module.exports = function() {
var q = require('q');
var deferral = new q.defer();

fetchUpdateInfo(context, function(updateInfo) {
fetchUpdateInfo(function(updateInfo) {
// Check at most once every 48 hours
if (Date.now() - updateInfo.lastCheckDate > 1000 * 60 * 60 * 48) {
fetchLatestRelease(context, function(releaseData) {
fetchLatestRelease(function(releaseData) {
updateInfo.lastCheckDate = Date.now();

if (releaseData != null) {
Expand All @@ -95,7 +93,7 @@ module.exports = function(context) {
updateInfo.releaseDate = Date.now();
}

updateIntercomIfNeeded(context, updateInfo, function() {
updateIntercomIfNeeded(updateInfo, function() {
deferral.resolve();
});
});
Expand Down
9 changes: 5 additions & 4 deletions intercom-plugin/scripts/prepareCocoaPods.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = function(context) {
var Q = context.requireCordovaModule('q');
var deferral = new Q.defer();
var exec = context.requireCordovaModule('child_process').exec;
module.exports = function() {
var q = require('q');
var exec = require('child_process').exec;

var deferral = new q.defer();

console.log('Updating CocoaPods specs repo');
exec('pod repo update master', function(error, stdout, stderr) {
Expand Down

0 comments on commit 7c24b75

Please sign in to comment.