Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createLinks(args) {
const glob = (args.recursive ? '**/' : '') + args.input;
const configFiles = globule.find(glob);
var generated = [];
if (configFiles.length == 0) {
console.log("No config files found!");
return;
}
if (args.verbose)
console.log("Using config files: " + configFiles.join("\n"));
configFiles.forEach(function(configFile) {
// Get config file's directory
const configDir = configFile.substring(0, configFile.lastIndexOf("/"));
_loadServices() {
const oxServicesDirPath = path.resolve(this.oxBaseDir, './ox_services');
const serviceFiles = globule.find('service-*.js', { srcBase: oxServicesDirPath });
// initialize all services
log.debug('Loading services...');
for (var i = 0; i < serviceFiles.length; i++) {
const serviceFileName = serviceFiles[i];
const serviceFilePath = path.join(oxServicesDirPath, serviceFileName);
const result = serviceFileName.match(SERVICE_NAME_MATCH_REGEX);
const serviceName = result[1];
try {
const service = this._loadService(serviceName, serviceFilePath);
service.init();
this.services[serviceName] = service;
} catch (e) {
log.error('Error initializing service "' + serviceName + '": ' + e.message + EOL + (e.stacktrace ? e.stacktrace : ''));
}
gulp.task('templates', ['clean-rev'], function (cb) {
verbose(chalk.grey('Running task "templates"'));
// If assebly is off, export all folders and files
if (!config.assemble_templates) {
gulp.src(['templates/**/*', '!templates/*.*', '!_*'])
.pipe(gulp.dest(config.export_templates));
}
// Find number of "root" templates to parse and keep count
var numTemplates = globule.find(['templates/*.*', '!_*']).length,
count = 0,
unvalidatedFiles = [];
// Go over all root template files
gulp.src(['templates/*.*', '!_*'])
.pipe(plugins.tap(function (htmlFile) {
var
// Extract bits from filename
baseName = path.basename(htmlFile.path),
nameParts = baseName.split('.'),
ext = _.without(nameParts, _.first(nameParts)).join('.'),
viewBaseName = _.last(nameParts[0].split('view-')),
// Make sure Windows paths work down below
cwdParts = cwd.replace(/\\/g, '/').split('/'),
import * as globule from 'globule';
let filepaths: string[];
filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });
filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });
let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });
let mappings = globule.mapping(['*.js']);
const len = mappings.length;
import * as globule from 'globule';
let filepaths: string[];
filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });
filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });
let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });
let mappings = globule.mapping(['*.js']);
const len = mappings.length;
const src = mappings[0].src;
const dest = mappings[0].dest;
mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
mappings = globule.mapping(['*.js'], ['*.less']);
import * as globule from 'globule';
let filepaths: string[];
filepaths = globule.find('**/*.js');
filepaths = globule.find(['**/*.js']);
filepaths = globule.find('**/*.js', '**/*.less');
filepaths = globule.find('*.js', { matchBase: true });
filepaths = globule.find('**/*.js', '**/*.less', { filter: 'isFile' });
filepaths = globule.find('**/*.js', '**/*.less', { filter: /jQuery/i.test });
filepaths = globule.find({ src: '**/*.js' });
filepaths = globule.match('*.js', '/home/code');
filepaths = globule.match('*.js', '/home/code', { matchBase: true });
let bResult: boolean;
bResult = globule.isMatch('*.js', '/home/code');
bResult = globule.isMatch('*.js', '/home/code', { matchBase: true });
let mappings = globule.mapping(['*.js']);
const len = mappings.length;
const src = mappings[0].src;
const dest = mappings[0].dest;
mappings = globule.mapping(['*.js'], { srcBase: '/home/code' });
mappings = globule.mapping(['*.js', '*.less']);
Gaze.prototype._internalAdd = function(file, done) {
var files = [];
if (helper.isDir(file)) {
files = [helper.markDir(file)].concat(globule.find(this._patterns, this.options));
} else {
if (globule.isMatch(this._patterns, file, this.options)) {
files = [file];
}
}
if (files.length > 0) {
this._addToWatched(files);
this.close(false);
this._initWatched(done);
}
};
gulp.task('build:announcement', function() {
const globOpts = {
srcBase: 'src/content/en/',
prefixBase: true,
};
const dumpYamlOpts = {lineWidth: 1000};
const projectYamlFiles = glob.find('**/_project.yaml', globOpts);
const file = 'src/data/announcement.yaml';
const announcementYaml = jsYaml.safeLoad(fs.readFileSync(file, 'utf8'));
const showAnnouncement = announcementYaml['enabled'];
projectYamlFiles.forEach((file) => {
let projYaml = jsYaml.safeLoad(fs.readFileSync(file, 'utf8'));
if (showAnnouncement) {
projYaml.announcement = {};
projYaml.announcement.description = announcementYaml.description;
if (announcementYaml.background) {
projYaml.announcement.background = announcementYaml.background;
}
} else {
delete projYaml['announcement'];
}
fs.writeFileSync(file, jsYaml.safeDump(projYaml, dumpYamlOpts));
});
initRouters(base, sync) {
const formatPattern = this.formatPattern.bind(this);
const files = globule.find(formatPattern(base, sync));
const methodGetter = this.methodGetter;
const urlMatch = sync
? filePath => {
let url = this.tplUrlMap[filePath];
if (url) {
return url;
}
return this.syncDataMatch(filePath);
}
: this.asyncDataMatch;
const routers = files.reduce((prev, file) => {
const filePath = this.transformSep(
this.removeExtense(path.relative(base, file), sync)
);
let urls = urlMatch(filePath);
Gaze.prototype.add = function (files, done) {
if (typeof files === 'string') { files = [files]; }
this._patterns = helper.unique.apply(null, [this._patterns, files]);
files = globule.find(this._patterns, this.options);
this._addToWatched(files);
this.close(false);
this._initWatched(done);
};