신경 plugin
A library that provides the plugin API for 신경. This library is not useful on its own, and must be used alongside a 신경 instance.
An example plugin can be found here: https://github.com/queer/singyeong-test-plugin
Installation
def deps do
[
{:singyeong_plugin, "~> 0.1.0"}
]
endCreating a plugin
Simply implement the Singyeong.Plugin behaviour in your plugin module. An
example of how to do this can be found here:
https://github.com/queer/singyeong-test-plugin/blob/master/lib/singyeong_plugin_test.ex
Once your plugin is ready, run the following commands:
$ mix compile
$ mix singyeong.package
and a zip file containing your plugin will be created. To use the plugin you
created, simply create a plugins/ directory at your 신경 instance's root
directory, and copy the plugin zip into that directory.
Native code
신경 plugins officially support NIFs implemented with Rustler. Other NIF libraries are unsupported and may break at any time, or simply never work.
Note that Rustler-based NIFs require some extra steps to be properly 신경-compatible:
-
Your NIF module should have
use Singyeong.Plugin.Rustler, crate: "crate_name"instead ofuse Rustler, otp_app: :my_app, crate: "crate_name". - That's it! (Note: this may change in the future)
.gitignore
The following files should be added to your .gitignore:
- /work
- /*.zip
If using (Rustler) natives:
- /priv/native
- /native/*/target
- /native/*/.cargo