zhongjin 6 years ago
parent 3d6226b615
commit 44c9e52026

@ -12,7 +12,7 @@ before_script:
- 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm@5; fi' - 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm@5; fi'
- npm -v - npm -v
- npm install winston@2.3.1 - npm install winston@2.3.1
- 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' - 'npm install https://git.spacen.net/yunkong2/yunkong2.js-controller/tarball/master --production'
env: env:
- CXX=g++-4.8 - CXX=g++-4.8
addons: addons:

@ -1,16 +1,16 @@
![Logo](admin/template.png) ![Logo](admin/template.png)
# ioBroker.template # yunkong2.template
================= =================
This adapter is a template for the creation of an ioBroker adapter. You do not need it at least that you plan developing your own adapter. 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.
It includes both code running within iobroker and as vis widget. If you only plan to create a vis widget then you should use the [iobroker.vis-template](https://github.com/ioBroker/ioBroker.vis-template) instead. 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.
## Steps ## Steps
1. download and unpack this packet from github ```https://github.com/ioBroker/ioBroker.template/archive/master.zip``` 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://github.com/ioBroker/ioBroker.template.git``` or clone git repository ```git clone --depth=1 https://git.spacen.net/yunkong2/yunkong2.template.git```
2. download required npm packets. Write in ioBroker.template directory: 2. download required npm packets. Write in yunkong2.template directory:
```npm install``` ```npm install```
@ -24,38 +24,38 @@ It includes both code running within iobroker and as vis widget. If you only pla
```npm install -g gulp-cli``` ```npm install -g gulp-cli```
4. rename directory from *ioBroker.template* (can be *ioBroker.template-master*) to *iobroker.mynewname* 4. rename directory from *yunkong2.template* (can be *yunkong2.template-master*) to *yunkong2.mynewname*
5. to use this template you should copy it into *.../iobroker/node_modules* directory and then create an instance for it with iobroker.admin 5. to use this template you should copy it into *.../yunkong2/node_modules* directory and then create an instance for it with yunkong2.admin
6. create your adapter: 6. create your adapter:
* you might want to start with main.js (code running within iobroker) and admin/index.html (the adapter settings page). * you might want to start with main.js (code running within yunkong2) and admin/index.html (the adapter settings page).
* [Adapter-Development-Documentation](https://github.com/ioBroker/ioBroker/wiki/Adapter-Development-Documentation), * [Adapter-Development-Documentation](https://git.spacen.net/yunkong2/yunkong2/wiki/Adapter-Development-Documentation),
* [Installation, setup and first steps with an ioBroker Development Environment](https://github.com/ioBroker/ioBroker/wiki/Installation,-setup-and-first-steps-with-an-ioBroker-Development-Environment) * [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)
* [Write and debug vis widgets](https://github.com/ioBroker/ioBroker/wiki/How-to-debug-vis-and-to-write-own-widget-set) * [Write and debug vis widgets](https://git.spacen.net/yunkong2/yunkong2/wiki/How-to-debug-vis-and-to-write-own-widget-set)
* files under the www folders are made available under http://<iobrokerIP>:8082/<adapter-name>/ * files under the www folders are made available under http://<yunkong2IP>:8082/<adapter-name>/
* for this to work the iobroker.vis adapter has to be installed * for this to work the yunkong2.vis adapter has to be installed
* delete this folder if you do not plan to export any files this way * delete this folder if you do not plan to export any files this way
* call ```iobroker upload <adapter-name>``` after you change files in the www folder to get the new files uploaded to vis * call ```yunkong2 upload <adapter-name>``` after you change files in the www folder to get the new files uploaded to vis
* the widget folder contains an example of a vis widget * 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* * you might want to start with *widget/<adapter-name>.html* and *widget/js/<adapter-name>.js*
* call ```iobroker visdebug <adapter-name>``` to enable debugging and upload widget to "vis". (This works only from V0.7.15 of js-controller) * call ```yunkong2 visdebug <adapter-name>``` to enable debugging and upload widget to "vis". (This works only from V0.7.15 of js-controller)
* 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* * 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*
* After admin/index.html is changed you must execute ```iobroker upload mynewname``` to see changes in admin console. The same is valid for any files in *admin* and *www* directory * 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
7. change version: edit package.json and then call ```grunt p``` in your adapter directory. 7. change version: edit package.json and then call ```grunt p``` in your adapter directory.
8. share it with the community 8. share it with the community
## Requirements ## Requirements
* your github repository must have name "ioBroker.<adaptername>". **B** is capital in "ioBroker", but in the package.json the *name* must be low case, because npm does not allow upper case letters. * 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.
* *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. * *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.
* Do not use in the title the words "ioBroker" or "Adapter". It is clear anyway, that it is adapter for ioBroker. * Do not use in the title the words "yunkong2" or "Adapter". It is clear anyway, that it is adapter for yunkong2.
## Changelog ## Changelog

@ -16,7 +16,7 @@ install:
- ps: npm --version - ps: npm --version
- npm install - npm install
- npm install winston@2.3.1 - npm install winston@2.3.1
- 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' - 'npm install https://git.spacen.net/yunkong2/yunkong2.js-controller/tarball/master --production'
test_script: test_script:
- echo %cd% - echo %cd%
- node --version - node --version

@ -413,7 +413,7 @@ gulp.task('rename', function () {
} }
var patterns = [ var patterns = [
{ {
match: /ioBroker template Adapter/g, match: /yunkong2 template Adapter/g,
replacement: newname replacement: newname
}, },
{ {

@ -42,14 +42,14 @@
"es": "Adaptador de plantilla basado en JavaScript / Node.js" "es": "Adaptador de plantilla basado en JavaScript / Node.js"
}, },
"desc": { "desc": {
"en": "ioBroker template", "en": "yunkong2 template",
"de": "ioBroker Template", "de": "yunkong2 Template",
"ru": "ioBroker Template как образец", "ru": "yunkong2 Template как образец",
"pt": "Modelo de adaptador para o ioBroker", "pt": "Modelo de adaptador para o yunkong2",
"fr": "ioBroker adaptateur modèle", "fr": "yunkong2 adaptateur modèle",
"nl": "ioBroker Template", "nl": "yunkong2 Template",
"it": "Adattatore modello ioBroker", "it": "Adattatore modello yunkong2",
"es": "Adaptador de plantilla ioBroker" "es": "Adaptador de plantilla yunkong2"
}, },
"authors": [ "authors": [
"@@Author@@ <@@email@@>" "@@Author@@ <@@email@@>"
@ -69,9 +69,9 @@
"icon": "template.png", "icon": "template.png",
"materialize": true, "materialize": true,
"enabled": true, "enabled": true,
"extIcon": "https://raw.githubusercontent.com/ioBroker/ioBroker.template/master/admin/template.png", "extIcon": "https://git.spacen.net/yunkong2/yunkong2.template/raw/master/admin/template.png",
"keywords": ["template", "vis", "GUI", "graphical", "scada"], "keywords": ["template", "vis", "GUI", "graphical", "scada"],
"readme": "https://github.com/ioBroker/ioBroker.template/blob/master/README.md", "readme": "https://git.spacen.net/yunkong2/yunkong2.template/blob/master/README.md",
"loglevel": "info", "loglevel": "info",
"type": "general", "type": "general",
"license": "MIT", "license": "MIT",

@ -27,8 +27,8 @@ let appName;
function getControllerDir(isInstall) { function getControllerDir(isInstall) {
// Find the js-controller location // Find the js-controller location
const possibilities = [ const possibilities = [
'iobroker.js-controller', 'yunkong2.js-controller',
'ioBroker.js-controller', 'yunkong2.js-controller',
]; ];
/** @type {string} */ /** @type {string} */
let controllerPath; let controllerPath;

@ -145,7 +145,7 @@ function main() {
// examples for the checkPassword/checkGroup functions // examples for the checkPassword/checkGroup functions
adapter.checkPassword('admin', 'iobroker', function (res) { adapter.checkPassword('admin', 'yunkong2', function (res) {
console.log('check user admin pw ioboker: ' + res); console.log('check user admin pw ioboker: ' + res);
}); });

@ -1,7 +1,7 @@
{ {
"name": "iobroker.template", "name": "yunkong2.template",
"version": "0.6.0", "version": "0.6.0",
"description": "ioBroker template Adapter", "description": "yunkong2 template Adapter",
"author": { "author": {
"name": "@@Author@@", "name": "@@Author@@",
"email": "@@email@@" "email": "@@email@@"
@ -12,17 +12,17 @@
"email": "@@email@@" "email": "@@email@@"
} }
], ],
"homepage": "https://github.com/ioBroker/ioBroker.template", "homepage": "https://git.spacen.net/yunkong2/yunkong2.template",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [
"ioBroker", "yunkong2",
"template", "template",
"Smart Home", "Smart Home",
"home automation" "home automation"
], ],
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/ioBroker/ioBroker.template" "url": "https://git.spacen.net/yunkong2/yunkong2.template"
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
@ -35,7 +35,7 @@
"test": "node node_modules/mocha/bin/mocha --exit" "test": "node node_modules/mocha/bin/mocha --exit"
}, },
"bugs": { "bugs": {
"url": "https://github.com/ioBroker/ioBroker.template/issues" "url": "https://git.spacen.net/yunkong2/yunkong2.template/issues"
}, },
"readmeFilename": "README.md" "readmeFilename": "README.md"
} }

@ -321,7 +321,7 @@ function installJsController(cb) {
if (!fs.existsSync(rootDir + 'tmp/node_modules/' + appName + '.js-controller')) { if (!fs.existsSync(rootDir + 'tmp/node_modules/' + appName + '.js-controller')) {
console.log('installJsController: no js-controller => install from git'); console.log('installJsController: no js-controller => install from git');
child_process.execSync('npm install https://github.com/' + appName + '/' + appName + '.js-controller/tarball/master --prefix ./ --production', { child_process.execSync('npm install https://git.spacen.net/' + appName + '/' + appName + '.js-controller/tarball/master --prefix ./ --production', {
cwd: rootDir + 'tmp/', cwd: rootDir + 'tmp/',
stdio: [0, 1, 2] stdio: [0, 1, 2]
}); });
@ -415,7 +415,7 @@ function clearControllerLog() {
} }
function clearDB() { function clearDB() {
var dirPath = rootDir + 'tmp/iobroker-data/sqlite'; var dirPath = rootDir + 'tmp/yunkong2-data/sqlite';
var files; var files;
try { try {
if (fs.existsSync(dirPath)) { if (fs.existsSync(dirPath)) {

@ -52,12 +52,12 @@ describe('Test package.json and io-package.json', function() {
console.log(); console.log();
} }
if ( if (
ioPackage.common.title.indexOf('iobroker') !== -1 || ioPackage.common.title.indexOf('yunkong2') !== -1 ||
ioPackage.common.title.indexOf('ioBroker') !== -1 || ioPackage.common.title.indexOf('yunkong2') !== -1 ||
ioPackage.common.title.indexOf('adapter') !== -1 || ioPackage.common.title.indexOf('adapter') !== -1 ||
ioPackage.common.title.indexOf('Adapter') !== -1 ioPackage.common.title.indexOf('Adapter') !== -1
) { ) {
console.log('WARNING: title contains Adapter or ioBroker. It is clear anyway, that it is adapter for ioBroker.'); console.log('WARNING: title contains Adapter or yunkong2. It is clear anyway, that it is adapter for yunkong2.');
console.log(); console.log();
} }

@ -1,5 +1,5 @@
<!-- <!--
ioBroker.template Widget-Set yunkong2.template Widget-Set
version: "0.5.0" version: "0.5.0"
@ -11,7 +11,7 @@
<script type="text/javascript" src="widgets/template/js/template.js"></script> <script type="text/javascript" src="widgets/template/js/template.js"></script>
<!-- the full description of format in data-vis-attrs can be found here: <!-- the full description of format in data-vis-attrs can be found here:
https://github.com/ioBroker/ioBroker.vis/blob/master/www/js/visEditInspect.js#L39 https://git.spacen.net/yunkong2/yunkong2.vis/blob/master/www/js/visEditInspect.js#L39
---------------------------------------------------------- ----------------------------------------------------------
Mandatory XML attributes: Mandatory XML attributes:

@ -1,5 +1,5 @@
/* /*
ioBroker.template Widget-Set yunkong2.template Widget-Set
version: "0.5.0" version: "0.5.0"

@ -1,2 +1,2 @@
if you put files in this directory they will be uploaded to DB on adapter install/upgrade. if you put files in this directory they will be uploaded to DB on adapter install/upgrade.
they can then be accessed via ioBroker WEB adapter http://&lt;iobrokerIP&gt;:8082/&lt;adapter-name&gt;/... they can then be accessed via yunkong2 WEB adapter http://&lt;yunkong2IP&gt;:8082/&lt;adapter-name&gt;/...
Loading…
Cancel
Save