Skip to content

Commit 5973099

Browse files
committed
Update readme and contributing.
1 parent 452d9eb commit 5973099

File tree

3 files changed

+19
-48
lines changed

3 files changed

+19
-48
lines changed

CONTRIBUTING.md

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
# Contributing to JScriptBox
22

3-
Pull requests are welcome, preferably against `master`.
4-
5-
Every successful Travis CI build on branch `master` is automatically published to [`https://oss.sonatype.org/content/repositories/snapshots`](https://oss.sonatype.org/content/repositories/snapshots/com/diffplug/), and its javadoc are published [here](http://diffplug.github.io/jscriptbox/javadoc/snapshot/).
3+
Pull requests are welcome, preferably against `main`.
64

75
## Build instructions
86

9-
It's a bog-standard gradle build.
10-
11-
`gradlew eclipse`
12-
* creates an Eclipse project file for you.
13-
14-
`gradlew build`
15-
* builds the jar
16-
* runs FindBugs
17-
* checks the formatting
18-
* runs the tests
7+
It's a bog-standard gradle build. `gradlew build`
198

209
If you're getting style warnings, `gradlew spotlessApply` will apply anything necessary to fix formatting. For more info on the formatter, check out [spotless](https://github.com/diffplug/spotless).
2110

@@ -32,7 +21,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
3221
you may not use this file except in compliance with the License.
3322
You may obtain a copy of the License at
3423
35-
http://www.apache.org/licenses/LICENSE-2.0
24+
http://www.apache.org/licenses/LICENSE-2.0
3625
3726
Unless required by applicable law or agreed to in writing, software
3827
distributed under the License is distributed on an "AS IS" BASIS,

README.md

+14-33
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
# <img align="left" src="jscriptbox.png"> JScriptBox: Make your scripting API language-independent
22
<!---freshmark shields
33
output = [
4-
link(shield('Maven artifact', 'mavenCentral', '{{group}}:{{name}}', 'blue'), 'https://bintray.com/{{org}}/opensource/{{name}}/view'),
5-
link(shield('Latest version', 'latest', '{{stable}}', 'blue'), 'https://github.com/{{org}}/{{name}}/releases/latest'),
6-
link(shield('Javadoc', 'javadoc', 'OK', 'blue'), 'https://{{org}}.github.io/{{name}}/javadoc/{{stable}}/'),
7-
link(shield('License Apache', 'license', 'Apache', 'blue'), 'https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)'),
8-
'',
9-
link(shield('Changelog', 'changelog', '{{version}}', 'brightgreen'), 'CHANGES.md'),
10-
link(image('Travis CI', 'https://travis-ci.org/{{org}}/{{name}}.svg?branch=master'), 'https://travis-ci.org/{{org}}/{{name}}'),
11-
link(shield('Live chat', 'gitter', 'live chat', 'brightgreen'), 'https://gitter.im/{{org}}/{{name}}')
12-
].join('\n');
4+
link(shield('Maven artifact', 'mavenCentral', 'com.diffplug.jscriptbox:jscriptbox', 'blue'), 'https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/{{versionLast}}'),
5+
link(shield('Changelog', 'changelog', '{{versionLast}}', 'blue'), 'CHANGELOG.md'),
6+
link(shield('Javadoc', 'javadoc', 'here', 'blue'), 'https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox')
7+
].join('\n');
138
-->
14-
[![Maven artifact](https://img.shields.io/badge/mavenCentral-com.diffplug.jscriptbox%3Ajscriptbox-blue.svg)](https://bintray.com/diffplug/opensource/jscriptbox/view)
15-
[![Latest version](https://img.shields.io/badge/latest-3.0.0-blue.svg)](https://github.com/diffplug/jscriptbox/releases/latest)
16-
[![Javadoc](https://img.shields.io/badge/javadoc-OK-blue.svg)](https://diffplug.github.io/jscriptbox/javadoc/3.0.0/)
17-
[![License Apache](https://img.shields.io/badge/license-Apache-blue.svg)](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))
18-
19-
[![Changelog](https://img.shields.io/badge/changelog-3.1.0--SNAPSHOT-brightgreen.svg)](CHANGES.md)
20-
[![Travis CI](https://travis-ci.org/diffplug/jscriptbox.svg?branch=master)](https://travis-ci.org/diffplug/jscriptbox)
21-
[![Live chat](https://img.shields.io/badge/gitter-live_chat-brightgreen.svg)](https://gitter.im/diffplug/jscriptbox)
9+
[![Maven artifact](https://img.shields.io/badge/mavenCentral-com.diffplug.jscriptbox%3Ajscriptbox-blue.svg)](https://central.sonatype.com/artifact/com.diffplug.jscriptbox/jscriptbox/3.0.0)
10+
[![Changelog](https://img.shields.io/badge/changelog-3.0.0-blue.svg)](CHANGELOG.md)
11+
[![Javadoc](https://img.shields.io/badge/javadoc-here-blue.svg)](https://javadoc.io/doc/com.diffplug.jscriptbox/jscriptbox)
2212
<!---freshmark /shields -->
2313

2414
When exposing a scripting API, you provide some variables and functions to the script, run the script, then look at which outputs were set and/or functions were called. JScriptBox provides a mechanism for exposing a Java API to a scripting language in a way which is independent of the script language. This means that if you write your code using JScriptBox, script authors can use any language supported by JSR-223, such as JavaScript, Ruby, Python, Scheme, [etc.](http://stackoverflow.com/a/14864450/1153071)
@@ -27,34 +17,25 @@ At present, only JavaScript is being used in the wild (in the [FreshMark](https:
2717

2818
## Example
2919

30-
<!---freshmark javadoc
31-
output = prefixDelimiterReplace(input, 'https://{{org}}.github.io/{{name}}/javadoc/', '/', stable);
32-
-->
33-
3420
```java
3521
private int square(int x) {
36-
return x * x;
22+
return x * x;
3723
}
3824

3925
@Test
4026
public void example() throws ScriptException {
41-
TypedScriptEngine engine = JScriptBox.create()
42-
.set("square").toFunc1(this::square)
43-
.set("x").toValue(9)
44-
.buildTyped(Nashorn.language());
45-
int squareOfX = engine.eval("square(x)", Integer.class);
46-
Assert.assertEquals(81, squareOfX);
27+
TypedScriptEngine engine = JScriptBox.create()
28+
.set("square").toFunc1(this::square)
29+
.set("x").toValue(9)
30+
.buildTyped(Nashorn.language());
31+
int squareOfX = engine.eval("square(x)", Integer.class);
32+
Assert.assertEquals(81, squareOfX);
4733
}
4834
```
4935

5036
In the code above, we provide a `square` function and an `x` variable. We then build a Nashorn Javascript engine, but we could have passed any other language too. To add a new language, just implement [Language](src/main/java/com/diffplug/jscriptbox/Language.java) (the existing [Nashorn](src/main/java/com/diffplug/jscriptbox/javascript/Nashorn.java) can be a helpful starting point).
5137

52-
<!---freshmark /javadoc -->
53-
5438
## Acknowledgements
55-
* Readme formatting by [FreshMark](https://github.com/diffplug/freshmark).
56-
* Bugs found by [findbugs](http://findbugs.sourceforge.net/), [as such](https://github.com/diffplug/durian-rx/blob/v1.0/build.gradle?ts=4#L92-L116).
57-
* Scripts in the `.ci` folder are inspired by [Ben Limmer's work](http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/).
5839
* Built by [gradle](http://gradle.org/).
5940
* Tested by [junit](http://junit.org/).
6041
* Maintained by [DiffPlug](http://www.diffplug.com/).

build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ repositories {
77
mavenCentral()
88
}
99

10-
apply from: 干.file('base/java.gradle')
1110
apply from: 干.file('spotless/java.gradle')
11+
apply from: 干.file('spotless/freshmark.gradle')
12+
apply from: 干.file('base/java.gradle')
1213
apply plugin: 'java-library'
1314

1415

0 commit comments

Comments
 (0)