Merge branch 'develop' into goreleaser

This commit is contained in:
Tom Whiston 2018-03-15 00:24:18 +01:00 committed by GitHub
commit 014b9d0176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
91 changed files with 236 additions and 113 deletions

9
.gitignore vendored
View File

@ -1,10 +1,12 @@
gin-bin
build/
public/js/bundle.js
public/css/semaphore.css
web/public/js/bundle.js
web/public/css/*.*
web/public/html/**/*.*
web/public/fonts/*.*
config.json
.DS_Store
node_modules
node_modules/
.idea/
caddyfile
@ -15,3 +17,4 @@ util/version.go
/vendor/
/coverage.out
/public/package-lock.json
!.gitkeep

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "public/vendor"]
path = public/vendor
url = git://github.com/ansible-semaphore/semaphore-vendor.git

View File

@ -9,10 +9,10 @@ tasks:
all:
desc: Install, Compile, Test and Build Semaphore for local architecture
cmds:
- deps
- compile
- test
- build:local
- task: deps
- task: compile
- task: test
- task: build:local
deps:
desc: Install all dependencies
@ -28,25 +28,23 @@ tasks:
deps:fe:
desc: Installs npm requirements for front end from package.json
dir: public
dir: web
cmds:
- git submodule update --init --recursive
- npm i -g less pug-cli
- npm i async
- npm install
deps:tools:
desc: Installs tools needed
dir: public
dir: web
cmds:
- npm install -g nodemon
- go get -u github.com/golang/dep/cmd/dep
- go get github.com/cespare/reflex
- go get github.com/cespare/reflex || true
- go get -u github.com/gobuffalo/packr/...
- go get -u github.com/haya14busa/goverage
# needs go 1.10+
- go get github.com/goreleaser/goreleaser/...
compile:
desc: Generates compiled frontend and backend resources (must be in this order)
cmds:
@ -55,25 +53,26 @@ tasks:
compile:fe:
desc: Runs less, pug and node
dir: public
dir: web
sources:
- css/semaphore.less
- html/*.pug
- html/**/*.pug
- resources/css/semaphore.less
- resources/html/*.pug
- resources/html/**/*.pug
generates:
- css/semaphore.css
- html/*.html
- html/**/*.html
- js/bundle.json
- public/css/semaphore.css
- public/html/*.html
- public/html/**/*.html
- bundle.json
cmds:
- lessc css/semaphore.less > css/semaphore.css
- pug $(find ./html/ -name "*.pug")
- node ./bundler.js
- lessc resources/less/semaphore.less > public/css/semaphore.css
- pug resources/pug --out public/html
- cp node_modules/font-awesome/fonts/* public/fonts
- node bundler.js
compile:be:
desc: Runs Packr for static assets
sources:
- public/*
- web/public/*
- db/migrations/*
generates:
- db/db-packr.go
@ -95,21 +94,21 @@ tasks:
watch:
desc: Watch fe and be file changes and rebuild
dir: public
dir: web/resources
cmds:
- task: watch:fe
- task: watch:be
watch:be:
cmds:
- reflex -r '\.go$' -R '^public/vendor/' -R '^node_modules/' -s -d none -- sh -c 'go build -i -o /tmp/semaphore_bin cli/main.go && /tmp/semaphore_bin -config $(pwd)/config.json'
- reflex -r '\.go$' -R '^node_modules/' -s -d none -- sh -c 'go build -i -o /tmp/semaphore_bin cli/main.go && /tmp/semaphore_bin -config $(pwd)/config.json'
watch:fe:
dir: public
dir: web
cmds:
- nodemon -w js -i bundle.js -e js bundler.js &
- nodemon -w css -e less --exec "lessc css/semaphore.less > css/semaphore.css" &
- pug -w -P --doctype html $(find ./html/ -name "*.pug") &
- nodemon -w css -e less --exec "lessc resources/less/semaphore.less > public/css/semaphore.css" &
- pug -w -P --doctype html resources/pug --out public/html &
build:
desc: Build a full set of release binaries and packages

View File

@ -14,7 +14,7 @@ import (
"github.com/russross/blackfriday"
)
var publicAssets = packr.NewBox("../public")
var publicAssets = packr.NewBox("../web/public")
// Declare all routes
func Route() mulekick.Router {

View File

@ -9,7 +9,6 @@ import (
func TestCheckTmpDir(t *testing.T) {
//It should be able to create a random dir in /tmp
dirName := os.TempDir()+ "/" + randString(rand.Intn(10 - 4) + 4)
err := checkTmpDir(dirName)
@ -27,6 +26,14 @@ func TestCheckTmpDir(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if stat, err:= os.Stat(dirName); err != nil {
t.Fatal(err)
} else if stat.Mode() != os.FileMode(int(0550)) {
// File System is not support 0550 mode, skip this test
return
}
err = checkTmpDir(dirName+"/noway")
if err == nil {
t.Fatal("You should not be able to write in this folder, causing an error")
@ -35,7 +42,6 @@ func TestCheckTmpDir(t *testing.T) {
if err != nil {
t.Log(err)
}
}

View File

@ -1,25 +0,0 @@
[
"/vendor/angular.min",
"/vendor/angular-couch-potato",
"/vendor/angular-ui-router.min",
"/vendor/angular-ui.min",
"/vendor/angular-loading-bar/loading-bar",
"/vendor/moment/moment.min",
"/vendor/sweetalert/sweetalert.min",
"/vendor/ace/ui-ace.min",
"/vendor/ace/ace.min",
"/vendor/ace/mode-json",
"/vendor/ace/mode-yaml",
"/vendor/ace/mode-ini",
"/vendor/scrollglue",
"app",
"routes/router",
"routes/auth",
"routes/project",
"factories/project",
"/vendor/require.min",
"../require_config"
]

View File

@ -1,35 +0,0 @@
var fs = require('fs'),
async = require('async'),
bundle = require('./bundle.json'),
out = fs.createWriteStream('./js/bundle.js'),
path = require('path'),
child_process = require('child_process'),
uglify = null;
bundle.forEach(file => {
var o = {}
if (typeof file == 'object') {
o = file;
file = o.src;
}
if (file.substr(0, 1) != '/') {
file = '/js/' + file;
}
file = file + '.js';
console.log(file);
var contents = fs.readFileSync('.' + file);
out.write('\n/* BUNDLED FILE: ' + file + ' */\n')
if (o.pre) {
out.write(o.pre + '\n');
}
out.write(contents + '\n');
if (o.post) {
out.write(o.post + '\n');
}
});

