This file contains hidden or 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
PROJECT_DIR=$1 | |
#now we need to act from a project source directory to have vsc in place | |
pushd ${PROJECT_DIR} | |
#we never push directly to develop and we want to run linter only on feature branches | |
#skip when on master branch as well | |
curr_branch_name=$(git rev-parse --abbrev-ref HEAD) | |
if [ "${curr_branch_name}" = "origin/develop" ] || [ "${curr_branch_name}" = "origin/master" ]; then | |
echo "Skipping linter for ${curr_branch_name}." | |
exit 0 |
This file contains hidden or 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
PROJECT_DIR=$1 | |
# Creating temporary directory and new virtual environment not to mess things | |
TMP_DIR=$(mktemp -d) | |
virtualenv -p python3 ${TMP_DIR} >> /dev/null | |
source ${TMP_DIR}/bin/activate >> /dev/null | |
# installing flake | |
pip install flake8 >> /dev/null | |
flake8 ${PROJECT_DIR} | |
deactivate | |
rm -rf ${TMP_DIR} |
This file contains hidden or 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
DeploymentOptions options = new DeploymentOptions().setInstances(20); | |
vertx.deployVerticle(new IpProvider(dataProviderConf), options) |
This file contains hidden or 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
private void registerEventListener(String id) { | |
EventBus eventBus = vertx.eventBus(); | |
logger.info("Registering new event handler " + id); | |
eventBus.consumer(id, message -> { | |
logger.info(String.valueOf(message.body())); | |
this.getInfo(String.valueOf(message.body())) | |
.setHandler(s -> { | |
message.reply(s.result()); | |
s.succeeded(); |
This file contains hidden or 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
@Override | |
public void start(Future<Void> future) throws Exception { | |
super.start(); | |
NetServerOptions options = new NetServerOptions().setLogActivity(true); | |
NetServer server = vertx.createNetServer(options); | |
server.connectHandler(socket -> onInput(configuration, socket)) | |
.listen(configuration.getPort(), configuration.getHost(), connectionStartedHandler(future, configuration)); | |
} |
This file contains hidden or 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
@Override | |
public Future<String> getInfo(String input) { | |
logger.info("Providing for: " + input); | |
socket.write(input); | |
return Future.future(promise -> { | |
socket.handler(buffer -> { | |
promise.complete(buffer.getString(0, buffer.length())); | |
}); | |
}); | |
} |
This file contains hidden or 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
public class ServerConnection implements ConnectionService { | |
private Vertx vertx; | |
public ServerConnection(Vertx vertx) { | |
this.vertx = vertx; | |
} | |
@Override | |
public boolean enable(Connection configuration) { | |
vertx.createNetServer().connectHandler(socket -> onConnect(configuration, socket)) |