Skip to content
This repository has been archived by the owner on Jan 25, 2021. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
edelm committed Jan 12, 2017
2 parents 81f5e63 + b60b41d commit afef68f
Show file tree
Hide file tree
Showing 1,483 changed files with 147,892 additions and 22,144 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
extends: "eslint:recommended",
env: { "browser": true },
globals: {
"$": false,
"jQuery": false
},
rules: {
// errors
"block-scoped-var": "error",
"func-names": "error",
"no-loop-func": "error",
"no-param-reassign": "error",
"no-shadow": "error",
"no-unused-expressions": "error",

// warnings
"dot-notation": "warn",
"eqeqeq": ["warn", "smart"],
"guard-for-in": "warn",
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }],
"no-lonely-if": "warn",
"no-console": ["warn", { "allow": ["warn", "error"] }],
"no-unneeded-ternary": "warn",

// fixed automatically
"block-spacing": ["warn", "always"],
"comma-spacing": ["warn", { "before": false, "after": true }],
"indent": ["error", 2],
"keyword-spacing": ["warn", { "before": true, "after": true }],
"linebreak-style": ["error", "unix"],
"no-multi-spaces": "warn",
"semi-spacing": ["warn", { "before": false, "after": true }],
"space-infix-ops": "warn"
}
};
7 changes: 0 additions & 7 deletions .github/pull_request_template.md

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ TAGS
*~
/vendor
composer.lock
composer.phar
import/solrmarc.log
export/nationalLicence
node_modules
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ before_script:
- pear install phing/phing
- phpenv config-rm xdebug.ini
- phpenv rehash
- npm install -g eslint@"<3.0.0"

script:
- phing composer phpunitfast phpcs-console php-cs-fixer-dryrun
- phing composer phpunitfast phpcs-console php-cs-fixer-dryrun eslint
172 changes: 172 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
module.exports = function(grunt) {
require('jit-grunt')(grunt); // Just in time library loading

var fs = require('fs');

function getLoadPaths(file) {
var config;
var parts = file.split('/');
parts.pop(); // eliminate filename

// initialize search path with directory containing LESS file
var retVal = [];
retVal.push(parts.join('/'));

// Iterate through theme.config.php files collecting parent themes in search path:
while (config = fs.readFileSync("themes/" + parts[1] + "/theme.config.php", "UTF-8")) {
var matches = config.match(/["']extends["']\s*=>\s*['"](\w+)['"]/);

// "extends" set to "false" or missing entirely? We've hit the end of the line:
if (matches === null || matches[1] === 'false') {
break;
}

parts[1] = matches[1];
retVal.push(parts.join('/') + '/');
}
return retVal;
}

var fontAwesomePath = '"../../bootstrap3/css/fonts"';

grunt.initConfig({
// LESS compilation
less: {
compile: {
options: {
paths: getLoadPaths,
compress: true,
modifyVars: {
'fa-font-path': fontAwesomePath
}
},
files: [{
expand: true,
src: "themes/*/less/compiled.less",
rename: function (dest, src) {
return src.replace('/less/', '/css/').replace('.less', '.css');
}
}]
}
},
// SASS compilation
scss: {
sass: {
options: {
style: 'compress'
}
}
},
// Convert LESS to SASS, mostly for development team use
lessToSass: {
convert: {
files: [
{
expand: true,
cwd: 'themes/bootstrap3/less',
src: ['*.less', 'components/*.less'],
ext: '.scss',
dest: 'themes/bootstrap3/scss'
},
{
expand: true,
cwd: 'themes/bootprint3/less',
src: ['*.less'],
ext: '.scss',
dest: 'themes/bootprint3/scss'
}
],
options: {
replacements: [
{ // Replace ; in include with ,
pattern: /(\s+)@include ([^\(]+)\(([^\)]+)\);/gi,
replacement: function mixinCommas(match, space, $1, $2) {
return space + '@include ' + $1 + '(' + $2.replace(/;/g, ',') + ');';
},
order: 3
},
{ // Inline &:extends converted
pattern: /&:extend\(([^\)]+)\)/gi,
replacement: '@extend $1',
order: 3
},
{ // Inline variables not default
pattern: / !default; }/gi,
replacement: '; }',
order: 3
},
{ // VuFind: Correct paths
pattern: 'vendor/bootstrap/bootstrap',
replacement: 'vendor/bootstrap',
order: 4
},
{
pattern: '$fa-font-path: "../../../fonts" !default;\n',
replacement: '',
order: 4
},
{
pattern: '@import "vendor/font-awesome/font-awesome";',
replacement: '$fa-font-path: ' + fontAwesomePath + ';\n@import "vendor/font-awesome/font-awesome";',
order: 4
},
{ // VuFind: Bootprint fixes
pattern: '@import "bootstrap";\n@import "variables";',
replacement: '@import "variables", "bootstrap";',
order: 4
},
{
pattern: '$brand-primary: #619144 !default;',
replacement: '$brand-primary: #619144;',
order: 4
}
]
}
}
},
watch: {
options: {
atBegin: true
},
less: {
files: 'themes/*/less/**/*.less',
tasks: ['less']
},
scss: {
files: 'themes/*/scss/**/*.scss',
tasks: ['scss']
}
}
});
grunt.registerMultiTask('scss', function sassScan() {
var sassConfig = {},
path = require('path'),
themeList = fs.readdirSync(path.resolve('themes')).filter(function (theme) {
return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss'));
});

for (var i in themeList) {
var config = {
options: {
outputStyle: 'compressed'
},
files: [{
expand: true,
cwd: path.join('themes', themeList[i], 'scss'),
src: ['compiled.scss'],
dest: path.join('themes', themeList[i], 'css'),
ext: '.css'
}]
};
for (var key in this.data.options) {
config.options[key] = this.data.options[key] + '';
}
config.options.includePaths = getLoadPaths('themes/' + themeList[i] + '/scss/compiled.scss');

sassConfig[themeList[i]] = config;
}

grunt.config.set('sass', sassConfig);
grunt.task.run('sass');
});
};
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ records. To learn more, visit https://vufind.org.