View File

@ -1 +0,0 @@
semaphore.css

View File

@ -1 +0,0 @@
*.html

View File

@ -1,7 +0,0 @@
require.config({
baseUrl: document.baseURI + 'public/js',
waitSeconds: 10,
paths: {
async: document.baseURI + 'public/vendor/async'
}
});

@ -1 +0,0 @@
Subproject commit 31cbac89f1465de60797d2879addc8c71de93d1b

24
web/bundle.json Normal file
View File

@ -0,0 +1,24 @@
[
"node_modules/angular/angular.min",
"node_modules/angular-couch-potato/dist/angular-couch-potato",
"node_modules/@uirouter/angularjs/release/angular-ui-router",
"node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls",
"node_modules/angular-loading-bar/build/loading-bar",
"node_modules/moment/min/moment.min",
"node_modules/sweetalert/dist/sweetalert.min",
"node_modules/angular-ui-ace/src/ui-ace",
"node_modules/ace-builds/src-min-noconflict/ace",
"node_modules/ace-builds/src-min-noconflict/mode-json",
"node_modules/ace-builds/src-min-noconflict/mode-yaml",
"node_modules/ace-builds/src-min-noconflict/mode-ini",
"node_modules/angularjs-scroll-glue/src/scrollglue",
"public/js/app",
"public/js/routes/router",
"public/js/routes/auth",
"public/js/routes/project",
"public/js/factories/project",
"node_modules/requirejs/require",
"require_config"
]

