Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
asus centos-6 localhost committed Apr 4, 2013
0 parents commit 68414ee
Show file tree
Hide file tree
Showing 35 changed files with 1,501 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .gitignore
@@ -0,0 +1,75 @@
.worksheet
jrebel.xml
id_rsa.pub
.project
.classpath

## generic files to ignore
*~
*.lock
*.DS_Store
*.swp
*.out

# rails specific
*.sqlite3
config/database.yml
log/*
tmp/*

# java specific
*.class

# python specific
*.pyc

# xcode/iphone specific
build/*
*.pbxuser
*.mode2v3
*.mode1v3
*.perspective
*.perspectivev3
*~.nib

# akka specific
logs/*

# sbt specific
target/
project/boot
lib_managed/*
project/build/target
project/build/lib_managed
project/build/src_managed
project/plugins/lib_managed
project/plugins/target
project/plugins/src_managed
project/plugins/project

core/lib_managed
core/target
pubsub/lib_managed
pubsub/target

# eclipse specific
.metadata
jrebel.lic
.settings
.classpath
.project

.ensime*
*.sublime-*
.cache

# intellij
*.eml
*.iml
*.ipr
*.iws
.*.sw?
.idea

# paulp script
/.lib/
12 changes: 12 additions & 0 deletions README.md
@@ -0,0 +1,12 @@
# hello-scalatra #

## Build & Run ##

```sh
$ cd hello-scalatra
$ ./sbt
> container:start
> browse
```

If `browse` doesn't launch your browser, manually open [http://localhost:8080/](http://localhost:8080/) in your browser.
1 change: 1 addition & 0 deletions api_testing.json
@@ -0,0 +1 @@
{"nodes":{"scala":{"requests":[{"id":"0DC4ADFE-88D5-4548-8CAA-F412400BE195", "name":"root", "request":{"protocol":"HTTP", "method":{"name":"GET", "request-body":false}, "url":"localhost:9080", "body-type":"Text", "headers-type":"Form", "url-assist":false}, "modified":"Tue, 19 Mar 2013 13:10:50 -0400"},{"id":"D703E65B-7C9D-41EF-9935-5EDA79A3738E", "name":"items", "request":{"protocol":"HTTP", "method":{"name":"GET", "request-body":false}, "url":"localhost:9080/items/123", "body-type":"Text", "headers-type":"Form", "url-assist":false}, "modified":"Tue, 19 Mar 2013 13:11:24 -0400"}]}}, "version":1, "modified":"Tue, 19 Mar 2013 13:11:24 -0400"}
36 changes: 36 additions & 0 deletions assets/creation_mysql.sql
@@ -0,0 +1,36 @@
CREATE TABLE sc_user
(
id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(255),
firstname VARCHAR(255),
lastname VARCHAR(255)
);

CREATE TABLE sc_item
(
id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255),
price DECIMAL(10, 2),
currency VARCHAR(255),
description VARCHAR(255),
owner INT unsigned ,
FOREIGN KEY (owner) REFERENCES sc_user(id)
ON DELETE CASCADE
);

CREATE TABLE sc_bid
(
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
, item INT UNSIGNED
, min DECIMAL(10, 2)
, max DECIMAL(10, 2)
, currency VARCHAR(255)
, bidder INT UNSIGNED
, date DATETIME
, FOREIGN KEY (item) REFERENCES sc_item (id)
, FOREIGN KEY (bidder) REFERENCES sc_user (id)
);

DROP TABLE sc_bid;
DROP TABLE sc_item;
DROP TABLE sc_user;
54 changes: 54 additions & 0 deletions assets/creation_postgres.sql
@@ -0,0 +1,54 @@
CREATE TABLE sc_user
(
id serial NOT NULL,
username text,
firstname text,
lastname text,
CONSTRAINT sc_user_pkey PRIMARY KEY (id )
);
CREATE SEQUENCE sc_bid_id_seq1 START 123;
CREATE SEQUENCE sc_bid_id_seq START 234;

CREATE TABLE sc_item
(
id integer NOT NULL DEFAULT nextval('sc_bid_id_seq'::regclass),
name text,
price numeric,
currency text,
description text,
owner integer,
CONSTRAINT sc_bid_pkey PRIMARY KEY (id ),
CONSTRAINT sc_bid_owner_fkey FOREIGN KEY (owner)
REFERENCES sc_user (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);


CREATE TABLE sc_bid
(
id integer NOT NULL DEFAULT nextval('sc_bid_id_seq1'::regclass),

"for" integer,
min numeric,
max numeric,
currency text,
bidder integer,
date numeric,
CONSTRAINT sc_bid_pkey1 PRIMARY KEY (id ),
CONSTRAINT sc_bid_bidder_fkey FOREIGN KEY (bidder)
REFERENCES sc_user (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT sc_bid_for_fkey FOREIGN KEY ("for")
REFERENCES sc_item (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);


drop table sc_bid;
drop table sc_user;
drop SEQUENCE sc_bid_id_seq1;
drop table sc_item;




1 change: 1 addition & 0 deletions project/build.properties
@@ -0,0 +1 @@
sbt.version=0.12.2
53 changes: 53 additions & 0 deletions project/build.scala
@@ -0,0 +1,53 @@
import sbt._
import Keys._
import org.scalatra.sbt._
import org.scalatra.sbt.PluginKeys._
import com.mojolly.scalate.ScalatePlugin._
import ScalateKeys._

object HelloscalatraBuild extends Build {
val Organization = "org.smartjava"
// val Organization = "com.typesafe.slick.examples.jdbc"
val Name = "hello-scalatra"
val Version = "0.1.0-SNAPSHOT"
val ScalaVersion = "2.10.0"
val ScalatraVersion = "2.2.0"

lazy val project = Project(
"hello-scalatra",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
libraryDependencies ++= Seq(
"org.scalatra" %% "scalatra" % ScalatraVersion,
"org.scalatra" %% "scalatra-scalate" % ScalatraVersion,
"org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test",
"ch.qos.logback" % "logback-classic" % "1.0.6" % "runtime",
"org.eclipse.jetty" % "jetty-webapp" % "8.1.8.v20121106" % "container",
"net.liftweb" %% "lift-json" % "[2.4,)",
"com.typesafe.slick" %% "slick" % "1.0.0",
"com.h2database" % "h2" % "1.3.166",
"c3p0" % "c3p0" % "0.9.1.2",
// "org.scalaquery" %% "scalaquery" % "0.10.0-M1",
"postgresql" % "postgresql" % "9.1-901.jdbc4",
"org.eclipse.jetty.orbit" % "javax.servlet" % "3.0.0.v201112011016" % "container;provided;test" artifacts (Artifact("javax.servlet", "jar", "jar")),
"org.slf4j" % "slf4j-nop" % "1.6.4",
"com.h2database" % "h2" % "1.3.170",
"org.xerial" % "sqlite-jdbc" % "3.6.20",
"mysql" % "mysql-connector-java" % "5.1.13"
// "org.scalatra" %% "scalatra-json" % "2.2.0",
// "org.json4s" %% "json4s-jackson" % "3.1.0"
),
scalateTemplateConfig in Compile <<= (sourceDirectory in Compile) { base =>
Seq(
TemplateConfig(
base / "webapp" / "WEB-INF" / "templates",
Seq.empty, /* default imports should be added here */
Seq.empty, /* add extra bindings here */
Some("templates")))
}))
}
7 changes: 7 additions & 0 deletions project/plugins.sbt
@@ -0,0 +1,7 @@
addSbtPlugin("com.mojolly.scalate" % "xsbt-scalate-generator" % "0.4.2")

addSbtPlugin("org.scalatra.sbt" % "scalatra-sbt" % "0.2.0")

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0")

libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.12.0-0.2.11.1"))

0 comments on commit 68414ee

Please sign in to comment.