Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9b05949
added gitignore
Oct 5, 2018
00d339f
Merge pull request #3 from LHANFOURIWidad/GITIGNORE
Rintarou Oct 5, 2018
34ecf20
CREATED README
Rintarou Oct 5, 2018
05c682f
Merge pull request #2 from Rintarou/README
corentinmrnn Oct 5, 2018
8676f90
Added Java application file
corentinmrnn Oct 5, 2018
3a616df
Added Maven pom file
corentinmrnn Oct 5, 2018
f9d05cc
Fixed version error in pom
corentinmrnn Oct 5, 2018
a0a742a
Merge pull request #4 from Slaanaroth/MAVEN
LHANFOURIWidad Oct 5, 2018
e6a073b
add dockerfile
Oct 5, 2018
518de9b
TRAVIS SUPPORT CONFIG FILE
Rintarou Oct 5, 2018
291aa08
(corrected) TRAVIS SUPPORT
Rintarou Oct 5, 2018
c4ab5ff
Merge pull request #6 from Rintarou/TRAVIS
corentinmrnn Oct 5, 2018
1d9f4d5
corrected dockerfile
Oct 5, 2018
b538763
Merge pull request #5 from LHANFOURIWidad/DOCKER
Rintarou Oct 5, 2018
f7d160a
Added docker build for continuous integration
corentinmrnn Nov 9, 2018
a783099
Continuous release
Nov 9, 2018
3f19a1f
here comes the first controller
Rintarou Nov 9, 2018
a3fe4b3
adding unit tests
Rintarou Nov 9, 2018
efb4f6e
Front end ressources added
Nov 9, 2018
be31435
Front end ressources build
corentinmrnn Nov 9, 2018
5bf9a8a
github release
Rintarou Nov 9, 2018
afa5347
github release
Rintarou Nov 9, 2018
6232dee
zbouidiboui
Rintarou Nov 9, 2018
ad67892
ok
Rintarou Nov 9, 2018
57b9268
build frontend launch resources thing
Rintarou Nov 9, 2018
f95b2ce
travis build thing
Rintarou Nov 9, 2018
c713d19
Merge pull request #17 from Rintarou/FRONT_END_BUILD
corentinmrnn Nov 9, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## This is the kind of files that we want to ignore
bin
target
*.class
*.jar
38 changes: 38 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
sudo: required
services:
- docker

language: java
jdk: oraclejdk8

branches:
only:
- master

before_install:
- docker version
- docker info
- node --version
- npm --version

script:
- cd alma-server/src/main/resources
- pwd
- npm install -g gulp
- npm install
- gulp minify
- cd ../../../../
- mvn clean verify -f alma-server/pom.xml -e

after_success:
- docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASSWORD
- docker images
- docker push labrasse/alma-server:latest

deploy:
provider: releases
api_key: "32f1875d7f018e1af412a87a93d2a500e0a34a53"
file: "alma-server/target/alma-server-1.0.0-SNAPSHOT.jar"
skip_cleanup: true
on:
tags: true
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### ALMA server

This repository will contain the source code of the ALMA server based on Spring Boot.

84 changes: 84 additions & 0 deletions alma-server/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>fr.univnantes</groupId>
<artifactId>alma-server</artifactId>
<version>1.0.0-SNAPSHOT</version>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<java.version>1.8</java.version>
<docker.image.prefix>labrasse</docker.image.prefix>
</properties>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.11</version>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
<execution>
<id>tag-image</id>
<phase>package</phase>
<goals>
<goal>tag</goal>
</goals>
<configuration>
<image>labrasse/alma-server:${project.version}</image>
<newName>hub.docker.com/labrasse/alma-server:${project.version}</newName>
</configuration>
</execution>
</executions>
<configuration>
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
<imageTags>
<imageTag>${project.version}</imageTag>
<imageTag>latest</imageTag>
</imageTags>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>

