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

Add path field check in multi project repos #215

Closed
wants to merge 7 commits into from

Conversation

SDBowen
Copy link
Contributor

@SDBowen SDBowen commented Dec 2, 2019

Closes #183 🎉

Copy link
Member

@kasbah kasbah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Were you able to test this? Can we try it out with https://github.com/kitspace-forks/DIY_particle_detector ?

tasks/page/processBOM.js Show resolved Hide resolved
tasks/page/processGerbers.js Outdated Show resolved Hide resolved
tasks/page/processBOM.js Outdated Show resolved Hide resolved
tasks/makeBoardsJson.js Outdated Show resolved Hide resolved
tasks/page/processBOM.js Outdated Show resolved Hide resolved
@kasbah
Copy link
Member

kasbah commented Dec 3, 2019

Looks like build is reporting as failing because https://gogs.zenerdio.de/sebastian/satnogs-diplexer is down.

@SDBowen
Copy link
Contributor Author

SDBowen commented Dec 3, 2019

Does http://add-project-path-to-yaml.preview.kitspace.org/ still get updated?

I did not see the repo I added on there.

@kasbah
Copy link
Member

kasbah commented Dec 3, 2019

Yes, it should still be uploaded. Can't see the particle detector either though. Let's see when the latest build completes...

@kasbah
Copy link
Member

kasbah commented Dec 4, 2019

@kasbah
Copy link
Member

kasbah commented Dec 4, 2019

Looking good! Do you think you could throw in the readme path (#183). That example project would look way better if we could point both versions to the root README.md.

@kasbah
Copy link
Member

kasbah commented Dec 4, 2019

Wait, does the path do anything beside look for the readme at the moment? Are defaults gerbers and 1-click-bom.tsv looked for if the fields aren't defined in the yaml?

@SDBowen
Copy link
Contributor Author

SDBowen commented Dec 4, 2019

It is used here in the configure file, which later uses the folder paths in the build process.

kitspace/configure

Lines 131 to 166 in 31e073f

let boardFolders = globule.find('boards/*/*/*', {filter: 'isDirectory'})
boardFolders = boardFolders.reduce((newBoardFolders, folder, index) => {
let info
let file
if (fs.existsSync(`${folder}/kitnic.yaml`)) {
file = fs.readFileSync(`${folder}/kitnic.yaml`)
} else if (fs.existsSync(`${folder}/kitspace.yaml`)) {
file = fs.readFileSync(`${folder}/kitspace.yaml`)
} else if (fs.existsSync(`${folder}/kitspace.yml`)) {
file = fs.readFileSync(`${folder}/kitspace.yml`)
}
if (file != null) {
info = yaml.safeLoad(file)
} else {
info = {}
}
if (info.multi) {
for (let project in info.multi) {
const multiProjectPath = info.multi[project].path
let projectPath
if (multiProjectPath) {
projectPath = path.join(folder, multiProjectPath)
} else {
projectPath = path.join(folder, project)
}
newBoardFolders.push(projectPath)
}
} else {
newBoardFolders.push(folder)
}
return newBoardFolders
}, [])

I also see I used this logic in a few places which I think we can get rid of, making use of the folder path from above.

if (repoFolders.length > 4) {
repoRootPath = repoFolders.slice(0, 4).join('/')
projectPath = repoFolders.splice(4).join('/')
} else {
repoRootPath = folder
projectPath = folder
}

@SDBowen
Copy link
Contributor Author

SDBowen commented Dec 4, 2019

Testing with taking out the bom and gerbers path of a multi repo; the gerbers will be found, but it will fail if the bom path is missing.

if (info.bom) {
bom = path.join(repoRootPath, info.bom)
} else {
bom = path.join(projectPath, '1-click-bom.tsv')
}

This section isn't working as intended with multi repos. Generates an incomplete path:

Screenshot from 2019-12-04 22-22-56

@kasbah
Copy link
Member

kasbah commented Dec 4, 2019

It finding the gerbers may just be because it scans the whole repo for suitable files. Is there a .tsv file when it shows that error for the bom? Our example has .csv files and they are in a bom/ folder.

@SDBowen
Copy link
Contributor Author

SDBowen commented Dec 4, 2019 via email

@kasbah
Copy link
Member

kasbah commented Dec 10, 2019

Sorry to go back and forth on this but I think it actually makes much more sense to just be able to set a readme field rather than a path field. We may have to revisit the path field down the road but I think it's actually confusing things at the moment, because it doesn't do all that much really.

@SDBowen
Copy link
Contributor Author

SDBowen commented Dec 22, 2019

Got a bit busy before the holidays, sorry for disappearing on this.

I agree the path field is confusing things, and I think they way I originally implemented it can be cleaned up.

Do you think a new branch to add the readme field is the way to go? We can close this PR and perhaps I will revisit it once the readme field is added?

@kasbah
Copy link
Member

kasbah commented Dec 22, 2019 via email

@SDBowen SDBowen closed this Dec 26, 2019
@kasbah
Copy link
Member

kasbah commented Dec 28, 2019

Closed in favor of #220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to define readme path
2 participants