-
Notifications
You must be signed in to change notification settings - Fork 79
feat(build): include manual file in packages MONGOSH-1017 #1144
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
9e8b899
feat(manfile): setup npm script to fetch manual file
mabaasit 0887a63
feat(manfile): github action to commit manual file
mabaasit 3c6446b
chore(manfile): extract file name
mabaasit aa9fac4
feat(manfile): add manfile in tarball build
mabaasit ef3d97c
test(manfile): add fixtures and fix tests
mabaasit 4063759
feat(manfile): add manfile to every distribution
mabaasit 127a94b
test(manfile): fix tests
mabaasit 5d88895
chore(manfile): better var names
mabaasit 7b365a5
chore(manfile): clean up
mabaasit b51314c
feat(manfile): include manfile in all packages
mabaasit 52cacc7
test(manfile): add test conditions for rpm and deb
mabaasit 5443174
test(manfile): download manpage in packag step
mabaasit 5eafecf
chore(manfile): clean up download
mabaasit dfab808
fix(manfile): clean up build config
mabaasit f02e068
fix(manfile): extract manpage config
mabaasit 9ae2f9d
fix(manfile): correct filename in fixtures
mabaasit e0223fe
feat(manfile): optional manfile in build config
mabaasit 5e855ae
feat(manfile): correctly zip manfile and clean up config
mabaasit 5b05084
chore(manfile): remove man config
mabaasit 2871f30
chore(manfile): consistent naming
mabaasit e2d817b
chore(manfile): cr clean up, ensure file is zipped
mabaasit 38feb99
test(manfile): fix tests and test for manpage
mabaasit 5da2386
chore(manfile): cr clean up, gzip implementation
mabaasit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import nock from 'nock'; | ||
import { join } from 'path'; | ||
import { promises as fs } from 'fs'; | ||
import { downloadManpage } from './download-manpage'; | ||
|
||
describe('packaging download manpage', () => { | ||
it('downloads manpage', async() => { | ||
nock('http://example.com') | ||
.get('/') | ||
.replyWithFile( | ||
200, | ||
join(__dirname, '..', '..', 'test', 'fixtures', 'manpages.tar.gz') | ||
); | ||
|
||
const destination = join(__dirname, '..', '..', 'tmp', 'manpage'); | ||
const name = 'manpages.gz'; | ||
await downloadManpage('http://example.com', destination, name); | ||
await fs.access(join(destination, name)); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import fetch from 'node-fetch'; | ||
import tar from 'tar'; | ||
import { createReadStream, createWriteStream, promises as fs } from 'fs'; | ||
import { promisify } from 'util'; | ||
import { join } from 'path'; | ||
import { pipeline } from 'stream'; | ||
import { createGzip } from 'zlib'; | ||
|
||
export async function downloadManpage(url: string, destination: string, name: string) { | ||
await fs.mkdir(destination, { recursive: true }); | ||
const response = await fetch(url); | ||
await promisify(pipeline)( | ||
response.body, | ||
tar.x({ cwd: destination }) | ||
); | ||
await promisify(pipeline)( | ||
createReadStream(join(destination, 'mongosh.1')), | ||
createGzip(), | ||
createWriteStream(join(destination, name)) | ||
); | ||
console.info(`Saved manpage: ${join(destination, name)}`); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.