Skip to content

Commit ab76cd5

Browse files
committed
basic rspec plugin
1 parent 528d212 commit ab76cd5

27 files changed

+913
-0
lines changed

.travis.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: groovy
2+
sudo: false
3+
4+
install:
5+
- ./gradlew clean
6+
7+
script:
8+
- ./gradlew -S -i
9+
- ./gradlew -S -i gradleTest
10+
11+
jdk:
12+
- oraclejdk7
13+
- oraclejdk8
14+
- openjdk7
15+
16+
os:
17+
- linux
18+
- osx
19+
20+
env: TERM=dumb
21+
22+
cache:
23+
directories:
24+
- $HOME/.gradle

HACKING.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
== Running Tests
2+
3+
This project has both unit tests and integration tests. In our context the distinguishing point is that integration tests
4+
need network connectivity, and unit tests need no more than local file system access. We also expect unit tests to be
5+
very quick, whereas integration tests are allowed to take a _little_ longer.
6+
7+
Unit tests are in 'src/test' and integration tests are in 'src/integTest'. To run integration tests you would need to
8+
do `./gradlew check` or `./gradlew build`. For unittests just doing `./gradlew test` is enough.
9+
10+
Test logging is controlled via `logback-test.xml`. Be aware that integration tests generate a lot of debug information.
11+
Please do not commit the config file back with DEBUG turned on.
12+
13+
=== Running single test suites
14+
15+
If you only want to run the unittests in say `JRubyPlugin` then you can do `./gradlew test -Dtest.single=JRubyPlugin`.
16+
In a similar manner for integration tests one can do `./gradlew integrationTest -Dtest.single=JRubyIntegrationSpec`.
17+
18+
== Release HOWTO
19+
20+
*TBC*

LICENSE.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
jruby-gradle-plugin is distributed under the following license:
2+
----------------------------------------------------
3+
4+
Copyright (c) 2014 Lookout, Inc.
5+
https://www.lookout.com/about/contact
6+
7+
Permission is hereby granted, free of charge, to any person obtaining
8+
a copy of this software and associated documentation files (the
9+
"Software"), to deal in the Software without restriction, including
10+
without limitation the rights to use, copy, modify, merge, publish,
11+
distribute, sublicense, and/or sell copies of the Software, and to
12+
permit persons to whom the Software is furnished to do so, subject to
13+
the following conditions:
14+
15+
The above copyright notice and this permission notice shall be
16+
included in all copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

build.gradle

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
maven {
5+
url "https://plugins.gradle.org/m2/"
6+
}
7+
}
8+
dependencies {
9+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
10+
classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:1.12.+'
11+
classpath 'org.ysb33r.gradle:gradletest:0.5.3'
12+
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.1'
13+
classpath "org.ajoberstar:gradle-git:1.2.0"
14+
}
15+
}
16+
apply plugin: "org.asciidoctor.gradle.asciidoctor"
17+
apply plugin: 'org.ajoberstar.github-pages'
18+
19+
20+
group = 'com.github.jruby-gradle'
21+
version = '0.4.1'
22+
defaultTasks 'check', 'assemble'
23+
24+
if (!releaseBuild) {
25+
version = "${version}-SNAPSHOT"
26+
}
27+
28+
subprojects {
29+
apply plugin: 'groovy'
30+
apply plugin: 'maven'
31+
apply plugin: 'com.jfrog.bintray'
32+
apply plugin: 'org.ysb33r.gradletest'
33+
apply plugin: 'provided-base'
34+
apply from: "${rootProject.projectDir}/gradle/integration-tests.gradle"
35+
36+
repositories {
37+
jcenter()
38+
}
39+
40+
dependencies {
41+
compile gradleApi()
42+
compile localGroovy()
43+
}
44+
45+
test {
46+
testLogging {
47+
showStandardStreams = true
48+
exceptionFormat "full"
49+
}
50+
}
51+
52+
task sourcesJar(type: Jar, dependsOn: classes) {
53+
classifier = 'sources'
54+
from sourceSets.main.allSource
55+
}
56+
57+
artifacts {
58+
archives sourcesJar
59+
}
60+
}
61+
62+
task release(type: Exec) {
63+
description 'Create and upload a release'
64+
dependsOn subprojects.collect { ":${it.name}:bintrayUpload" }
65+
commandLine 'git', 'tag', "v${project.version}"
66+
}
67+
68+
69+
//asciidoctor {
70+
// separateOutputDirs false
71+
// attributes 'stylesheet' : 'foundation.css',
72+
// 'stylesdir' : "${projectDir}/src/docs/asciidoc/stylesheets"
73+
//}
74+
75+
//githubPages {
76+
// repoUri = '[email protected]:jruby-gradle/jruby-gradle.github.io'
77+
// targetBranch = 'master'
78+
// pages {
79+
// from asciidoctor
80+
// from subprojects.collect { ":${it.name}:groovydoc" }
81+
// }
82+
//}
83+
//publishGhPages.dependsOn subprojects.collect { ":${it.name}:groovydoc" }

gradle.properties

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
org.gradle.daemon=true
2+
bintrayUser=
3+
bintrayKey=
4+
releaseBuild=false

