Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Added hook and resource file to copy GoogleService-Info.plist
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored and macdonst committed Jan 4, 2017
1 parent 6f0182a commit dce5e9f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
43 changes: 43 additions & 0 deletions scripts/copy_file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env node
'use strict';

var fs = require('fs');

var getValue = function(config, name) {
var value = config.match(new RegExp('<' + name + '>(.*?)</' + name + '>', "i"))
if(value && value[1]) {
return value[1]
} else {
return null
}
}

function fileExists(path) {
try {
return fs.statSync(path).isFile();
}
catch (e) {
return false;
}
}

function directoryExists(path) {
try {
return fs.statSync(path).isDirectory();
}
catch (e) {
return false;
}
}

var config = fs.readFileSync("config.xml").toString();
var name = getValue(config, "name");

if(fileExists("GoogleService-Info.plist") && directoryExists("platforms/ios/")){
try {
var contents = fs.readFileSync("GoogleService-Info.plist").toString();
fs.writeFileSync("platforms/ios/" + name + "/Resources/GoogleService-Info.plist", contents);
} catch(err) {
process.stdout.write(err);
}
}
6 changes: 6 additions & 0 deletions src/ios/Firebase/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

0 comments on commit dce5e9f

Please sign in to comment.