Skip to content

Commit 14d79db

Browse files
committed
Initial Public Release
0 parents  commit 14d79db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2366
-0
lines changed

.gitignore

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
### JetBrains template
2+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
3+
4+
*.iml
5+
6+
## Directory-based project format:
7+
.idea/
8+
# if you remove the above rule, at least ignore the following:
9+
10+
# User-specific stuff:
11+
# .idea/workspace.xml
12+
# .idea/tasks.xml
13+
# .idea/dictionaries
14+
15+
# Sensitive or high-churn files:
16+
# .idea/dataSources.ids
17+
# .idea/dataSources.xml
18+
# .idea/sqlDataSources.xml
19+
# .idea/dynamic.xml
20+
# .idea/uiDesigner.xml
21+
22+
# Gradle:
23+
# .idea/gradle.xml
24+
# .idea/libraries
25+
26+
# Mongo Explorer plugin:
27+
# .idea/mongoSettings.xml
28+
29+
## File-based project format:
30+
*.ipr
31+
*.iws
32+
33+
## Plugin-specific files:
34+
35+
# IntelliJ
36+
/out/
37+
38+
# mpeltonen/sbt-idea plugin
39+
.idea_modules/
40+
41+
# JIRA plugin
42+
atlassian-ide-plugin.xml
43+
44+
# Crashlytics plugin (for Android Studio and IntelliJ)
45+
com_crashlytics_export_strings.xml
46+
crashlytics.properties
47+
crashlytics-build.properties
48+
### Gradle template
49+
.gradle
50+
build/
51+
52+
# Ignore Gradle GUI config
53+
gradle-app.setting
54+
55+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
56+
!gradle-wrapper.jar

LICENSE

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

README.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
![Pine Framework](docs/assets/PineBanner.png?raw=true "Pine Framework")
2+
3+
Version 0.1
4+
5+
> Please note that before 1.0 there are no backwards compatibility or stability guarantees.
6+
If you need a stable base it is recommended that you peg your dependencies to a specific release.
7+
8+
Pine is a [Kotlin](https://kotlinlang.org/) framework for developing interactive web applications and APIs.
9+
It grew out of a desire to develop APIs very quickly in Kotlin without the typical boilerplace that
10+
is prevalent in most web frameworks for the JVM.
11+
12+
## Quickstart Guide
13+
14+
To setup a minimal Pine project, you first need to create a new [Kotlin](https://kotlinlang.org/) project with
15+
[Gradle](https://gradle.org/) support. It is easiest to do this through [IntelliJ](https://www.jetbrains.com/idea/)'s
16+
"New Project" wizard.
17+
18+
Once you have your base Kotlin project setup, add Pine to your Gradle dependencies. You can find these in the
19+
`build.gradle` file in your project root.
20+
21+
```groovy
22+
repositories {
23+
maven {
24+
url "https://maven.icosillion.com/artifactory/open-source/"
25+
}
26+
}
27+
28+
dependencies {
29+
compile 'com.icosillion.pine:pine:0.1'
30+
}
31+
```
32+
33+
Once Gradle has finished pulling down all of the Pine dependencies, you can add a new package, for example
34+
`com.example.mypineproject`. After this namespace has been created, you can add your main file to it.
35+
36+
```kotlin
37+
import com.icosillion.pine.Pine
38+
import com.icosillion.pine.annotations.Route
39+
import com.icosillion.pine.http.Request
40+
import com.icosillion.pine.http.Response
41+
import com.icosillion.pine.responses.modifiers.withText
42+
43+
class IndexResource {
44+
45+
@Route("/")
46+
fun root(request: Request, response: Response): Response {
47+
return response.withText("Hello World!")
48+
}
49+
}
50+
51+
fun main(args: Array<String>) {
52+
val pine = Pine()
53+
54+
pine.resource(IndexResource())
55+
56+
pine.start()
57+
}
58+
```
59+
60+
Now you have everything you need to get started on your first Pine project!

build.gradle

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
group 'com.icosillion.pine'
2+
version '0.1'
3+
4+
buildscript {
5+
ext.kotlin_version = '1.1.2'
6+
repositories {
7+
mavenCentral()
8+
}
9+
10+
dependencies {
11+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12+
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-M3'
13+
}
14+
}
15+
16+
apply plugin: 'kotlin'
17+
apply plugin: 'java'
18+
apply plugin: 'maven-publish'
19+
apply plugin: 'org.junit.platform.gradle.plugin'
20+
21+
junitPlatform {
22+
platformVersion '1.0.0-M3'
23+
filters {
24+
engines {
25+
include 'spek'
26+
}
27+
}
28+
}
29+
30+
sourceCompatibility = 1.8
31+
32+
repositories {
33+
mavenCentral()
34+
maven {
35+
url "http://repository.jetbrains.com/all"
36+
}
37+
}
38+
39+
dependencies {
40+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
41+
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
42+
compile 'org.eclipse.jetty:jetty-server:9.4.4.v20170414'
43+
compile 'org.eclipse.jetty:jetty-servlet:9.4.4.v20170414'
44+
compile 'com.google.code.gson:gson:2.8.0'
45+
compile 'commons-io:commons-io:2.5'
46+
compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
47+
compile 'com.github.spullara.mustache.java:compiler:0.9.4'
48+
compile 'jmimemagic:jmimemagic:0.1.2'
49+
compile 'com.github.salomonbrys.kodein:kodein:3.4.1'
50+
51+
testCompile 'org.jetbrains.spek:spek-api:1.1.0'
52+
testCompile 'org.jetbrains.spek:spek-junit-platform-engine:1.1.0'
53+
testCompile group: 'junit', name: 'junit', version: '4.12'
54+
}
55+
56+
sourceSets {
57+
main.java.srcDirs += 'src/main/kotlin'
58+
}
59+
60+
kapt {
61+
generateStubs = true
62+
}
63+
64+
publishing {
65+
repositories {
66+
maven {
67+
url 'https://maven.icosillion.com/artifactory/open-source/'
68+
credentials {
69+
username project.properties.containsKey("deploymentUser") ? project.properties.get("deploymentUser") : ""
70+
password project.properties.containsKey("deploymentPassword") ? project.properties.get("deploymentPassword") : ""
71+
}
72+
}
73+
}
74+
75+
publications {
76+
maven(MavenPublication) {
77+
from components.java
78+
}
79+
}
80+
}

docs/assets/PineBanner.png

45.6 KB
Loading

gradle/wrapper/gradle-wrapper.jar

51 KB
Binary file not shown.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Fri Nov 27 20:28:57 GMT 2015
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.5-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)