gradle/integration-tests.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// This is based upon what Rob Fletcher has done at
2+
// https://raw.githubusercontent.com/robfletcher/gradle-compass/master/gradle/integration-tests.gradle
3+
4+
configurations {
5+
integrationTestCompile {
6+
extendsFrom testCompile
7+
}
8+
integrationTestRuntime {
9+
extendsFrom integrationTestCompile, testRuntime
10+
}
11+
integrationTestGems
12+
}
13+
14+
sourceSets {
15+
integrationTest {
16+
java.srcDir file("src/integTest/java")
17+
groovy.srcDir file("src/integTest/groovy")
18+
resources.srcDir file("src/integTest/resources")
19+
compileClasspath = sourceSets.main.output + configurations.integrationTestCompile
20+
runtimeClasspath = output + compileClasspath + configurations.integrationTestRuntime
21+
}
22+
}
23+
24+
task copyIntegrationTestGems (type:Copy) {
25+
from ({configurations.integrationTestGems.files})
26+
into new File(buildDir,'tmp/integrationTest/flatRepo')
27+
}
28+
29+
task integrationTest(type: Test, dependsOn: jar) {
30+
testClassesDir = sourceSets.integrationTest.output.classesDir
31+
classpath = sourceSets.integrationTest.runtimeClasspath
32+
mustRunAfter test
33+
dependsOn copyIntegrationTestGems
34+
}
35+
36+
check.dependsOn integrationTest
37+
38+

gradle/wrapper/gradle-wrapper.jar

49.8 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Aug 22 00:43:11 BST 2014
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-all.zip

gradlew

+164
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
#!/usr/bin/env bash
2+
3+
##############################################################################
4+
##
5+
## Gradle start up script for UN*X
6+
##
7+
##############################################################################
8+
9+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10+
DEFAULT_JVM_OPTS=""
11+
12+
APP_NAME="Gradle"
13+
APP_BASE_NAME=`basename "$0"`
14+
15+
# Use the maximum available, or set MAX_FD != -1 to use that value.
16+
MAX_FD="maximum"
17+
18+
warn ( ) {
19+
echo "$*"
20+
}
21+
22+
die ( ) {
23+
echo
24+
echo "$*"
25+
echo
26+
exit 1
27+
}
28+
29+
# OS specific support (must be 'true' or 'false').
30+
cygwin=false
31+
msys=false
32+
darwin=false
33+
case "`uname`" in
34+
CYGWIN* )
35+
cygwin=true
36+
;;
37+
Darwin* )
38+
darwin=true
39+
;;
40+
MINGW* )
41+
msys=true
42+
;;
43+
esac
44+
45+
# For Cygwin, ensure paths are in UNIX format before anything is touched.
46+
if $cygwin ; then
47+
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48+
fi
49+
50+
# Attempt to set APP_HOME
51+
# Resolve links: $0 may be a link
52+
PRG="$0"
53+
# Need this for relative symlinks.
54+
while [ -h "$PRG" ] ; do
55+
ls=`ls -ld "$PRG"`
56+
link=`expr "$ls" : '.*-> \(.*\)$'`
57+
if expr "$link" : '/.*' > /dev/null; then
58+
PRG="$link"
59+
else
60+
PRG=`dirname "$PRG"`"/$link"
61+
fi
62+
done
63+
SAVED="`pwd`"
64+
cd "`dirname \"$PRG\"`/" >&-
65+
APP_HOME="`pwd -P`"
66+
cd "$SAVED" >&-
67+
68+
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69+
70+
# Determine the Java command to use to start the JVM.
71+
if [ -n "$JAVA_HOME" ] ; then
72+
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73+
# IBM's JDK on AIX uses strange locations for the executables
74+
JAVACMD="$JAVA_HOME/jre/sh/java"
75+
else
76+
JAVACMD="$JAVA_HOME/bin/java"
77+
fi
78+
if [ ! -x "$JAVACMD" ] ; then
79+
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80+
81+
Please set the JAVA_HOME variable in your environment to match the
82+
location of your Java installation."
83+
fi
84+
else
85+
JAVACMD="java"
86+
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87+
88+
Please set the JAVA_HOME variable in your environment to match the
89+
location of your Java installation."
90+
fi
91+
92+
# Increase the maximum file descriptors if we can.
93+
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94+
MAX_FD_LIMIT=`ulimit -H -n`
95+
if [ $? -eq 0 ] ; then
96+
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97+
MAX_FD="$MAX_FD_LIMIT"
98+
fi
99+
ulimit -n $MAX_FD
100+
if [ $? -ne 0 ] ; then
101+
warn "Could not set maximum file descriptor limit: $MAX_FD"
102+
fi
103+
else
104+
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105+
fi
106+
fi
107+
108+
# For Darwin, add options to specify how the application appears in the dock
109+
if $darwin; then
110+
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111+
fi
112+
113+
# For Cygwin, switch paths to Windows format before running java
114+
if $cygwin ; then
115+
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116+
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117+
118+
# We build the pattern for arguments to be converted via cygpath
119+
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120+
SEP=""
121+
for dir in $ROOTDIRSRAW ; do
122+
ROOTDIRS="$ROOTDIRS$SEP$dir"
123+
SEP="|"
124+
done
125+
OURCYGPATTERN="(^($ROOTDIRS))"
126+
# Add a user-defined pattern to the cygpath arguments
127+
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128+
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129+
fi
130+
# Now convert the arguments - kludge to limit ourselves to /bin/sh
131+
i=0
132+
for arg in "$@" ; do
133+
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134+
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135+
136+
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137+
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138+
else
139+
eval `echo args$i`="\"$arg\""
140+
fi
141+
i=$((i+1))
142+
done
143+
case $i in
144+
(0) set -- ;;
145+
(1) set -- "$args0" ;;
146+
(2) set -- "$args0" "$args1" ;;
147+
(3) set -- "$args0" "$args1" "$args2" ;;
148+
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149+
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150+
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151+
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152+
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153+
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154+
esac
155+
fi
156+
157+
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158+
function splitJvmOpts() {
159+
JVM_OPTS=("$@")
160+
}
161+
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162+
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163+
164+
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

0 commit comments

Comments
 (0)