27
web/bundler.js Normal file
View File

@ -0,0 +1,27 @@
var fs = require('fs'),
bundle = require('./bundle.json'),
out = fs.createWriteStream('./public/js/bundle.js');
bundle.forEach(function(file) {
var o = {};
if (typeof file === 'object') {
o = file;
file = o.src;
}
file = file + '.js';
var contents = fs.readFileSync(file);
out.write('\n/* BUNDLED FILE: ' + file + ' */\n');
if (o.pre) {
out.write(o.pre + '\n');
}
out.write(contents + '\n');
if (o.post) {
out.write(o.post + '\n');
}
});

97
web/package-lock.json generated Normal file
View File

@ -0,0 +1,97 @@
{
"name": "semaphore",
"version": "2.5.0",
"lockfileVersion": 1,
"dependencies": {
"@uirouter/angularjs": {
"version": "1.0.15",
"resolved": "https://registry.npmjs.org/@uirouter/angularjs/-/angularjs-1.0.15.tgz",
"integrity": "sha512-qV+fz+OV5WRNNCXfeVO7nEcSSNESXOxLC0lXM9sv+IwTW6gyiynZ2wHP7fP2ETbr20sPxtbFC+kMVLzyiw/yIg==",
"dependencies": {
"@uirouter/core": {
"version": "5.0.17",
"resolved": "https://registry.npmjs.org/@uirouter/core/-/core-5.0.17.tgz",
"integrity": "sha512-aJOSpaRbctGw24Mh74sonLwCyskl7KzFz7M0jRDqrd+eHZK6s/xxi4ZSNuGHRy6kF4x7195buQSJEo7u82t+rA=="
}
}
},
"ace-builds": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.3.1.tgz",
"integrity": "sha512-MJtPAqeGaiIpfgUCXi3/oowqcIw4wSkKTDGvtfUoQHrfZGfjNnH3frPdHzd1VfKF62JFeNJOl4q0TRDiHwoBFg=="
},
"angular": {
"version": "1.6.9",
"resolved": "https://registry.npmjs.org/angular/-/angular-1.6.9.tgz",
"integrity": "sha512-6igWH2GIsxV+J38wNWCh8oyjaZsrIPIDO35twloIUyjlF2Yit6UyLAWujHP05ma/LFxTsx4NtYibRoMNBXPR1A=="
},
"angular-couch-potato": {
"version": "git+https://github.com/laurelnaiad/angular-couch-potato.git#fea40f7547890d2914c673e18dd1e752b4b110b3"
},
"angular-loading-bar": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/angular-loading-bar/-/angular-loading-bar-0.9.0.tgz",
"integrity": "sha1-N+9Swl8QLCFuezzf0vxaXflijkU="
},
"angular-ui-ace": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/angular-ui-ace/-/angular-ui-ace-0.2.3.tgz",
"integrity": "sha1-PLkDQoEAYho2f8f2QUQOl6QqJtA="
},
"angular-ui-bootstrap": {
"version": "2.5.6",
"resolved": "https://registry.npmjs.org/angular-ui-bootstrap/-/angular-ui-bootstrap-2.5.6.tgz",
"integrity": "sha512-yzcHpPMLQl0232nDzm5P4iAFTFQ9dMw0QgFLuKYbDj9M0xJ62z0oudYD/Lvh1pWfRsukiytP4Xj6BHOSrSXP8A=="
},
"angularjs-scroll-glue": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/angularjs-scroll-glue/-/angularjs-scroll-glue-2.1.0.tgz",
"integrity": "sha1-2aXo5QG7XkDL6yXzr2awxhM1wiY="
},
"async": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw=="
},
"bootstrap": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.5.tgz",
"integrity": "sha1-F3ereSmbEo2H3OfL2G/cRqxpwLE="
},
"es6-object-assign": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz",
"integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw="
},
"font-awesome": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/font-awesome/-/font-awesome-4.5.0.tgz",
"integrity": "sha1-Hp18z31jvb5XAA4Y1RiMslV+cPg="
},
"lodash": {
"version": "4.17.4",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
"integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
},
"moment": {
"version": "2.11.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.11.1.tgz",
"integrity": "sha1-v0AmQTZA0bgCRnzzU2B/hGTWr0c="
},
"promise-polyfill": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-6.1.0.tgz",
"integrity": "sha1-36lpQ+qcEh/KTem1hoyznTRy4Fc="
},
"requirejs": {
"version": "2.3.5",
"resolved": "https://registry.npmjs.org/requirejs/-/requirejs-2.3.5.tgz",
"integrity": "sha512-svnO+aNcR/an9Dpi44C7KSAy5fFGLtmPbaaCeQaklUz8BQhS64tWWIIlvEA5jrWICzlO/X9KSzSeXFnZdBu8nw=="
},
"sweetalert": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/sweetalert/-/sweetalert-2.1.0.tgz",
"integrity": "sha512-9YKj0SvjKyBfRWco50UOsIbXVeifYbxzT9Qda7EsqC01eafHGCSG0IR7g942ufjzt7lnwO8ZZBwr6emXv2fQrg=="
}
}
}

