Skip to content

Commit

Permalink
Merge pull request #1579 from GMOD/create_nightly
Browse files Browse the repository at this point in the history
Create --branch and --nightly flags for `jbrowse create` and `jbrowse upgrade` commands
  • Loading branch information
rbuels authored Dec 22, 2020
2 parents 25d67d7 + 4398493 commit 3c92388
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ jobs:
- name: Copy branch build to S3
run: |
cp products/jbrowse-web/build/test_data/config.json products/jbrowse-web/build/config.json
cd products/jbrowse-web/build && zip -r "jbrowse-web-$(echo ${{github.ref}} | cut -d '/' -f3-).zip" . && cd -
aws s3 sync --delete products/jbrowse-web/build s3://jbrowse.org/code/jb2/$(echo ${{github.ref}} | cut -d "/" -f3-)
8 changes: 8 additions & 0 deletions products/jbrowse-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,10 @@ OPTIONS
-u, --url=url A direct URL to a JBrowse 2 release
--branch=branch Download a development build from a named git branch
--nightly Download the latest development build from the master branch
EXAMPLES
$ jbrowse create /path/to/new/installation
$ jbrowse create /path/to/new/installation --force
Expand Down Expand Up @@ -409,6 +413,10 @@ OPTIONS
-u, --url=url A direct URL to a JBrowse 2 release
--branch=branch Download a development build from a named git branch
--nightly Download the latest development build from the master branch
EXAMPLES
$ jbrowse upgrade # Upgrades current directory to latest jbrowse release
$ jbrowse upgrade /path/to/jbrowse2/installation
Expand Down
4 changes: 4 additions & 0 deletions products/jbrowse-cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,8 @@ export default abstract class JBrowseCommand extends Command {
exit: 90,
})
}

async getBranch(branch: string) {
return `https://s3.amazonaws.com/jbrowse.org/code/jb2/${branch}/jbrowse-web-${branch}.zip`
}
}
14 changes: 12 additions & 2 deletions products/jbrowse-cli/src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ export default class Create extends JBrowseCommand {
char: 'l',
description: 'Lists out all versions of JBrowse 2',
}),
branch: flags.string({
description: 'Download a development build from a named git branch',
}),
nightly: flags.boolean({
description:
'Download the latest development build from the master branch',
}),
url: flags.string({
char: 'u',
description: 'A direct URL to a JBrowse 2 release',
Expand All @@ -54,7 +61,7 @@ export default class Create extends JBrowseCommand {
const { localPath: argsPath } = runArgs as { localPath: string }
this.debug(`Want to install path at: ${argsPath}`)

const { force, url, listVersions, tag } = runFlags
const { force, url, listVersions, tag, branch, nightly } = runFlags

if (listVersions) {
const versions = (await this.fetchGithubVersions()).map(
Expand All @@ -72,7 +79,10 @@ export default class Create extends JBrowseCommand {
}

const locationUrl =
url || (tag ? await this.getTag(tag) : await this.getLatest())
url ||
(nightly ? await this.getBranch('master') : '') ||
(branch ? await this.getBranch(branch) : '') ||
(tag ? await this.getTag(tag) : await this.getLatest())

this.log(`Fetching ${locationUrl}...`)
const response = await fetch(locationUrl)
Expand Down
14 changes: 12 additions & 2 deletions products/jbrowse-cli/src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ export default class Upgrade extends JBrowseCommand {
description:
'Version of JBrowse 2 to install. Format is v1.0.0.\nDefaults to latest',
}),
branch: flags.string({
description: 'Download a development build from a named git branch',
}),
nightly: flags.boolean({
description:
'Download the latest development build from the master branch',
}),
url: flags.string({
char: 'u',
description: 'A direct URL to a JBrowse 2 release',
Expand All @@ -53,7 +60,7 @@ export default class Upgrade extends JBrowseCommand {
const { args: runArgs, flags: runFlags } = this.parse(Upgrade)
const { localPath: argsPath } = runArgs as { localPath: string }

const { listVersions, tag, url } = runFlags
const { listVersions, tag, url, branch, nightly } = runFlags

if (listVersions) {
const versions = (await this.fetchGithubVersions()).map(
Expand All @@ -77,7 +84,10 @@ export default class Upgrade extends JBrowseCommand {
}

const locationUrl =
url || (tag ? await this.getTag(tag) : await this.getLatest())
url ||
(nightly ? await this.getBranch('master') : '') ||
(branch ? await this.getBranch(branch) : '') ||
(tag ? await this.getTag(tag) : await this.getLatest())

this.log(`Fetching ${locationUrl}...`)
const response = await fetch(locationUrl)
Expand Down

0 comments on commit 3c92388

Please sign in to comment.