Skip to content

Commit

Permalink
Merge branch 'dev' into dev-10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EreMaijala committed Aug 14, 2023
2 parents cc7796a + 09faad7 commit 1bc1f33
Show file tree
Hide file tree
Showing 24 changed files with 719 additions and 199 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
ChangeLog
TAGS
composer.phar
env.bat
env.sh
import/solrmarc.log*
lessphp_*.list
module/VuFind/tests/.phpunit.result.cache
Expand Down
74 changes: 45 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ module.exports = function(grunt) {
scss: {
sass: {
options: {
style: 'compress'
outputStyle: 'compressed',
}
}
},
'check:scss': {
sass: {
}
},

// Convert LESS to SASS, mostly for development team use
lessToSass: {
Expand Down Expand Up @@ -203,35 +207,12 @@ module.exports = function(grunt) {
});

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: {
implementation: require("node-sass"),
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', getSassConfig(this.data.options, false));
grunt.task.run('sass');
});

grunt.config.set('sass', sassConfig);
grunt.registerMultiTask('check:scss', function sassCheck() {
grunt.config.set('sass', getSassConfig(this.data.options, true));
grunt.task.run('sass');
});

Expand All @@ -241,10 +222,45 @@ module.exports = function(grunt) {
- grunt less = compile and compress all themes' LESS files to css.
- grunt scss = compile and map all themes' SASS files to css.
- grunt lessdev = compile and map all themes' LESS files to css.
- grunt check:scss = check all themes' SASS files.
- grunt watch:[cmd] = continuous monitor source files and run command when changes are detected.
- grunt watch:less
- grunt watch:scss
- grunt watch:lessdev
- grunt lessToSass = transpile all LESS files to SASS.`);
});

function getSassConfig(additionalOptions, checkOnly) {
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) {
if (Object.prototype.hasOwnProperty.call(themeList, i)) {
var config = {
options: {
implementation: require("node-sass"),
},
files: [{
expand: true,
cwd: path.join('themes', themeList[i], 'scss'),
src: ['compiled.scss'],
dest: checkOnly ? null : path.join('themes', themeList[i], 'css'),
ext: '.css'
}]
};
for (var key in additionalOptions) {
if (Object.prototype.hasOwnProperty.call(additionalOptions, key)) {
config.options[key] = additionalOptions[key];
}
}
config.options.includePaths = getLoadPaths('themes/' + themeList[i] + '/scss/compiled.scss');

sassConfig[themeList[i]] = config;
}
}
return sassConfig;
}
};
56 changes: 47 additions & 9 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<property name="solr_startup_sleep" value="0" />
<property name="solr_additional_jvm_options" value="-Dlog4j2.formatMsgNoLookups=true" />
<property name="solr_version" value="9.1.1" />
<property name="solr_port" value="8983" />
<property name="skip_phpdoc" value="false" />
<property name="phpdoc_version" value="3.3.1" />
<property name="html_validator" value="" /><!-- set to base address of NU Validator (e.g. http://localhost:8888/) for HTML validation during Mink tests -->
Expand Down Expand Up @@ -200,7 +201,7 @@

<!-- Run Sass build, error if it fails -->
<target name="checkSassBuild">
<exec command="npm run build:scss" checkreturn="true" passthru="true" />
<exec command="npm run check:scss" checkreturn="true" passthru="true" />
</target>

<!-- Run LessToSass, error if there are uncommitted changes (used by continuous integration) -->
Expand Down Expand Up @@ -272,7 +273,7 @@
<property name="paramCoverageDir" value="" />
</else>
</if>
<exec dir="${srcdir}/module/VuFind/tests" command="XDEBUG_MODE=coverage VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} ${paramCoverageDir} ${phpunit_command} --log-junit ${builddir}/reports/phpunit.xml --coverage-php ${coveragedir}/tmp/unit.cov ${phpunit_extra_params}" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/module/VuFind/tests" command="XDEBUG_MODE=coverage VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} SOLR_PORT=${solr_port} ${paramCoverageDir} ${phpunit_command} --log-junit ${builddir}/reports/phpunit.xml --coverage-php ${coveragedir}/tmp/unit.cov ${phpunit_extra_params}" passthru="true" checkreturn="true" />

<!-- Produce coverage reports -->
<exec command="${srcdir}/vendor/bin/phpcov merge --clover ${coveragedir}/clover.xml --html ${coveragedir} ${coveragedir}/tmp" passthru="true" checkreturn="true" />
Expand All @@ -292,12 +293,12 @@

<!-- PHPUnit without logging output -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} ${phpunit_command} ${phpunit_extra_params}" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} SOLR_PORT=${solr_port} ${phpunit_command} ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>

<!-- PHPUnit without logging output, stopping at first error or failure -->
<target name="phpunitfaster" description="Run tests until first failure">
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} ${phpunit_command} --stop-on-failure ${phpunit_extra_params}" passthru="true" checkreturn="true" />
<exec dir="${srcdir}/module/VuFind/tests" command="VUFIND_MINK_DRIVER=${mink_driver} VUFIND_SCREENSHOT_DIR=${screenshot_dir} ${phpunit_html_validation_params} VUFIND_SELENIUM_BROWSER=${selenium_browser} VUFIND_SNOOZE_MULTIPLIER=${snooze_multiplier} VUFIND_LOCAL_DIR=${localdir} VUFIND_URL=${vufindurl} SOLR_PORT=${solr_port} ${phpunit_command} --stop-on-failure ${phpunit_extra_params}" passthru="true" checkreturn="true" />
</target>

<target name="installsolr" description="Install Solr">
Expand Down Expand Up @@ -400,14 +401,26 @@

<!-- Install and Activate VuFind -->
<target name="startup" description="install and activate demo">
<property name="solr_pid_file" value="${localdir}/solr-8983.pid" />
<property name="solr_pid_file" value="${localdir}/solr-${solr_port}.pid" />
<!-- fail if the system is already running -->
<if>
<available file="${solr_pid_file}" />
<then>
<fail>Solr PID file (${solr_pid_file}) detected. Is the system already running?</fail>
</then>
</if>
<if>
<available file="${srcdir}/env.bat" />
<then>
<fail>Environment file (env.bat) detected. Is the system already running?</fail>
</then>
</if>
<if>
<available file="${srcdir}/env.sh" />
<then>
<fail>Environment file (env.sh) detected. Is the system already running?</fail>
</then>
</if>

<phingcall target="check_local_config" />

Expand Down Expand Up @@ -484,7 +497,7 @@

<!-- Generate basic configuration -->
<php expression="end(explode('/', '${vufindurl}'))" returnProperty="basepath" />
<exec command="php ${srcdir}/install.php --basepath=/${basepath} --non-interactive" passthru="true" checkreturn="true" />
<exec command="php ${srcdir}/install.php --basepath=/${basepath} --non-interactive --solr-port=${solr_port}" passthru="true" checkreturn="true" />

<!-- Update config.ini to activate DB connection, exception logging and test mode -->
<if>
Expand All @@ -503,6 +516,15 @@
<regexp pattern="mysql://root@localhost/vufind" replace="${db_connection_string}" />
<regexp pattern=";file\s+= /var/log/vufind.log:alert,error,notice,debug" replace="file = ${srcdir}/vufind-exception.log:alert-5,error-5" />
<regexp pattern="(\[System\]\s+)" replace="\1runningTestSuite=1" />
<regexp pattern="(url\s+= http://localhost):8983/solr" replace="\1:${solr_port}/solr" />
</replaceregexp>
</filterchain>
</copy>

<copy file="${srcdir}/config/vufind/Search2.ini" tofile="${localdir}/config/vufind/Search2.ini">
<filterchain>
<replaceregexp>
<regexp pattern="(url\s+= http://localhost):8983/solr" replace="\1:${solr_port}/solr" />
</replaceregexp>
</filterchain>
</copy>
Expand Down Expand Up @@ -562,7 +584,7 @@
<!-- Set up Solr -->
<target name="setup_solr">
<!-- Start Solr using restart in case of old PID files -->
<exec command="SOLR_PID_DIR=${localdir} VUFIND_HOME=${srcdir} SOLR_ADDITIONAL_JVM_OPTIONS=${solr_additional_jvm_options} ${srcdir}/solr.sh restart" passthru="true" checkreturn="true" />
<exec command="SOLR_PID_DIR=${localdir} VUFIND_HOME=${srcdir} SOLR_ADDITIONAL_JVM_OPTIONS=${solr_additional_jvm_options} SOLR_PORT=${solr_port} ${srcdir}/solr.sh restart" passthru="true" checkreturn="true" />
<!-- fail if Solr did not start up successfully: -->
<if>
<not><available file="${solr_pid_file}" /></not>
Expand Down Expand Up @@ -646,7 +668,7 @@ ${git_status}
</if>

<!-- stop Solr -->
<exec command="SOLR_PID_DIR=${localdir} VUFIND_HOME=${srcdir} SOLR_ADDITIONAL_JVM_OPTIONS=${solr_additional_jvm_options} ${srcdir}/solr.sh stop" passthru="true" />
<exec command="SOLR_PID_DIR=${localdir} VUFIND_HOME=${srcdir} SOLR_ADDITIONAL_JVM_OPTIONS=${solr_additional_jvm_options} SOLR_PORT=${solr_port} ${srcdir}/solr.sh stop" passthru="true" />

<!-- run extra cleanup action, if any -->
<if>
Expand All @@ -667,6 +689,18 @@ ${git_status}
</if>

<!-- delete the configuration, sample index, logs and cache data -->
<if>
<available file="${srcdir}/env.bat" />
<then>
<delete file="${srcdir}/env.bat" failonerror="true" />
</then>
</if>
<if>
<available file="${srcdir}/env.sh" />
<then>
<delete file="${srcdir}/env.sh" failonerror="true" />
</then>
</if>
<if>
<available file="${srcdir}/import/solrmarc.log" />
<then>
Expand Down Expand Up @@ -711,7 +745,7 @@ ${git_status}

<!-- Reset database and configuration of the demo setup -->
<target name="reset_setup" description="reset configuration and database of demo">
<property name="solr_pid_file" value="${localdir}/solr-8983.pid" />
<property name="solr_pid_file" value="${localdir}/solr-${solr_port}.pid" />
<!-- fail if the system is not already running -->
<if>
<not><available file="${solr_pid_file}" /></not>
Expand Down Expand Up @@ -739,6 +773,10 @@ ${git_status}
<include name="*" />
</fileset>
</delete>
<delete file="${srcdir}/env.bat" />
<delete file="${srcdir}/env.sh" />
<delete file="${localdir}/import/import.properties" />
<delete file="${localdir}/import/import_auth.properties" />

<phingcall target="configure_install" />
<phingcall target="setup_database" />
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"laminas/laminas-text": "2.10.0",
"laminas/laminas-validator": "2.30.1",
"laminas/laminas-view": "2.27.0",
"league/commonmark": "2.3.9",
"league/commonmark": "2.4.0",
"league/oauth2-server": "8.5.3",
"lm-commons/lmc-rbac-mvc": "3.3.2",
"matthiasmullie/minify": "1.3.70",
Expand Down
Loading

0 comments on commit 1bc1f33

Please sign in to comment.