36
web/package.json Normal file
View File

@ -0,0 +1,36 @@
{
"name": "semaphore",
"version": "2.5.0",
"description": "Open Source alternative to Ansible Tower",
"main": "index.js",
"dependencies": {
"@uirouter/angularjs": "^1.0.15",
"ace-builds": "^1.3.1",
"angular": "^1.6.9",
"angular-couch-potato": "git+https://github.com/laurelnaiad/angular-couch-potato.git",
"angular-loading-bar": "^0.9.0",
"angular-ui-ace": "^0.2.3",
"angular-ui-bootstrap": "^2.5.6",
"angularjs-scroll-glue": "^2.1.0",
"async": "^2.6.0",
"bootstrap": "^3.3.5",
"font-awesome": "^4.5.0",
"moment": "^2.11.1",
"requirejs": "^2.3.5",
"sweetalert": "^2.1.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ansible-semaphore/semaphore.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/ansible-semaphore/semaphore/issues"
},
"homepage": "https://github.com/ansible-semaphore/semaphore#readme"
}

0
web/public/css/.gitkeep Normal file
View File

View File

0
web/public/html/.gitkeep Normal file
View File

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

4
web/require_config.js Normal file
View File

@ -0,0 +1,4 @@
require.config({
baseUrl: document.baseURI + 'public/js',
waitSeconds: 10
});

View File

@ -1,8 +1,8 @@
@import '../vendor/bootstrap/less/variables.less';
@import '../vendor/fontawesome/less/variables.less';
@import '../../node_modules/bootstrap/less/variables.less';
@import '../../node_modules/font-awesome/less/variables.less';
@import '//fonts.googleapis.com/css?family=Roboto:300,400,400italic,700,500,700italic';
@fa-font-path: "../vendor/fontawesome/fonts";
@fa-font-path: "../fonts";
@font-family-sans-serif: Roboto, Arial, sans-serif;
@font-family-monospace: Hack, Menlo, Monaco, Consolas, "Courier New", monospace;
@ -39,10 +39,10 @@
@pre-bg: #fefefe;
@pre-color: #000;
@import '../vendor/bootstrap/less/bootstrap.less';
@import '../vendor/fontawesome/less/font-awesome.less';
@import (less) '../vendor/angular-loading-bar/loading-bar.css';
@import (less) '../vendor/sweetalert/sweetalert.css';
@import '../../node_modules/bootstrap/less/bootstrap.less';
@import '../../node_modules/font-awesome/less/font-awesome.less';
@import (less) '../../node_modules/angular-loading-bar/build/loading-bar.css';
//@import (less) '../../../node_modules/sweetalert/dist/sweetalert.css';
@import 'login.less';
@import 'octocat.less';