Installation
------------
See online documentation at https://vufind.org/wiki/installation

See online documentation at https://vufind.org/wiki/installation
Contributing
------------
See our [developers handbook](https://vufind.org/wiki/development) for more information.
51 changes: 39 additions & 12 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<property name="apacheconfdir" value="/etc/apache2/conf.d" />
<property name="apachectl" value="false" /><!-- set to apachectl path to spin up Apache instance -->
<property name="seleniumjar" value="false" /><!-- set to Selenium jar path to spin up Selenium instance -->
<property name="nodepath" value="" /><!-- set to node.js modules path to use Zombie.js testing -->
<!-- command for extra cleanup during shutdown; e.g. to change cache ownership after testing w/ Apache so deletion won't fail: -->
<property name="extra_shutdown_cleanup" value="false" />
<property name="vufindurl" value="http://localhost/vufind" />
Expand All @@ -22,12 +21,14 @@
<property name="pgsqlrootuser" value="postgres" />
<property name="phpunit_extra_params" value="" />
<property name="composer_extra_params" value="" />
<property name="mink_driver" value="zombiejs" /><!-- may also be set to selenium -->
<property name="mink_driver" value="selenium" />
<property name="selenium_browser" value="firefox" />
<property name="snooze_multiplier" value="1" /><!-- can be used to slow down tests (selenium only) -->
<property name="solr_startup_sleep" value="0" />
<property name="php-cs-fixers" value="no_blank_lines_before_namespaces,function_call_space,trailing_spaces,unused_use,lowercase_keywords,encoding,parenthesis,php_closing_tag,visibility,duplicate_semicolon,extra_empty_lines,no_blank_lines_after_class_opening,no_empty_lines_after_phpdocs,operators_spaces,spaces_before_semicolon,ternary_spaces,concat_with_spaces,short_array_syntax,phpdoc_no_access,remove_leading_slash_use,eof_ending" />


<property name="version" value="3.0.3" />
<property name="version" value="3.1.1" />

<!-- We only need the -p switch if the password is non-blank -->
<if><not><equals arg1="${mysqlrootpass}" arg2="" /></not><then>
Expand Down Expand Up @@ -65,6 +66,7 @@
<phingcall target="phpmd"/>
<phingcall target="pdepend"/>
<phingcall target="phploc"/>
<phingcall target="eslint-report"/>
</target>

<!-- Report rule violations with PHPMD (mess detector) -->
Expand Down Expand Up @@ -103,11 +105,22 @@
<exec command="${srcdir}/vendor/bin/php-cs-fixer fix ${srcdir}/module --fixers=${php-cs-fixers} --dry-run --verbose --diff" passthru="true" escape="false" checkreturn="true" />
</target>

<!-- ESLint -->
<target name="eslint">
<exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js" escape="false" checkreturn="true" passthru="true" />
</target>
<target name="eslint-fix">
<exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js --fix" escape="false" passthru="true" />
</target>
<target name="eslint-report">
<exec command="eslint -c ${srcdir}/.eslintrc.js ${srcdir}/themes/bootstrap3/js/*.js --format checkstyle -o ${builddir}/reports/eslint.xml" escape="false" />
</target>

<!-- PHP API Documentation -->
<target name="phpdoc">
<mkdir dir="${builddir}/apidocs"/>
<phpdoc2 title="VuFind API Documentation"
destdir="${builddir}/apidocs">
destdir="${builddir}/apidocs">
<fileset dir=".">
<include name="module/*/src/**/*.php" />
</fileset>
Expand All @@ -116,12 +129,12 @@

<!-- PHPUnit -->
<target name="phpunit" description="Run tests">
<exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} ${srcdir}/vendor/bin/phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${phpunit_extra_params}" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} ${srcdir}/vendor/bin/phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>

