2017-11-11 23:59:45 -05:00
|
|
|
/**
|
2018-02-08 23:40:00 -05:00
|
|
|
* Command-line bootstrap procedure for Ulambda Scheme
|
2017-11-11 23:59:45 -05:00
|
|
|
*
|
|
|
|
* Copyright (C) 2017 Mike Gerwitz
|
|
|
|
*
|
2018-02-08 23:40:00 -05:00
|
|
|
* This file is part of Ulambda Scheme.
|
2017-11-11 23:59:45 -05:00
|
|
|
*
|
2018-02-08 23:40:00 -05:00
|
|
|
* Ulambda Scheme is free software: you can redistribute it and/or modify
|
2017-11-11 23:59:45 -05:00
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* This script is intended to be run from the command line and requires
|
|
|
|
* Node.js; it is more suitable to development and automated processes.
|
|
|
|
* If you are a user or non-developer without such an environment set up,
|
|
|
|
* then you might rather bootstrap using your web browser instead; you can
|
|
|
|
* do so by directing your web browser to `bootstrap.html', located in the
|
|
|
|
* same directory as this file.
|
|
|
|
*
|
|
|
|
* To perform the entire bootstrapping process, simply invoke this script:
|
|
|
|
* $ node bootstrap.js
|
|
|
|
*
|
|
|
|
* For more information on each aspect of the process, see the individual
|
|
|
|
* files in `./bootstrap/'.
|
|
|
|
*/
|
|
|
|
|
2018-09-10 20:58:18 -04:00
|
|
|
const Bootstrap = require( './Bootstrap' );
|
|
|
|
const Prebirth = require( './prebirth' );
|
2017-11-11 23:59:45 -05:00
|
|
|
|
|
|
|
const logf = ( str, e ) =>
|
|
|
|
{
|
|
|
|
console.log( str );
|
|
|
|
|
|
|
|
if ( e instanceof Error ) {
|
|
|
|
console.error( e );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const getf = path => Promise.resolve(
|
2018-09-10 20:58:18 -04:00
|
|
|
require( 'fs' ).readFileSync( `./${path}` ).toString()
|
2017-11-11 23:59:45 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
const strap = new Bootstrap( getf, logf, new Prebirth() );
|
|
|
|
|
2018-09-10 23:04:53 -04:00
|
|
|
// Attempt bootstrap. Error output is handled by Bootstrap, since the
|
|
|
|
// output must also work correctly in a browser environment.
|
|
|
|
strap.bootstrap()
|
|
|
|
.catch( _ => process.exit( 1 ) );
|