Skip to content

Commit

Permalink
refs #232: updated kip.kx.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kray-G committed May 14, 2021
1 parent 8045906 commit 3038540
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/exec/kip.kx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ class KinxPackageManagerConfig(configFile_, defFile_) {
zipfile = tmpdir / filename;
Directory.change(tmpdir) {
if (File.exists(filename)) {
Kip.progressln("The file(%s) is found." % filename);
Kip.progressln("The file(%{filename.bold().yellow()}) is found.");
Kip.progressln("The package of %s(%s) has been already downloaded." % name % version);
return;
}
Expand Down Expand Up @@ -375,6 +375,17 @@ class KinxPackageLibraryManager(repoMgr_) {
return true;
}

private isExecutable(file) {
if (File.isDirectory(file)) {
return false;
}
if (file.extension() == ".sh") {
return true;
}
var header = File.read(file, 4);
return header == <0x7f, 0x45, 0x4c, 0x46>;
}

public install(name, version) {
var verlist;
var packages = repoMgr_.getPackageInfo();
Expand Down Expand Up @@ -437,6 +448,12 @@ class KinxPackageLibraryManager(repoMgr_) {
candidates.push(f.filename());
}
};
Directory.recursiveWalk(packagedir / "bin") { &(f)
if (isExecutable(f)) {
File.chmod(f, 755);
Kip.progressln("Made the file of %{_1.filename().bold().yellow()} executable");
}
};
[ "kxrepl", "kxrepl.exe" ].each { &(exefile)
var src = $kinxpath / exefile;
var exe = exefile.extension() == ".exe";
Expand All @@ -448,7 +465,8 @@ class KinxPackageLibraryManager(repoMgr_) {
return;
}
File.copy(src.replace("\\", "/"), dst.replace("\\", "/"));
Kip.progressln("Generated a command of %s" % dst.filename());
File.chmod(dst, 755);
Kip.progressln("Generated a command of %{dst.filename().bold().yellow()}");
};
}
};
Expand Down

0 comments on commit 3038540

Please sign in to comment.