<!-- PHPUnit without logging output -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}/module/VuFind/tests" command="NODE_PATH=${nodepath} VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} ${srcdir}/vendor/bin/phpunit -dzend.enable_gc=0 ${phpunit_extra_params}" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${srcdir}/local VUFIND_URL=${vufindurl} ${srcdir}/vendor/bin/phpunit -dzend.enable_gc=0 ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>

<target name="composer" description="Install dependencies with Composer">
Expand All @@ -130,12 +143,6 @@
<exec command="php ${srcdir}/composer.phar install ${composer_extra_params}" passthru="true" checkreturn="true" />
</target>

<target name="composer" description="Install dependencies with Composer">
<httpget url="https://getcomposer.org/composer.phar" sslVerifyPeer="false" dir="${srcdir}" />
<echo message="Installing dependencies..." />
<exec command="php ${srcdir}/composer.phar install" />
</target>

<!-- Install and Activate VuFind -->
<target name="startup" description="install and activate demo">
<!-- get dependencies -->
Expand Down Expand Up @@ -206,6 +213,17 @@
<exec command="VUFIND_HOME=${srcdir} ${srcdir}/solr.sh restart" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />

<if>
<equals arg1="0" arg2="${solr_startup_sleep}" />
<then>
<!-- do nothing -->
</then>
<else>
<echo message="Waiting ${solr_startup_sleep} seconds for Solr to be ready..." />
<exec command="sleep ${solr_startup_sleep}" />
</else>
</if>

<!-- import marc test records into vufind index (note: the marc test records have prefix "testsample#") -->
<exec escape="false" command="find ${srcdir}/tests/data -name '*.mrc' -printf '%p,'" outputProperty="buglist" />
<foreach list="${buglist}" param="filename" delimiter="," target="importrec" />
Expand Down Expand Up @@ -340,6 +358,15 @@
<exec command="echo building=\&quot;${BASENAME}\&quot; &gt;&gt; ${srcdir}/local/import/marc-${BASENAME}.properties" />
<exec command="sed -e &quot;s!marc_local.properties!marc-${BASENAME}.properties!&quot; ${srcdir}/local/import/import.properties &gt; ${srcdir}/local/import/import-${BASENAME}.properties" />

<!-- if there is a file-specific import configuration, load it now: -->
<if>
<available file="${filename}.properties" />
<then>
<echo message="Found custom import configs for ${filename}." />
<exec command="cat ${filename}.properties &gt;&gt; ${srcdir}/local/import/marc-${BASENAME}.properties" />
</then>
</if>

<!-- perform the import -->
<exec command="VUFIND_HOME=${srcdir} VUFIND_LOCAL_DIR=${srcdir}/local ${srcdir}/import-marc.sh -p ${srcdir}/local/import/import-${BASENAME}.properties ${filename}" outputProperty="LASTOUTPUT" />
<echo message="${LASTOUTPUT}" />
Expand Down
Loading

0 comments on commit afef68f

Please sign in to comment.