Skip to content

Commit

Permalink
added files of a package manager. (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kray-G committed Feb 16, 2021
1 parent 207c209 commit 0c43289
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kinx
timex
myacc
/.vscode
/kinxpkg
/benchmark
/bench
timeit.dat
Expand Down
5 changes: 5 additions & 0 deletions lib/exec/kxpkg.kx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using pkg;
/*
Currently under development.
Do not use this.
*/
84 changes: 84 additions & 0 deletions lib/exec/pkg.kx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
Currently under development.
Do not use this.
*/

/*
Package Manager for Kinx

$ kxpkg add <repo>
$ kxpkg remove <repo>
$ kxpkg install <name>
$ kxpkg uninstall <name>
$ kxpkg update [<name>]
$ kxpkg list
$ kxpkg depends
*/

class KinxPackageManagerConfig(config_) {
}

class KinxPackageRepositoryManager(cfgMger_) {

public add(repo) {
;
}
public remove(repo) {
;
}

}

class KinxPackageLibraryManager(repoMgr_) {

public list() {
;
}
public install(name) {
;
}
public uninstall(name) {
;
}
public update(name) {
;
}

}

class KinxPackageManager {

const CONFIG_FILE_NAME = "config.json";
var pkgpath_ = {
path: $pkgpath,
log: $pkgpath / "log",
config: $pkgpath / "config",
};
var config_, repo_;

private initialize() {
if (!File.exists(pkgpath_.path)) {
File.mkdir(pkgpath_.path);
}
pkgpath_.keySet().filter({ => _1 != "path" }).each { &(key)
if (!File.exists(pkgpath_[key])) {
File.mkdir(pkgpath_[key]);
}
};
var configFile = pkgpath_.config / CONFIG_FILE_NAME;
if (!File.exists(configFile)) {
File.open(configFile, File.WRITE) { &(f: File)
var data = {
repo: {},
};
f.println(data.toJsonString(true));
};
}
config_ = new KinxPackageManagerConfig(File.load(configFile));
repo_ = new KinxPackageRepositoryManager(config_);
}

}

var mgr = new KinxPackageManager();

0 comments on commit 0c43289

Please sign in to comment.