Skip to content

Commit

Permalink
Merge pull request #320 from Kray-G/develop
Browse files Browse the repository at this point in the history
#232: updated for PackageManager.
  • Loading branch information
Kray-G committed Aug 17, 2021
2 parents 826d9ea + 54535f5 commit bb517cc
Show file tree
Hide file tree
Showing 5 changed files with 186 additions and 151 deletions.
42 changes: 12 additions & 30 deletions docs/Kip.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ Remove the repository which you specified by `<url>`.
Note that you can remove also a default central repository.
If you removed it, you should add it again.

#### `kip repo list`
#### `kip repo list [detail]`

Show the list of central repositories.
Moreover, it shows also the list of packages registered to each repository.
Moreover, if you use a `detail` option, it shows also the list of packages registered to each repository.

### Package Control

Expand All @@ -103,48 +103,30 @@ If you want to uninstall all versions in the package, specify it as `all` instea

Install a development package which you are developing in progress.
You must move to the root of the package repository before running the `kip devinst`.
And this command will search a `build/build.kx` file at first.
Therefore, you must prepare `build/build.kx` file under the repository root in advance.
And this command will search a `package.json` file at first.
Therefore, you must prepare `package.json` file under the repository root in advance.

This command will install the package as a development package, which means the files are directly copied under the Kinx library path.
`build/build.kx` is the code to install the package like the following code for example.
This code is the stuff prepared in the `typesetting` package.
`package.json` file has just a package name.
The version will be automatically used as `99.99.99` for development.

```javascript
using pkg.Develop;

var pkgname = "typesetting";
var version = "0.0.2";

new PackageUpdater($$, pkgname, version).update { &(util)
Directory.change("src") {
Directory.walk(".") {
// _1 will be `bin`, `etc` and `lib`.
util.dircopy(_1, util.root / _1.filename());
};
};
util.dircopy("docs", util.root / "docs");
};
{
"name": "typesetting"
}
```

As you see, you can use `PackageUpdater` class and use `util.dircopy()` to install your developped components into the Kinx package directory.

By the way, the package directory will be marked as a development version.

#### `kip devuninst`

Uninstall a development package which version is specified by `build/build.kx`.
Uninstall a development package.

You must move to the root of the package repository before running the `kip devuninst` command as well as when it's `kip devinst`.
The command line will know the package name and the version which should be uninstalled automatically and try to uninstall it.

This command can not uninstall it when it is not a development version.
However, you can uninstall it if you use `kip uninstall <name> <version>` with the name and the version.
The command line will know the package name by the `package.json` file and will automatically uninstall it.

#### `kip list`

Show the list of installed packages with installed versions.
It shows also a development version and you can also see that it is a development version.
It shows also a development version and you can also see that a development version is installed as a `<development>`.

#### `kip update [<key>]`

Expand Down
53 changes: 27 additions & 26 deletions docs/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This section describe about the package by a user perspective and a developper p
#### How To Install/Uninstall Package

To install the package you want to use, do it with `kip install` command.
Here is the example of installing a `typesetting` package.
Here is the example of installing the `typesetting` package.

```
$ kip install typesetting
Expand All @@ -30,8 +30,8 @@ $ kip install typesetting
[2021/08/07 14:23:42] Generated a command of kxkitty.exe
```

To install the package you want to use, do it with `kip uninstall` command.
Here is the example of uninstall a `typesetting` package.
To uninstall the package, do it with `kip uninstall` command.
Here is the example of uninstall the `typesetting` package.

```
$ kip uninstall typesetting all
Expand Down Expand Up @@ -82,7 +82,7 @@ using @typesetting.Typesetting;
```

Note that the latest version will be usually used if not specified the version.
However, if you specify the version and the library code is including other library code by `using` directive without specifying the version, then the specified version will be used instead of the latest version.
However, if you specify the version and a loaded library is using a `using` directive without the version inside, the library loader will search it under the same version's library directory.

For example, when both the version 0.0.1 and 0.0.2 are installed, it will be as below.

Expand All @@ -105,47 +105,48 @@ using @typesetting.Logger; // => use Logger.kx of the version 0.0.1 which you sp
#### Install Your Package To Develop

You can use `kip devinst` command to instal your package as a development version.
For that, you must prepare the `build/build.kx` file to make the files locate to the correct location.
For that, you must prepare the `package.json` file to make the files locate to the correct location.

Here is the example which is used in the `typesetting` package.
The version will be fixed as `99.99.99` for the development, so the package will be installed to `$libpath/package/typesetting/99.99.99`.

```javascript
using pkg.Develop;

var pkgname = "typesetting";
var version = "0.0.2";

new PackageUpdater($$, pkgname, version).update { &(util)
Directory.change("src") {
Directory.walk(".") {
// _1 will be `bin`, `etc` and `lib`.
util.dircopy(_1, util.root / _1.filename());
};
};
util.dircopy("docs", util.root / "docs");
};
{
"name": "typesetting"
}
```

The callback function is receiving `util` object and you can use it.
`util.root` is the root location of packages, which is located to `$libpath/package/typesetting/0.0.2` in this case.
It means the root directory is automatically created by your package name and versions.
`kip devinst` will copy the directories under `src` directory to the same name under the package path.
Moreover, `docs` directory will be copied as is to the `docs` under the package path.

In the `typesetting` package, the directories of `bin`, `etc`, and `lib` under `src` directory will be copied to the same name under the path under `uril.root`.
Besides, `docs` directory will be copied as is to the `docs` under the path of `util.root`.
Here is the example of the location copied by the package installation.
It is the example of the case when the directories under `src` would be `bin`, `lib`, and `exc`.

You can install it correctly by running just `kip devinst` at the root of the package repository which has a `build` directory.
You can also uninstall it correctly by running just `kip devuninst` at the root of the package repository which has a `build` directory.
```
[SOURCE] [PACKAGE]
src/bin -----------> $libpath/package/typesetting/0.0.2/bin
/lib -----------> /lib
/etc -----------> /etc
docs -----------> /docs
```

You can install it correctly by running just `kip devinst` at the root of the package repository which has a `package.json` file.
You can also uninstall it correctly by running just `kip devuninst` at the root of the package repository which has a `package.json` file.

#### Special Directory

##### `bin`

If you locate the script file under the `bin` directory, the executable command will be automatically created to the same path as `kinx`.
For example, if you put the `something.kx` under the `bin`, `something.exe` will be automatically created.
In the `kip` world, this script file will be called a hook script.

Note that it will be `something` without `.exe` on Linux.
In this document, it is described as `something.exe` style because it is easy to understand.

Moreover, if the `kip` installer find an executable file under the `bin` directory, the `kip` will automatically change the attribute of the file to the `executable` when it's on Linux.
By the way, the `kip` will check if the file has the magic number of the ELF file format, or if the file extension is `.sh`.

##### `lib`

This `lib` directory is a search path of the package.
Expand Down
Loading

0 comments on commit bb517cc

Please sign in to comment.