</project>
5 changes: 5 additions & 0 deletions alma-server/src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
ADD alma-server-1.0.0-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=container","-jar","/app.jar"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package fr.univnantes.alma.server;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package fr.univnantes.alma.server.controllers;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;

@RestController
public class HelloController {

@RequestMapping("/")
public String index() {
return "Greetings from Spring Boot!";
}

}
21 changes: 21 additions & 0 deletions alma-server/src/main/resources/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"esversion": 6,
"node": true,
"browser": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true
}
48 changes: 48 additions & 0 deletions alma-server/src/main/resources/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2016 <INSERT YOUR ORGANISATION NAME HERE>.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License which
* accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*******************************************************************************/

'use strict';

let gulp = require('gulp'),
browserify = require('gulp-browserify'),
gulpUtil = require('gulp-util');

var $ = require('gulp-load-plugins')();

gulp.task('clean', () => {
return gulp.src([
'static/main.min.js',
'static/main.browserify.js',
'checkstyle.xml'
]).pipe($.clean());
});

gulp.task('scripts', ['clean'], () => {
return gulp.src(
[
'static/**/*.js'
])
.pipe($.jshint())
.pipe($.jshint.reporter(require('jshint-stylish')))
.pipe($.jshint.reporter(require('jshint-checkstyle-file-reporter')))
.pipe($.size());
});

gulp.task('browserify', ['scripts'], () => {
return gulp.src(['static/main.js'])
.pipe(browserify({insertGlobals: true}))
.pipe($.concat('main.browserify.js'))
.pipe(gulp.dest('static/'));
});

gulp.task('minify', ['browserify'], () => {
return gulp.src(['static/main.browserify.js'])
.pipe($.uglify().on('error', gulpUtil.log))
.pipe($.rename('main.min.js'))
.pipe(gulp.dest('static'))
});
38 changes: 38 additions & 0 deletions alma-server/src/main/resources/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"name": "alma-master",
"version": "0.1.0",
"description": "Simple web application",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/la-brasse/alma-m2-2016.git"
},
"keywords": [
"alma"
],
"author": "Stéphane Bégaudeau",
"license": "MIT",
"bugs": {
"url": "https://github.com/la-brasse/alma-m2-2016/issues"
},
"homepage": "https://github.com/la-brasse/alma-m2-2016#readme",
"devDependencies": {
"browserify": "^13.1.0",
"gulp": "^3.9.1",
"gulp-browserify": "^0.5.1",
"gulp-clean": "^0.3.2",
"gulp-concat": "^2.6.0",
"gulp-jshint": "^2.0.1",
"gulp-load-plugins": "^1.2.4",
"gulp-rename": "^1.2.2",
"gulp-size": "^2.1.0",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"jshint": "^2.9.3",
"jshint-checkstyle-file-reporter": "0.0.1",
"jshint-stylish": "^2.2.1"
}
}
16 changes: 16 additions & 0 deletions alma-server/src/main/resources/static/folder/greatFunction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*******************************************************************************
* Copyright (c) 2016 <INSERT YOUR ORGANISATION NAME HERE>.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License which
* accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*******************************************************************************/
(function () {
'use strict';

var greatFunction = function () {
alert('This is great!');
};

module.exports = greatFunction;
})();
16 changes: 16 additions & 0 deletions alma-server/src/main/resources/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Static Resource</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="jumbotron">
<h1>Home</h1>
<p>Some static content</p>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="main.min.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions alma-server/src/main/resources/static/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*******************************************************************************
* Copyright (c) 2016 <INSERT YOUR ORGANISATION NAME HERE>.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License which
* accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*******************************************************************************/
(function () {
'use strict';

var greatFunction = require('./folder/greatFunction');
greatFunction();
})();
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package fr.univnantes.alma.server.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;

@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class HelloControllerTest {

@Autowired
private MockMvc mvc;

@Test
public void getHello() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(equalTo("Greetings from Spring Boot!")));
}
}