Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process API #59

Merged
merged 7 commits into from Nov 2, 2017
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -0,0 +1,3 @@
{
"extends": "airbnb-base"
}
@@ -1,8 +1,6 @@
language: node_js
node_js:
- '4.6'
before_script:
- npm install -g grunt-cli
- '6'
deploy:
provider: npm
email: henri.bergius@iki.fi

This file was deleted.

@@ -1,3 +1,4 @@
Copyright (c) 2014-2017 Flowhub UG
Copyright (c) 2013 Henri Bergius

Permission is hereby granted, free of charge, to any person

This file was deleted.

@@ -0,0 +1,41 @@
const noflo = require('noflo');
const gravatar = require('gravatar');

// @runtime noflo-nodejs

exports.getComponent = () => {
const c = new noflo.Component();
c.description = 'Get avatar URL for a given email';
c.inPorts.add('email', {
datatype: 'string',
});
c.inPorts.add('size', {
datatype: 'int',
control: true,
default: 200,
});
c.outPorts.add('avatar', {
datatype: 'string',
});
c.forwardBrackets = {
email: ['avatar'],
};
c.process((input, output) => {
if (!input.hasData('email')) return;
if (input.attached('size').length && !input.hasData('size')) {
return;
}
let size = 200;
if (input.hasData('size')) {
size = input.getData('size');
}
const email = input.getData('email');
const avatar = gravatar.url(email, {
s: size,
}, true);
output.sendDone({
avatar,
});
});
return c;
};
@@ -13,28 +13,24 @@
},
"license": "MIT",
"dependencies": {
"noflo": "0.x >= 0.5",
"noflo": "0.x >= 0.8",
"gravatar": "^1.6.0"
},
"devDependencies": {
"chai": "^4.0.0",
"coffee-script": "^1.12.2",
"grunt": "^1.0.1",
"grunt-coffeelint": "^0.0.16",
"grunt-contrib-watch": "^1.0.0",
"grunt-mocha-test": "^0.13.2",
"mocha": "^4.0.0"
"eslint": "^4.10.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.8.0",
"fbp-spec": "^0.2.3",
"noflo-nodejs": "^0.8.1"
},
"noflo": {
"icon": "user",
"components": {
"GetAvatar": "./components/GetAvatar.coffee"
}
"icon": "user"
},
"keywords": [
"noflo"
],
"scripts": {
"test": "grunt test"
"pretest": "eslint components/*.js",
"test": "fbp-spec --secret test --address ws://localhost:3333 --command 'noflo-nodejs --port 3333 --register=false --secret test' spec/"
}
}

This file was deleted.

@@ -0,0 +1,10 @@
topic: 'gravatar/GetAvatar'
cases:
-
name: 'receiving an email'
assertion: 'should send an avatar URL'
inputs:
email: 'henri.bergius@iki.fi'
expect:
avatar:
equals: 'https://s.gravatar.com/avatar/995f27ce7205a79c55d4e44223cd6de0?s=200'
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.