-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
272 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
node { | ||
def SOURCEDIR = pwd() | ||
try { | ||
stage("Clean up") { | ||
step([$class: 'WsCleanup']) | ||
} | ||
stage("Checkout Code") { | ||
checkout scm | ||
} | ||
stage("Test with Docker") { | ||
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { | ||
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${SOURCEDIR}:/source rosetteapi/docker-nodejs" | ||
} | ||
} | ||
slack(true) | ||
} catch (e) { | ||
currentBuild.result = "FAILED" | ||
slack(false) | ||
throw e | ||
} | ||
} | ||
|
||
def slack(boolean success) { | ||
def color = success ? "#00FF00" : "#FF0000" | ||
def status = success ? "SUCCESSFUL" : "FAILED" | ||
def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" | ||
slackSend(color: color, channel: "#rapid", message: message) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
node { | ||
def SOURCEDIR = pwd() | ||
def TEST_CONTAINER = 'examples/nodejs-test' | ||
def DOCKERFILE_DIR = './examples' | ||
try { | ||
stage("Clean up") { | ||
step([$class: 'WsCleanup']) | ||
} | ||
stage("Checkout Code") { | ||
checkout scm | ||
} | ||
stage("Build Dockerfile") { | ||
dir ("${DOCKERFILE_DIR}") { | ||
docker.build("${TEST_CONTAINER}") | ||
} | ||
} | ||
stage("Run Examples") { | ||
withEnv(["API_KEY=${env.ROSETTE_API_KEY}", "ALT_URL=${env.BINDING_TEST_URL}"]) { | ||
def examplesDir = "${SOURCEDIR}" + '/examples' | ||
sh "docker run --rm -e API_KEY=${API_KEY} -e ALT_URL=${ALT_URL} -v ${examplesDir}:/source ${TEST_CONTAINER}" | ||
} | ||
} | ||
slack(true) | ||
} catch (e) { | ||
currentBuild.result = "FAILED" | ||
slack(false) | ||
throw e | ||
} | ||
} | ||
|
||
def slack(boolean success) { | ||
def color = success ? "#00FF00" : "#FF0000" | ||
def status = success ? "SUCCESSFUL" : "FAILED" | ||
def message = status + ": Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]' (${env.BUILD_URL})" | ||
slackSend(color: color, channel: "#rapid", message: message) | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
|
||
var Api = require("../lib/Api"); | ||
var ArgumentParser = require("argparse").ArgumentParser; | ||
|
||
var parser = new ArgumentParser({ | ||
addHelp: true, | ||
description: "Get the key phrases and concepts in a piece of text" | ||
}); | ||
parser.addArgument(["--key"], {help: "Rosette API key", required: true}); | ||
parser.addArgument(["--url"], {help: "Rosette API alt-url", required: false}); | ||
var args = parser.parseArgs(); | ||
var api = new Api(args.key, args.url); | ||
var endpoint = "topics"; | ||
|
||
var topics_data = "Lily Collins is in talks to join Nicholas Hoult in Chernin Entertainment and Fox Searchlight's J.R.R. Tolkien biopic Tolkien. Anthony Boyle, known for playing Scorpius Malfoy in the British play Harry Potter and the Cursed Child, also has signed on for the film centered on the famed author. In Tolkien, Hoult will play the author of the Hobbit and Lord of the Rings book series that were later adapted into two Hollywood trilogies from Peter Jackson. Dome Karukoski is directing the project." | ||
var content = topics_data; | ||
api.parameters.content = content; | ||
|
||
api.rosette(endpoint, function(err, res){ | ||
if(err){ | ||
console.log(err); | ||
} else { | ||
console.log(JSON.stringify(res, null, 2)); | ||
} | ||
}); |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.