Skip to content

Commit

Permalink
updated app and README
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesward committed Sep 20, 2013
1 parent 15431ff commit 873d26c
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 63 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -13,3 +13,6 @@ dist
/.project
/RUNNING_PID
/.settings
/project/*-shim.sbt
/activator-sbt-atmos-akka-shim.sbt
/activator-sbt-atmos-play-shim.sbt
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright 2013 James Ward
Copyright 2013 Typesafe, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
11 changes: 6 additions & 5 deletions README.md
@@ -1,4 +1,4 @@
# 6 Minute Apps
6 Minute Apps
===============

This is an introduction to building Modern Web Apps with Play Framework, Scala, CoffeeScript, and LESS
Expand All @@ -7,8 +7,8 @@ This is an introduction to building Modern Web Apps with Play Framework, Scala,
Setup
-----

1. [Download Typesafe Activator](http://typesafe.com/platform/getstarted)
2. Extract the zip and run the `activator` script from a non-interactive shell
1. [Download Typesafe Activator](http://typesafe.com/platform/getstarted) (or copy it over from a USB)
2. Extract the zip and run the `activator` or `activator.bat` script from a non-interactive shell
3. Your browser should open to the Activator UI: [http://localhost:8888](http://localhost:8888)


Expand All @@ -17,6 +17,7 @@ Create a Play App

Create a new Play Framework application using the `Hello Play Framework!` template. This will compile the application then run it and it's tests. You can see the running application at: [http://localhost:9000/](http://localhost:9000/)

You may want to read the tutorial for the app before continuing.

Open in an IDE
--------------
Expand All @@ -27,12 +28,12 @@ If you want to use an IDE (Eclipse or IntelliJ), click on *Code*, select *Open*,
Update Dependencies
-------------------

In the `project/Build.scala` file add the following lines to the `appDependencies` section after the line containing `javaCore`:
In the `build.sbt` file add the following lines to the `appDependencies` section after the line containing `javaCore`:

"org.sorm-framework" % "sorm" % "0.3.8",
"com.h2database" % "h2" % "1.3.168",

This adds the SORM and H2 dependencies to the application. Refresh the page in order to reload the build definition and dependencies.
This adds the SORM and H2 dependencies to the application. Refresh the page in order to reload the build definition and dependencies.


Cleanup Template Files
Expand Down
31 changes: 23 additions & 8 deletions activator
Expand Up @@ -25,12 +25,14 @@ realpath () {
)
}

# TODO - Do we need to detect msys?

# Uses uname to detect if we're in the odd cygwin environment.
is_cygwin() {
local os=$(uname -s)
case "$os" in
CYGWIN*) return 0 ;;
*) return 1 ;;
CYGWIN*) return 0 ;;
*) return 1 ;;
esac
}

Expand Down Expand Up @@ -187,7 +189,8 @@ run() {
#check for jline terminal fixes on cygwin
if is_cygwin; then
stty -icanon min 1 -echo > /dev/null 2>&1
addJava "-Djline.terminal=unix"
addJava "-Djline.terminal=jline.UnixTerminal"
addJava "-Dsbt.cygwin=true"
fi
# run sbt
execRunner "$java_cmd" \
Expand All @@ -202,8 +205,8 @@ run() {
local exit_code=$?
if is_cygwin; then
stty icanon echo > /dev/null 2>&1
exit $exit_code
fi
exit $exit_code
}

# Loads a configuration file full of default command line options for this script.
Expand Down Expand Up @@ -248,11 +251,18 @@ declare -a residual_args
declare -a java_args
declare -a app_commands
declare -r activator_home="$(realpath "$(dirname "$0")")"
declare -r app_version="0.2.6"
declare -r app_version="1.0.0"

declare -r app_launcher="${activator_home}/activator-launch-${app_version}.jar"
declare -r script_name=activator
declare -r java_cmd=$(get_java_cmd)
userhome="$HOME"
if is_cygwin; then
# cygwin sets home to something f-d up, set to real windows homedir
userhome="$USERPROFILE"
fi
declare -r activator_user_home_dir="${userhome}/.activator"
declare -r java_opts_config="${activator_user_home_dir}/activatorconfig.txt"

# Now check to see if it's a good enough version
declare -r java_version=$("$java_cmd" -version 2>&1 | awk -F '"' '/version/ {print $2}')
Expand All @@ -274,8 +284,13 @@ elif [[ ! "$java_version" > "1.6" ]]; then
exit 1
fi


# if configuration files exist, prepend their contents to $@ so it can be processed by this runner
[[ -f "$script_conf_file" ]] && set -- $(loadConfigFile "$script_conf_file") "$@"
# if configuration files exist, prepend their contents to the java args so it can be processed by this runner
if [[ -f "$java_opts_config" ]]; then
config_opts=$(loadConfigFile "$java_opts_config")
for item in $config_opts
do
addJava "$item"
done
fi

run "$@"
Binary file not shown.
4 changes: 2 additions & 2 deletions activator.bat
Expand Up @@ -10,15 +10,15 @@
@echo off
if "%ACTIVATOR_HOME%"=="" set "ACTIVATOR_HOME=%~dp0"
set ERROR_CODE=0
set APP_VERSION=0.2.6
set APP_VERSION=1.0.0
set ACTIVATOR_LAUNCH_JAR=activator-launch-%APP_VERSION%.jar

rem Detect if we were double clicked, although theoretically A user could
rem manually run cmd /c
for %%x in (%cmdcmdline%) do if %%~x==/c set DOUBLECLICKED=1

rem FIRST we load the config file of extra options.
set "CFG_FILE=%ACTIVATOR_HOME%activatorconfig.txt"
set "CFG_FILE=%UserProfile%\.activator\activatorconfig.txt"
set CFG_OPTS=
if exist %CFG_FILE% (
FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%CFG_FILE%") DO (
Expand Down
16 changes: 8 additions & 8 deletions app/views/index.scala.html
Expand Up @@ -4,13 +4,13 @@

<script type='text/javascript' src='@routes.Assets.at("javascripts/index.min.js")'></script>

<div class="container">
<ul id="bars"></ul>
<form id="barForm" method="post" action="/bars">
<label for="barName">Name</label>
<input id="barName" required>
<button>Add Bar</button>
</form>
</div>
<div class="container">
<ul id="bars"></ul>
<form id="barForm" method="post" action="/bars">
<label for="barName">Name</label>
<input id="barName" required>
<button>Add Bar</button>
</form>
</div>

}
23 changes: 23 additions & 0 deletions build.sbt
@@ -0,0 +1,23 @@
name := """hello-play"""

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
// Select Play modules
//jdbc, // The JDBC connection pool and the play.api.db API
//anorm, // Scala RDBMS Library
//javaJdbc, // Java database API
//javaEbean, // Java Ebean plugin
//javaJpa, // Java JPA plugin
//filters, // A set of built-in filters
javaCore, // The core Java API
"org.sorm-framework" % "sorm" % "0.3.8",
"com.h2database" % "h2" % "1.3.168",
// WebJars pull in client-side web libraries
"org.webjars" %% "webjars-play" % "2.2.0",
"org.webjars" % "bootstrap" % "2.3.1"
// Add your own project dependencies in the form:
// "group" % "artifact" % "version"
)

play.Project.playScalaSettings
35 changes: 0 additions & 35 deletions project/Build.scala

This file was deleted.

6 changes: 3 additions & 3 deletions project/build.properties
@@ -1,4 +1,4 @@
#Activator-generated Properties
#Sun Jul 21 19:33:33 MDT 2013
template.uuid=25040b75-04ee-4c8a-ad2e-5c9e5db8f131
sbt.version=0.12.3
#Fri Sep 20 15:18:10 MDT 2013
template.uuid=fac31fa1-92f3-4942-aa0e-1c0a3f35b4f9
sbt.version=0.13.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Expand Up @@ -5,4 +5,4 @@ logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.1")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")

0 comments on commit 873d26c

Please sign in to comment.