Commit eaa09dbe authored by Robert Lyon's avatar Robert Lyon

Automatic Capistrano build commit

parent 9b3ad064
all: css
production = true
css:
ifeq (, $(shell which npm))
$(error ERROR: Can't find the "npm" executable. Try "sudo apt-get install npm")
endif
ifeq (, $(shell which node))
$(error ERROR: Can't find the "node" executable. Try "sudo apt-get install nodejs-legacy")
endif
ifeq (, $(shell which gulp))
$(error ERROR: Can't find the "gulp" executable. Try doing "sudo npm install -g gulp")
endif
ifndef npmsetup
npm install
endif
@echo "Building CSS..."
@if gulp css --production $(production) ; then echo "Done!"; else npm install; gulp css --production $(production); fi
clean-css:
find ./htdocs/theme/* -maxdepth 1 -name "style" -type d -exec rm -Rf {} \;
help:
@echo "Run 'make' to do "build" Mahara (currently only CSS)"
@echo "Run 'make initcomposer' to install Composer and phpunit"
@echo "Run 'make phpunit' to execute phpunit tests"
@echo "Run 'make imageoptim' to losslessly optimise all images"
@echo "Run 'make minaccept' to run the quick pre-commit tests"
@echo "Run 'make checksignoff' to check that your commits are all Signed-off-by"
@echo "Run 'make push' to push your changes to the repo"
imageoptim:
find . -iname '*.png' -exec optipng -o7 -q {} \;
find . -iname '*.gif' -exec gifsicle -O2 -b {} \;
find . -iname '*.jpg' -exec jpegoptim -q -p --strip-all {} \;
find . -iname '*.jpeg' -exec jpegoptim -q -p --strip-all {} \;
composer := $(shell ls external/composer.phar 2>/dev/null)
initcomposer:
ifdef composer
@echo "Updating Composer..."
@php external/composer.phar --working-dir=external update
else
@echo "Installing Composer..."
@curl -sS https://getcomposer.org/installer | php -- --install-dir=external
@php external/composer.phar --working-dir=external install
endif
vendorphpunit := $(shell external/vendor/bin/phpunit --version 2>/dev/null)
phpunit:
@echo "Running phpunit tests..."
ifdef vendorphpunit
@external/vendor/bin/phpunit --log-junit logs/tests/phpunit-results.xml htdocs/
else
@phpunit --log-junit logs/tests/phpunit-results.xml htdocs/
endif
revision := $(shell git rev-parse --verify HEAD 2>/dev/null)
whitelist := $(shell grep / test/WHITELIST | xargs -I entry find entry -type f | xargs -I file echo '! -path ' file 2>/dev/null)
minaccept:
@echo "Running minimum acceptance test..."
ifdef revision
@git diff-tree --diff-filter=ACM --no-commit-id --name-only -z -r $(revision) htdocs | grep -z "^htdocs/.*\.php$$" | xargs -0 -n 1 -P 2 --no-run-if-empty php -l
@php test/versioncheck.php
@git diff-tree --diff-filter=ACM --no-commit-id --name-only -z -r $(revision) htdocs | grep -z '^htdocs/.*/db/install\.xml$$' | xargs -0 -n 1 -P 2 --no-run-if-empty xmllint --schema htdocs/lib/xmldb/xmldb.xsd --noout
@git diff-tree --diff-filter=ACM --no-commit-id --name-only -r $(revision) | xargs -I {} find {} $(whitelist) | xargs -I list git show $(revision) -- list | test/coding-standard-check.pl
@echo "Acceptance test passed. :)"
else
@echo "No revision found!"
endif
jenkinsaccept: minaccept
@find ./ ! -path './.git/*' -type f -print0 | xargs -0 clamscan > /dev/null && echo All good!
sshargs := $(shell git config --get remote.gerrit.url | sed -re 's~^ssh://([^@]*)@([^:]*):([0-9]*)/mahara~-p \3 -l \1 \2~')
mergebase := $(shell git fetch gerrit >/dev/null 2>&1 && git merge-base HEAD gerrit/master)
sha1chain := $(shell git log $(mergebase)..HEAD --pretty=format:%H | xargs)
changeidchain := $(shell git log $(mergebase)..HEAD --pretty=format:%b | grep '^Change-Id:' | cut -d' ' -f2)
securitycheck:
@if ssh $(sshargs) gerrit query --format TEXT -- $(shell echo $(sha1chain) $(changeidchain) | sed -e 's/ / OR /g') | grep 'status: DRAFT' >/dev/null; then \
echo "This change has drafts in the chain. Please use make security instead"; \
false; \
fi
@if git log $(mergebase)..HEAD --pretty=format:%B | grep -iE '(security|cve)' >/dev/null; then \
echo "This change has a security keyword in it. Please use make security instead"; \
false; \
fi
push: securitycheck minaccept
@echo "Pushing the change upstream..."
@if test -z "$(TAG)"; then \
git push gerrit HEAD:refs/publish/master; \
else \
git push gerrit HEAD:refs/publish/master/$(TAG); \
fi
security: minaccept
@echo "Pushing the SECURITY change upstream..."
@if test -z "$(TAG)"; then \
git push gerrit HEAD:refs/drafts/master; \
else \
git push gerrit HEAD:refs/drafts/master/$(TAG); \
fi
ssh $(sshargs) gerrit set-reviewers --add \"Mahara Security Managers\" -- $(sha1chain)
// Include gulp
var gulp = require('gulp-help')(require('gulp'));
//Polyfill so we don't need >= node 0.12
require('es6-promise').polyfill();
// Include Our Plugins
var sass = require('gulp-sass');
var path = require('path');
var minifyCSS = require('gulp-minify-css');
var autoprefixer = require('gulp-autoprefixer');
var bless = require('gulp-bless');
var es = require('event-stream');
var globule = require('globule');
var argv = require('yargs').default('production', 'true').argv;
var gulpif = require('gulp-if');
// Locate all the themes (they're the directories with a "themeconfig.php" in them)
var themes = globule.find('htdocs/theme/*/themeconfig.php');
themes = themes.map(function(themepath){
themepath = path.join(themepath, '..');
return themepath;
});
// Turn sass into css
gulp.task('css', 'Compile SASS into CSS', function () {
var tasks = themes.map(function(themepath){
console.log("Compiling CSS for " + themepath);
return gulp.src('sass/**/*.scss', {cwd: themepath})
.pipe(gulpif(argv.production !== 'false', sass().on('error', sass.logError), sass({
style: 'expanded',
sourceComments: 'normal'
}).on('error', sass.logError)))
.pipe(autoprefixer({
browsers: ['last 4 version'],
cascade: false
}))
.pipe(gulpif(argv.production !== 'false', minifyCSS()))
.pipe(gulpif(argv.production !== 'false', bless()))
.pipe(gulp.dest('style/', {cwd: themepath}));
});
return es.concat.apply(null, tasks);
});
// Watch Files For Changes
gulp.task('watch', 'Watch style directories and auto-compile CSS', function() {
gulp.watch('htdocs/theme/**/sass/**/*.scss', ['css']);
});
// Default Task (recompile on init before watching)
gulp.task('default', ['css', 'watch']);
// change the colour of the sideblock file quota progress bar
.progress-bar {
background-color: #84a421;
}
// blog post headings
.myblogs {
h1 {
border-bottom: 0;
padding-bottom: 0;
}
.h1, .h2, .h3, .h4, .h5, .h6, h1, h2, h3, h4, h5, h6 {
font-family: $font-family-sans-serif;
color: #333333;
font-weight: 700;
}
.list-group-item-heading {
font-family: $font-family-serif;
color: #474220;
font-weight: 300;
}
.postdescription {
border-top: 1px dotted #d1d1d1;
}
}
// makes the edit page toolbar position more fitting for this theme, plus responsive position
// when there is a static second level nav
.static-nav {
.toolbar-affix.affix {
top: 160px;
@media (max-width: $screen-sm-min) {
top: 0;
}
}
}
// when there is a dropdown second level nav
.dropdown-nav {
.toolbar-affix.affix {
top: 130px;
@media (max-width: $screen-sm-min) {
top: 0;
}
}
}
// viewfooter
.viewfooter {
padding: 15px !important;
background-color: #f7f7f7;
border-radius: 10px;
margin-top: 20px;
h3:first-child {
margin-top: 0;
}
h4:first-child {
margin-top: 0;
}
.pieform {
.files {
.btn {
margin-left: 0; // fixes the attach file btn alignment
}
}
}
}
.arrow-bar {
.arrow {
width: auto;
@media (max-width: $screen-md-min) {
width: auto;
}
}
.right-text {
@media (max-width: $screen-sm-min) {
float: none;
text-align: center;
}
}
}
.nav-inpage {
&.nav > li {
> a, button {
color: $arrow-link-color;
@media (max-width: $screen-sm-min) {
margin-top: 2px;
margin-bottom: 2px;
}
&:hover,
&:focus {
color: $arrow-link-hover-color;
}
}
&.active > a,
&.active > button, {
&:hover,
&:focus {
color: $arrow-link-hover-color;
}
}
}
}
\ No newline at end of file
.btn-group div.form-button-group {
display: inline-block;
margin: 0;
padding: 0;
.btn {
border-left:0;
display: inline-block;
border-bottom-radius: 0;
border-bottom-left-radius: 0;
}
}
// Grey buttons
.btn,
.btn-default {
@include gradient-vertical($start-color: #FFFFFF, $end-color: #ececec, $start-percent: 10%, $end-percent: 100%);
border-color: #dddddd;
color: #676767;
&:focus,
&:hover {
border-color: #a6a6a6;
color: #333333;
}
}
// Green buttons
.btn-success,
.btn-primary,
.btn-with-heading {
@include gradient-vertical($start-color: #99b92d, $end-color: #66860f, $start-percent: 0%, $end-percent: 100%);
border-color: #66860f;
color: #FFFFFF;
text-shadow: rgba(0, 0, 0, 0.1) 0 1px 0;
font-weight: normal;
&:focus,
&:hover {
border-color: #202c01;
color: #FFFFFF;
}
}
// cleans up some btns that went bung after the styles above
.btn-links,
.form-group.submitcancel .cancel {
background: none;
text-shadow: none;
color: $theme-primary-color;
border: 0;
}
.btn-link, .btn-link:active, .btn-link:focus, .btn-link:hover,
.btn-link.active, .btn-link[disabled], fieldset[disabled] .btn-link {
background: none;
text-shadow: none;
color: $theme-primary-color;
border: 0;
}
.btn-link-danger {
color: $brand-danger;
}
// forum buttons
.forum-post-btns {
border-top: 1px dotted #ececec;
padding: 10px;
a {
color: $theme-primary-color;
}
}
//dash
.collapse-indicator {
color: $theme-primary-color;
.collapsed & {
color: $theme-primary-color;
}
a:hover &,
a:focus & {
color: lighten($theme-primary-color, 10%);
}
}
//dash inner
//messages: inbox, sent
//admin: site options
//journals
.inboxblock .link-block,
.form-notificationlist h4 a,
.pieform-fieldset.collapsible h4 a,
.myblogs h5 a {
&:hover .collapse-indicator,
&:focus .collapse-indicator{
color: lighten($theme-primary-color, 10%);
}
.collapse-indicator {
color: $theme-primary-color;
}
}
.expand-indicator {
+ .icon {
color: $theme-primary-color;
&:hover, &:focus {
color: lighten($theme-primary-color, 10%);
}
}
}
// syntax change if link is an outer-link
[data-toggle="collapse"].outer-link {
&.collapsed {
~ .collapse-indicator {
color: $theme-primary-color;
}
}
&:hover,
&:focus {
~ .collapse-indicator {
color: lighten($theme-primary-color, 5%);
}
}
}
.list-group-item-link {
a {
color: $theme-primary-color;
&:hover {
color: lighten($theme-primary-color, 5%);
background-color: rgba(250, 255, 234, 0.3);
}
}
}
.header {
.navbar-toggle {
margin-top: 15px;
@include gradient-vertical($start-color: #FFFFFF, $end-color: #ececec, $start-percent: 10%, $end-percent: 100%);
border-color: #dddddd;
color: #676767;
&:focus,
&:hover {
@include gradient-vertical($start-color: #ececec, $end-color: #ececec, $start-percent: 10%, $end-percent: 100%);
color: #333333;
}
}
.navbar-nav {
.navbar-toggle {
margin-top: 0;
}
}
}
\ No newline at end of file
$logged-in-height: 200px;
$logged-in-height-mobile: 125px;
.dashboard-widget-container {
@include clearfix;
margin-top: $grid-gutter-width;
text-align: center;
.remove-widgets {
font-size: $font-size-small - 1;
}
.hide-info{
clear: both;
}
.widget-heading {
@include clearfix;
padding: 0;
background-color: $dashboard-widget-bg;
border-radius: 50%;
height: $logged-in-height;
width: $logged-in-height;
border-top: 0;
@media (max-width: $screen-sm-min ) {
height: $logged-in-height-mobile;
width: $logged-in-height-mobile;
display: inline-block;
}
h2 {
margin: 5px 0 3px;
text-align: center;
color: $theme-accent-color;
font-weight: 400;
@media (max-width: $screen-sm-min ) {
font-size: 18px;
margin-top: 0;
}
}
p {
margin: 0 16px;
font-size: 13px;
text-align: center;
color: $text-color;
@media (max-width: $screen-sm-min ) {
display: none;
}
}
a {
color: $link-color;
}
}
.circle-bg {
text-align:center;
margin-top: 10px;
margin-right: 0 !important;
float: none;
background-color: transparent;
border-radius: 0;
width: auto;
height: auto;
@media (max-width: $screen-sm-min ) {
margin-top: 5px;
}
.icon {
color: #84a421;
padding-top:16px;
font-size: 72px;
@media (max-width: $screen-sm-min ) {
font-size: 60px;
}
&.icon-user {
padding-left:0; // the only one that is actually centered by default