Javascript Continues Integration in Jenkins with AngularJS

Post on 18-Nov-2014

5.500 views 4 download

description

 

Transcript of Javascript Continues Integration in Jenkins with AngularJS

Con$nuous  Co?  V  Javascriptu?

Ladislav  Prskavec

ToDo App

module = angular.module('todoApp', [])# Controller TodoCtlmodule.controller 'TodoCtrl', ($scope, $http) -> $scope.todos = []; # Proxy to MongoHQ $scope.url = "proxy.php" # Get all todos from mongodb $scope.getAll = -> $http.get($scope.url).success($scope.getCallback) return $scope.getCallback = (data, status, headers, config) -> $scope.todos = data return # Add new todo $scope.addTodo = -> id = new Date().getTime() $scope.data = '{"document" : {"_id": "' + id + '" , ... todo = {text:$scope.todoText, done:false} $scope.todos.push(todo) $http.post($scope.url, $scope.data).success($scope.sucessCall) return

AngularJS

Mongo DB

<?phprequire_once __DIR__ .'/config.php';

header('Content-type: application/json');$url = "https://api.mongohq.com/databases/mongo/collections/todo/documents?_apikey=" . MONGOHQ_API_KEY;

$postData = file_get_contents("php://input");if (!empty($postData)) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST ,1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($ch, CURLOPT_POSTFIELDS , $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1); curl_setopt($ch, CURLOPT_HEADER , 1); echo curl_exec($ch);} else { echo file_get_contents($url);} Integration MongoHQ

PhantomJSheadless browser

Continues Integration

Compile, Lint

Code Coverage

Documentation

JenkinsCI

JasmineJSCoverageJSDoc

Ladislav  Prskavec

h9p://blog.prskavec.net@abtris

https://github.com/abtris/angular-todo-mongohq

Flickr credits• 123646856

• 212999782

• 3212942388

• 4090782772

• 4489747597

• 4572739839

• 5462861556

• 5474897335

• 6315847523

• 6711727919