Skip to content

Commit

Permalink
asdf
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed May 28, 2024
1 parent 00c9fa1 commit 5ee9c30
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"main": "src/index",
"type": "module",
"dependencies": {
"@octokit/rest": "^20.1.1",
"@types/node": "^20.12.12",
"axios": "^1.7.2",
"chalk": "5.3.0",
"commander": "^12.0.0",
"js-yaml": "^4.1.0",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"vitest": "^1.6.0"
},
"devDependencies": {},
"scripts": {
"test": "bun test"
}
Expand Down
2 changes: 1 addition & 1 deletion services/rails_app/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"image": "ubuntu:latest",
"image": "ubuntu:24.04",
"features": {
"ghcr.io/devcontainers/features/git": {},
"ghcr.io/devcontainers/features/ruby": { "version": "3.3.0-preview3" }
Expand Down
6 changes: 6 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ program.command('inspect')
.description('Inspect an application')
.action(app_name => console.log(stax.find(app_name).containers))

import Feature from '~/dev_container/feature'
program.command('features')
.action(async () => {
await new Feature('ghcr.io/devcontainers/features/git:latest').install()
})

let args = process.argv

if (args[2] == 'exec' && process.argv.length > 5) {
Expand Down
31 changes: 29 additions & 2 deletions src/dev_container/feature.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,40 @@
// import { mkdirSync } from 'fs'
import { run } from '~/shell'

export default class Feature {
public name: string
public location: string
public options: Record<string, any>

constructor(name: string, options: Record<string, any>) {
this.name = name
this.options = options
}

install() {
get version() {
return this.name.split(':').pop()
}

get name() {

}

get tarball() {
return './tmp/' + this.name.split('/')
.slice(1, 9999)
.join('/')
.replace(`:${this.version}`, '')
.replace(/[/]/g, '-')
.replace('-features', '-feature')
+ '.tgz'
}

async download() {
await run(`oras pull ${this.name} -o ./tmp`)
await run(`tar zxvf ${this.tarball}`)
}

async install() {
this.download()
console.log(`🚀 Installing ${this.name} feature...`)
}
}

0 comments on commit 5ee9c30

Please sign in to comment.