2018-09-25 10:42:52 +08:00
![Logo ](admin/template.png )
2018-09-25 10:52:06 +08:00
# yunkong2.template
2018-09-25 10:42:52 +08:00
=================
2018-09-25 10:52:06 +08:00
This adapter is a template for the creation of an yunkong2 adapter. You do not need it at least that you plan developing your own adapter.
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
It includes both code running within yunkong2 and as vis widget. If you only plan to create a vis widget then you should use the [yunkong2.vis-template ](https://git.spacen.net/yunkong2/yunkong2.vis-template ) instead.
2018-09-25 10:42:52 +08:00
## Steps
2018-09-25 10:52:06 +08:00
1. download and unpack this packet from github ```https://git.spacen.net/yunkong2/yunkong2.template/archive/master.zip```
or clone git repository ```git clone --depth=1 https://git.spacen.net/yunkong2/yunkong2.template.git```
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
2. download required npm packets. Write in yunkong2.template directory:
2018-09-25 10:42:52 +08:00
```npm install```
3. set name of this template. Call
2018-09-25 10:58:44 +08:00
```gulp rename --name doorrest --email yunkong2@onenetcom.com --author "onc"```
2018-09-25 10:42:52 +08:00
*mynewname* must be **lower** case and with no spaces.
If gulp is not available, install gulp globally:
```npm install -g gulp-cli```
2018-09-25 10:52:06 +08:00
4. rename directory from *yunkong2.template* (can be *yunkong2.template-master* ) to *yunkong2.mynewname*
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
5. to use this template you should copy it into *.../yunkong2/node_modules* directory and then create an instance for it with yunkong2.admin
2018-09-25 10:42:52 +08:00
6. create your adapter:
2018-09-25 10:52:06 +08:00
* you might want to start with main.js (code running within yunkong2) and admin/index.html (the adapter settings page).
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
* [Adapter-Development-Documentation ](https://git.spacen.net/yunkong2/yunkong2/wiki/Adapter-Development-Documentation ),
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
* [Installation, setup and first steps with an yunkong2 Development Environment ](https://git.spacen.net/yunkong2/yunkong2/wiki/Installation,-setup-and-first-steps-with-an-yunkong2-Development-Environment )
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
* [Write and debug vis widgets ](https://git.spacen.net/yunkong2/yunkong2/wiki/How-to-debug-vis-and-to-write-own-widget-set )
2018-09-25 10:42:52 +08:00
2018-09-25 10:52:06 +08:00
* files under the www folders are made available under http://< yunkong2IP> :8082/< adapter-name> /
* for this to work the yunkong2.vis adapter has to be installed
2018-09-25 10:42:52 +08:00
* delete this folder if you do not plan to export any files this way
2018-09-25 10:52:06 +08:00
* call ```yunkong2 upload < adapter-name > ``` after you change files in the www folder to get the new files uploaded to vis
2018-09-25 10:42:52 +08:00
* the widget folder contains an example of a vis widget
* you might want to start with *widget/<adapter-name>.html* and *widget/js/<adapter-name>.js*
2018-09-25 10:52:06 +08:00
* call ```yunkong2 visdebug < adapter-name > ``` to enable debugging and upload widget to "vis". (This works only from V0.7.15 of js-controller)
2018-09-25 10:42:52 +08:00
* If you do not plan to export any widget then delete the whole widget folder and remove the ```"restartAdapters": ["vis"]``` statement from *io-package.json*
2018-09-25 10:52:06 +08:00
* After admin/index.html is changed you must execute ```yunkong2 upload mynewname``` to see changes in admin console. The same is valid for any files in *admin* and *www* directory
2018-09-25 10:42:52 +08:00
7. change version: edit package.json and then call ```grunt p``` in your adapter directory.
8. share it with the community
## Requirements
2018-09-25 10:52:06 +08:00
* your github repository must have name "yunkong2.< adaptername > ". **B** is capital in "yunkong2", but in the package.json the *name* must be low case, because npm does not allow upper case letters.
2018-09-25 10:42:52 +08:00
* *title* in io-package.json (common) is simple short name of adapter in english. *titleLang* is object that consist short names in many languages. *Lang* ist not german Länge, but english LANGuages.
2018-09-25 10:52:06 +08:00
* Do not use in the title the words "yunkong2" or "Adapter". It is clear anyway, that it is adapter for yunkong2.
2018-09-25 10:42:52 +08:00
## Changelog
### 0.6.0 (2017.01.02)
* (bluefox) Support of admin3
### 0.5.0
* (vegetto) include vis widget
### 0.4.0
* (bluefox) fix errors with grunt
### 0.2.0
* (bluefox) initial release
## License
The MIT License (MIT)
Copyright (c) 2018 @@Author@@ < @@email@@>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.