kitchen-site
kitchen-site copied to clipboard
Storage adapter customization
I can't fin a way add stores to an FS.Collection. It would be nice to have an extra field in "collection" where one could specify a file with an array of extra stores. (in addition to files)
Like:
//extra_stores.js
[
new FS.Store.FileSystem("thumbs", {
transformWrite: function(fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize('200', '200').stream().pipe(writeStream);
},
new FS.Store.FileSystem("avatar", {
transformWrite: function(fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize('80', '80').stream().pipe(writeStream);
}
})
]
I've tried to find a way to fake it, but right now all I can do is to add a second files.js file with the complete Collection definition and remove the generated one from the output folder.
Is there a better way to get transforms right now ?
In situations like this (e.g something required not possible by the meteor kitchen cli / json ) diff and patch has solved the problems. Old goog makefile / grunt / npm / gulp / sh-script with proper invocations works like a treat ;)
Simple, but over complicated build script for one of my projects:
#!/bin/bash
ID=insert_app_id_here
URL=http://www.meteorkitchen.com/api/getapp/json/$ID
function build {
echo Starting meteor-kitchen build
meteor-kitchen APP.json OUTPUT
# here's the patch to support google login with additional scopes
patch -p0 < login.patch
}
# fetch the json and also make a backup
function once {
curl -s $URL > APP.json.new
mv APP.json.new APP.json
cp APP.json backup/APP.json-"`date`"
# git add APP.json
# git commit -m "Autobuild running for $ID"
build
}
# run the build once ;)
once
example patch generated by "diff -u" against a modified version:
--- OUTPUT/client/views/login/login.1.js 2015-12-18 09:38:24.537570130 +0000
+++ OUTPUT/client/views/login/login.js 2015-12-18 09:39:34.029578186 +0000
@@ -58,7 +58,8 @@
Meteor.loginWithGoogle(
{
- requestPermissions: ["email"]
+ forceApprovalPrompt:false, requestOfflineToken: { google: true },
+ requestPermissions: ["https://www.googleapis.com/auth/gmail.readonly"]
},
function(err) {
button.button("reset");
Yeah i'm interested in this as well, mainly to be able to create thumbnails to use as needed:
https://github.com/CollectionFS/Meteor-CollectionFS#image-manipulation