Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow absolute paths for seed sources #243

Open
wants to merge 2 commits into
base: v1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/seeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,15 @@ function getSeedsAtLocation(location) {
* Locates seeds given a set of files to scrape
* @param {string[]} sources The filenames to scrape for seeds
*/
function locateSeeds(sources, cwd) {
function locateSeeds(sources) {
sources = sources || [];
cwd = cwd || process.cwd();

const locations = sources.map((source) => path.join(cwd, source));
return BbPromise.map(locations, (location) => {
return fileExists(location).then((exists) => {
return BbPromise.map(sources, (source) => {
return fileExists(source).then((exists) => {
if(!exists) {
throw new Error("source file " + location + " does not exist");
throw new Error("source file " + source + " does not exist");
}
return getSeedsAtLocation(location);
return getSeedsAtLocation(source);
});
// Smash the arrays together
}).then((seedArrays) => [].concat.apply([], seedArrays));
Expand Down