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
describe('postCreatePlugin', function () { | |
let MyModel, spy1, spy2 | |
before(function(done) { | |
const MySchema = new mongoose.Schema({ | |
foo: String, | |
}) | |
MySchema.plugin(postCreatePlugin) | |
MyModel = mongoose.model('MyModel', MySchema) |
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
import postCreate from '/wathever/postCreate.js' | |
//... Your schema definition as usual | |
// declare the plugin for your model | |
mySchema.plugin(postCreate) | |
// anywhere else: | |
mySchema.addPostCreate(function (user, cb) { | |
// this will only be executed ad the user creation |
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
FROM alpine | |
RUN mkdir /app | |
WORKDIR /app | |
RUN apk update && \ | |
apk add imagemagick python ghostscript-fonts ghostscript py-pip groff && \ | |
pip install awscli | |
ADD work.sh . |
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
######### READ ENV VARIABLES ########### | |
echo "reading env variables" | |
eval `./jsonenv.py < $PAYLOAD_FILE` | |
eval `./jsonenv.py < $CONFIG_FILE` | |
######### DOWNLOAD FILE ########### | |
echo "downloading" | |
aws s3 cp s3://$S3_INPUT_BUCKET/$S3_INPUT_DIRNAME/$S3_INPUT_FILENAME ./orig.pdf |
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
worker: | |
encrypted_env_file: encrypted.env | |
build: . | |
volumes: | |
- ./test:/app/test | |
volumes_from: | |
- utils | |
environment: | |
- PAYLOAD_FILE=./test/payload.json | |
- CONFIG_FILE=/data/iron_config.json |
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
- type: serial | |
name: "PREPARE IRON CONFIG ENV" | |
service: utils | |
steps: | |
- command: sh -c "echo $IRON_JSON > /data/iron_config.json" | |
- type: serial | |
name: "TESTING" | |
service: worker | |
steps: |
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
import IronWorker from 'iron_worker' | |
const task = { | |
"WATERMARK_TEXT":"TESTING TESTING TESTING", | |
"S3_INPUT_BUCKET":"my-bucket", | |
"S3_INPUT_FILENAME":"some-file-that-you-own.pdf", | |
"S3_INPUT_DIRNAME":"the-input-directory", | |
"S3_DEST_BUCKET":"my-bucket", | |
"S3_DEST_FILENAME":"testing-output.pdf", | |
"S3_DEST_DIRNAME":"test" |
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
import DemoController from './demo.controller' | |
import DemoService from './demo.service' | |
import routes from './demo.routes' | |
angular.module('hunteed.demo', []) | |
.controller('DemoController', DemoController) | |
.service('DemoService', DemoService) | |
.config(routes) |
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
export default class DemoController { | |
constructor (DemoService) { | |
'ngInject' | |
Object.assign(this, {DemoService}) | |
} | |
} |
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
export default class DemoService { | |
constructor () { | |
'ngInject' | |
Object.assign(this, { | |
data: {}, | |
}) | |
} | |
fetchData () { | |
this.data = {foo: 'bar'} |