Skip to content

Commit

Permalink
Add 'X-Requested-With' header to liftVanilla
Browse files Browse the repository at this point in the history
  • Loading branch information
eltimn committed Dec 26, 2015
1 parent 53af386 commit 6c4d58e
Show file tree
Hide file tree
Showing 15 changed files with 295 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ project/sbt-launch*
# Doc generation
.dexy
core/documentation-helpers/src/test/**Test.scala

# JavaScript testing
node_modules
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: scala
cache:
directories:
- '$HOME/.m2/repository'
- '$HOME/node_modules'
services:
- mongodb
jdk:
Expand All @@ -12,3 +12,11 @@ script: ./travis.sh
branches:
only:
- master

node_js:
- "4.1"

before_script:
- "cd web/webkit"
- "npm install"
- "cd -"
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# The Lift Web Framework

[![Build Status](https://travis-ci.org/lift/framework.svg?branch=master)](https://travis-ci.org/lift/framework)

Lift is the most powerful, most secure web framework available today. There are [Seven Things](http://seventhings.liftweb.net/) that distinguish Lift from other web frameworks.

Lift applications are:
Expand Down Expand Up @@ -40,7 +42,7 @@ Create or update your `project/plugins.sbt` file with the `xsbt-web-plugin`:
Then, add the plugin and Lift to your `build.sbt` file:

seq(webSettings :_*)

libraryDependencies ++= {
val liftVersion = "2.5-RC1"
Seq(
Expand Down Expand Up @@ -145,4 +147,4 @@ changes to Lift. We do, however, accept some small changes and bugfixes into Lif

## Continuous Integration

SNAPSHOTs are built at CloudBees: https://lift.ci.cloudbees.com/
SNAPSHOTs are built by [Travis CI](https://travis-ci.org/lift/framework)
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.specs2.mutable.Specification
* System under specification for MongoDirectMonoClient.
*/
class MongoDirectMongoClientSpec extends Specification with MongoTestKit {
"MongoDirectMonoClient Specification".title
"MongoDirectMongoClient Specification".title

override def mongo = new MongoClient("127.0.0.1", 27017)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MongoDirectSpec extends Specification with MongoTestKit {
coll.save(doc2, WriteConcern.SAFE) must throwA[MongoException]
Helpers.tryo(coll.save(doc2, WriteConcern.SAFE)) must beLike {
case Failure(msg, _, _) =>
msg must contain("E11000 duplicate key error index")
msg must contain("E11000 duplicate key error")
}
Helpers.tryo(coll.save(doc3, WriteConcern.SAFE)).toOption must beSome

Expand Down
12 changes: 8 additions & 4 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import Keys._
import net.liftweb.sbt.LiftBuildPlugin._
import Dependencies._

import com.typesafe.sbt.web.SbtWeb
import com.typesafe.sbt.web.SbtWeb.autoImport._

/**
* Pattern-matches an attributed file, extracting its module organization,
* name, and revision if available in its attributes.
Expand Down Expand Up @@ -73,7 +76,7 @@ object BuildDef extends Build {
.dependsOn(common)
.settings(description := "Simple Actor",
parallelExecution in Test := false)

lazy val markdown =
coreProject("markdown")
.settings(description := "Markdown Parser",
Expand Down Expand Up @@ -126,7 +129,7 @@ object BuildDef extends Build {
lazy val webkit =
webProject("webkit")
.dependsOn(util, testkit % "provided")
.settings(libraryDependencies += mockito_all)
.settings(libraryDependencies ++= Seq(mockito_all, jquery, jasmineCore, jasmineAjax))
.settings(yuiCompressor.Plugin.yuiSettings: _*)
.settings(description := "Webkit Library",
parallelExecution in Test := false,
Expand All @@ -136,8 +139,9 @@ object BuildDef extends Build {
},
initialize in Test <<= (sourceDirectory in Test) { src =>
System.setProperty("net.liftweb.webapptest.src.test.webapp", (src / "webapp").absString)
})

},
(compile in Compile) <<= (compile in Compile) dependsOn (WebKeys.assets))
.enablePlugins(SbtWeb)


// Persistence Projects
Expand Down
3 changes: 3 additions & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,7 @@ object Dependencies {
lazy val scalatest = "org.scalatest" %% "scalatest" % "2.1.3" % "test"
lazy val junit = "junit" % "junit" % "4.8.2" % "test"

lazy val jquery = "org.webjars.bower" % "jquery" % "1.11.3"
lazy val jasmineCore = "org.webjars.bower" % "jasmine-core" % "2.4.1"
lazy val jasmineAjax = "org.webjars.bower" % "jasmine-ajax" % "3.2.0"
}
4 changes: 4 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ DefaultOptions.addPluginResolvers
resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")

resolvers += Resolver.typesafeRepo("releases")

addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.2.2")
5 changes: 5 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ set -ev

./liftsh test

cd web/webkit
npm run lint
npm run test
cd -

if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
mkdir -p ~/.sbt/0.13/
openssl aes-256-cbc -K $encrypted_a177bbd76133_key -iv $encrypted_a177bbd76133_iv -in .credentials.enc -out ~/.sbt/0.13/.credentials -d
Expand Down
28 changes: 28 additions & 0 deletions web/webkit/SpecRunner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner v2.4.0</title>

<link rel="shortcut icon" type="image/png" href="target/web/web-modules/main/webjars/lib/jasmine-core/images/jasmine_favicon.png">
<link rel="stylesheet" href="target/web/web-modules/main/webjars/lib/jasmine-core/lib/jasmine-core/jasmine.css">

<script src="target/web/web-modules/main/webjars/lib/jasmine-core/lib/jasmine-core/jasmine.js"></script>
<script src="target/web/web-modules/main/webjars/lib/jasmine-core/lib/jasmine-core/jasmine-html.js"></script>
<script src="target/web/web-modules/main/webjars/lib/jasmine-core/lib/jasmine-core/boot.js"></script>
<script src="target/web/web-modules/main/webjars/lib/jquery/dist/jquery.min.js"></script>
<script src="target/web/web-modules/main/webjars/lib/jasmine-ajax/lib/mock-ajax.js"></script>

<!-- include source files here... -->
<script src="src/main/resources/toserve/lift.js"></script>

<!-- include spec files here... -->
<script src="src/test/assets/js/liftJQuery.spec.js"></script>
<script src="src/test/assets/js/liftVanilla.spec.js"></script>

</head>

<body>
<p>Run the <code>assets</code> task in <em>lift-webkit</em> to fetch the dependencies.</p>
</body>
</html>
71 changes: 71 additions & 0 deletions web/webkit/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Karma configuration

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'target/web/web-modules/main/webjars/lib/jquery/dist/jquery.min.js',
'target/web/web-modules/main/webjars/lib/jasmine-ajax/lib/mock-ajax.js',
'src/main/resources/toserve/lift.js',
'src/test/assets/js/**/*.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
})
}
31 changes: 31 additions & 0 deletions web/webkit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "lift",
"version": "3.0.0",
"description": "A JavaScript library for use with the Lift web framework",
"scripts": {
"test": "karma start karma.conf.js",
"lint": "jshint src/main/resources/toserve/lift.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lift/framework.git"
},
"keywords": [
"lift"
],
"author": "",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/lift/framework/issues"
},
"homepage": "https://github.com/lift/framework",
"devDependencies": {
"jasmine-core": "^2.4.0",
"jshint": "^2.8.0",
"karma": "^0.13.15",
"karma-jasmine": "^0.3.6",
"karma-mocha-reporter": "^1.1.3",
"karma-phantomjs-launcher": "^0.2.1",
"phantomjs": "^1.9.19"
}
}
Loading

0 comments on commit 6c4d58e

Please sign in to comment.