-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from voruti/clean-project-structure
- Loading branch information
Showing
32 changed files
with
2,042 additions
and
1,197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This workflow will build a Java project with Gradle | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "tagged-release" | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*.*" | ||
|
||
jobs: | ||
on-main-branch-check: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
on_main: ${{ steps.contains_tag.outputs.retval }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: rickstaa/action-contains-tag@fix_action_retval | ||
id: contains_tag | ||
with: | ||
reference: "main" | ||
tag: "${{ github.ref }}" | ||
tagged-release: | ||
name: "Tagged Release" | ||
runs-on: "ubuntu-latest" | ||
needs: on-main-branch-check | ||
if: ${{ needs.on-main-branch-check.outputs.on_main == 'true' }} | ||
steps: | ||
|
||
# --- from gradle.yml --- | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'adopt' | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with Gradle | ||
run: ./gradlew build | ||
# --- from gradle.yml --- | ||
|
||
- uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
files: | | ||
build/libs/*all.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,53 @@ | ||
# JSON2Config | ||
|
||
A simple utility program which converts [openHAB Items](https://www.openhab.org/docs/configuration/items.html) from [JsonDB Storage](https://www.openhab.org/docs/administration/jsondb.html) files (e.g. org.eclipse.smarthome.core.items.Item.json, org.eclipse.smarthome.core.thing.link.ItemChannelLink.json) to textual configuration files (e.g. my.items). | ||
|
||
A simple utility program which converts [openHAB Items](https://www.openhab.org/docs/configuration/items.html) | ||
from [JsonDB Storage](https://www.openhab.org/docs/administration/jsondb.html) files (e.g. | ||
org.eclipse.smarthome.core.items.Item.json, org.eclipse.smarthome.core.thing.link.ItemChannelLink.json) to textual | ||
configuration files (e.g. my.items). | ||
|
||
Tested on openHAB 2.X versions. | ||
|
||
## Usage | ||
|
||
You can run the tool with Java: | ||
|
||
```bash | ||
java -jar json2config-XXX.jar [arguments] | ||
``` | ||
The program has two main features. By default only the first one will be executed. | ||
|
||
The program has two main features. By default, only the first one will be executed. | ||
|
||
### 1. Converting org.eclipse.smarthome.core.items.Item.json into a *.items file | ||
|
||
To convert the JSON file, you can simply put this tool into the [JSON DB storage location](https://www.openhab.org/docs/administration/jsondb.html#storage-location) and run it. This will create a `json.items` file with all the items from the `org.eclipse.smarthome.core.items.Item.json` file. | ||
To convert the JSON file, you can simply put this tool into | ||
the [JSON DB storage location](https://www.openhab.org/docs/administration/jsondb.html#storage-location) and run it. | ||
This will create a `json.items` file with all the items from the `org.eclipse.smarthome.core.items.Item.json` file. | ||
Alternatively you can adjust the program arguments to specify the file locations: | ||
|
||
- The `-i <path>`/`--in <path>`/`--json <path>` parameters allow you to specify the input .json file. | ||
- The `-o <path>`/`--out <path>` parameters allow you to specify the output file. | ||
- The `-n` parameter allows you to disable this (converting) feature completely; if you want to only append the channel links. | ||
- The `-n` parameter allows you to disable this (converting) feature completely; if you want to only append the channel | ||
links. | ||
|
||
### 2. Appending channel links from org.eclipse.smarthome.core.thing.link.ItemChannelLink.json to *.items files | ||
|
||
To append channel links to *already existing* .items files, you can use the second feature. If you already have some `*.items` files in your configuration, it's recommended to also including these files i.e. moving them into the same directory. By default (when the appending feature is enabled!!) the tool will use channel links from the `org.eclipse.smarthome.core.thing.link.ItemChannelLink.json` file and append them to all `*.items` files in the same directory. | ||
Alternatively you can adjust the program arguments to specify the file locations: | ||
- The `-c`/`--channel`/`--create-channel-links` parameters enable the appending feature. Without one of these, this feature won't run! | ||
- The `--channel-file <path>`/`--channel-link-file <path>` parameters allow you to specify the .json file location containing the channel links. | ||
- The `-d <path>`/`--dir <path>`/`--directory <path>` parameters allow you to specity the directory in which to search for *.items files. | ||
|
||
:exclamation:Channel Link **Profiles** currently will be lost in this process:exclamation: (They can - of course - manually be added afterwards) | ||
|
||
|
||
#### Other program parameters | ||
To append channel links to *already existing* .items files, you can use the second feature. If you already have | ||
some `*.items` files in your configuration, it's recommended to also including these files i.e. moving them into the | ||
same directory. By default, (when the appending feature is enabled!!) the tool will use channel links from | ||
the `org.eclipse.smarthome.core.thing.link.ItemChannelLink.json` file and append them to all `*.items` files in the same | ||
directory. Alternatively you can adjust the program arguments to specify the file locations: | ||
|
||
When enabling both features, the converting feature will run first, so the appending feature can then use the generated .items file to append the channel links. | ||
- The `-c`/`--channel`/`--create-channel-links` parameters enable the appending feature. Without one of these, this | ||
feature won't run! | ||
- The `--channel-file <path>`/`--channel-link-file <path>` parameters allow you to specify the .json file location | ||
containing the channel links. | ||
- The `-d <path>`/`--dir <path>`/`--directory <path>` parameters allow you to specify the directory in which to search | ||
for *.items files. | ||
|
||
With the `-l`/`--log`/`--enable-logging` parameters logging can be enabled. This creates a `latest.log` file in the same directory. | ||
:exclamation:Channel Link **Profiles** (value → configuration → properties → profile) currently will be lost in this | ||
process:exclamation: (They can - of course - manually be added afterwards) | ||
|
||
#### Other program features | ||
|
||
When enabling both features, the converting feature will run first, so the appending feature can then use the generated | ||
.items file to append the channel links. |
Oops, something went wrong.