openhab-scripting 2.9.1 → 2.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openhab/core/dsl/gems.rb +1 -26
- data/lib/openhab/core/dsl/rule/item.rb +1 -0
- data/lib/openhab/core/dsl/rule/rule.rb +18 -1
- data/lib/openhab/core/duration.rb +9 -0
- data/lib/openhab/version.rb +1 -1
- metadata +21 -67
- data/.github/workflows/workflow.yml +0 -327
- data/.gitignore +0 -17
- data/.java-version +0 -1
- data/.rspec +0 -1
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -113
- data/Gemfile +0 -28
- data/Gemfile.lock +0 -245
- data/Guardfile +0 -35
- data/LICENSE +0 -277
- data/README.md +0 -23
- data/Rakefile +0 -406
- data/bin/console +0 -15
- data/bin/setup +0 -8
- data/config/userdata/config/org/openhab/restauth.config +0 -3
- data/cucumber.yml +0 -1
- data/docs/_config.yml +0 -135
- data/docs/contributing/index.md +0 -47
- data/docs/examples/conversions.md +0 -123
- data/docs/examples/index.md +0 -61
- data/docs/index.md +0 -19
- data/docs/installation/index.md +0 -26
- data/docs/motivation/index.md +0 -27
- data/docs/usage/execution.md +0 -9
- data/docs/usage/execution/delay.md +0 -48
- data/docs/usage/execution/otherwise.md +0 -30
- data/docs/usage/execution/run.md +0 -70
- data/docs/usage/execution/triggered.md +0 -48
- data/docs/usage/guards.md +0 -51
- data/docs/usage/guards/between.md +0 -30
- data/docs/usage/guards/not_if.md +0 -41
- data/docs/usage/guards/only_if.md +0 -40
- data/docs/usage/index.md +0 -11
- data/docs/usage/items.md +0 -66
- data/docs/usage/items/contact.md +0 -84
- data/docs/usage/items/dimmer.md +0 -147
- data/docs/usage/items/groups.md +0 -76
- data/docs/usage/items/number.md +0 -225
- data/docs/usage/items/string.md +0 -49
- data/docs/usage/items/switch.md +0 -85
- data/docs/usage/misc.md +0 -7
- data/docs/usage/misc/actions.md +0 -108
- data/docs/usage/misc/duration.md +0 -21
- data/docs/usage/misc/gems.md +0 -25
- data/docs/usage/misc/logging.md +0 -21
- data/docs/usage/misc/metadata.md +0 -128
- data/docs/usage/misc/store_states.md +0 -42
- data/docs/usage/misc/time_of_day.md +0 -69
- data/docs/usage/misc/timers.md +0 -67
- data/docs/usage/rule.md +0 -43
- data/docs/usage/things.md +0 -29
- data/docs/usage/triggers.md +0 -8
- data/docs/usage/triggers/changed.md +0 -57
- data/docs/usage/triggers/channel.md +0 -54
- data/docs/usage/triggers/command.md +0 -69
- data/docs/usage/triggers/cron.md +0 -19
- data/docs/usage/triggers/every.md +0 -76
- data/docs/usage/triggers/updated.md +0 -78
- data/openhab-scripting.gemspec +0 -30
- data/openhab_rules/warmup.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daa36a09bcefbd672716ede992f1525cf81edbf3db5bef1b40e46f7ab0a46837
|
4
|
+
data.tar.gz: 871e30faf15a2bd26010c5d118c26cbc569182bf7b849217b5b751148ec95fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9756bf909c3061d9824cf4a072ddd1e4c83ebdcec5710ebb166db4a9b302d06942bc3a10ab00a89acc28ab6db2c716a1adfd5cf39beee2462fbf253525bb84
|
7
|
+
data.tar.gz: '039eec961406e82062744e131aeb8da4db95dc613c9da0c017f0be70d77edae181f40bdbb49693b8b5244dbcabc9289470fb77eca2033f596285fcc5c0dc1a72'
|
@@ -1,29 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'core/log'
|
4
|
-
|
5
|
-
begin
|
6
|
-
require 'bundler/inline'
|
7
|
-
|
8
|
-
include Logging
|
9
|
-
logger.debug('Bundler required')
|
10
|
-
rescue LoadError
|
11
|
-
include Logging
|
12
|
-
logger.debug('Bundler not found installing')
|
13
|
-
|
14
|
-
begin
|
15
|
-
require 'rubygems/commands/install_command'
|
16
|
-
cmd = Gem::Commands::InstallCommand.new
|
17
|
-
cmd.handle_options ['--no-document', 'bundler', '-v', '2.1.4']
|
18
|
-
cmd.execute
|
19
|
-
logger.debug('Bundler is installed')
|
20
|
-
require 'bundler/inline'
|
21
|
-
rescue Gem::SystemExitException => e
|
22
|
-
if e.exit_code.zero?
|
23
|
-
logger.debug('Bundler is installed')
|
24
|
-
require 'bundler/inline'
|
25
|
-
else
|
26
|
-
logger.error("Error installing bundler, exit code: #{e}")
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
4
|
+
require 'bundler/inline'
|
@@ -303,6 +303,23 @@ module OpenHAB
|
|
303
303
|
false
|
304
304
|
end
|
305
305
|
|
306
|
+
#
|
307
|
+
# Patch event to include event.item when it doesn't exist
|
308
|
+
# This is to patch a bug see https://github.com/boc-tothefuture/openhab-jruby/issues/75
|
309
|
+
# It may be fixed in the openhab core in the future, in which case, this patch will no longer be necessary
|
310
|
+
#
|
311
|
+
# @param [OpenHAB Event] event to check for item accessor
|
312
|
+
# @param [OpenHAB Event Inputs] inputs inputs to running rule
|
313
|
+
#
|
314
|
+
def add_event_item(event, inputs)
|
315
|
+
return if event.nil? || defined?(event.item)
|
316
|
+
|
317
|
+
class << event
|
318
|
+
attr_accessor :item
|
319
|
+
end
|
320
|
+
event.item = inputs&.dig('triggeringItem')
|
321
|
+
end
|
322
|
+
|
306
323
|
#
|
307
324
|
# Process the run queue
|
308
325
|
#
|
@@ -317,7 +334,7 @@ module OpenHAB
|
|
317
334
|
when RuleConfig::Run
|
318
335
|
|
319
336
|
event = inputs&.dig('event')
|
320
|
-
|
337
|
+
add_event_item(event, inputs)
|
321
338
|
logger.trace { "Executing rule '#{name}' run block with event(#{event})" }
|
322
339
|
task.block.call(event)
|
323
340
|
when RuleConfig::Trigger
|
@@ -64,6 +64,15 @@ module OpenHAB
|
|
64
64
|
@amount * 1000 * 60 * 60
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# Return a string representation of the duration
|
70
|
+
#
|
71
|
+
# @return [String] Duration in string
|
72
|
+
#
|
73
|
+
def to_s
|
74
|
+
"#{@amount} #{(@amount == 1) ? @temporal_unit.to_s.downcase.delete_suffix('s') : @temporal_unit.to_s.downcase}"
|
75
|
+
end
|
67
76
|
end
|
68
77
|
end
|
69
78
|
end
|
data/lib/openhab/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openhab-scripting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian O'Connell
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-01
|
12
|
-
dependencies:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.2'
|
13
27
|
description: JRuby Helper Libraries for OpenHAB Scripting
|
14
28
|
email:
|
15
29
|
- broconne@gmail.com
|
@@ -17,64 +31,6 @@ executables: []
|
|
17
31
|
extensions: []
|
18
32
|
extra_rdoc_files: []
|
19
33
|
files:
|
20
|
-
- ".github/workflows/workflow.yml"
|
21
|
-
- ".gitignore"
|
22
|
-
- ".java-version"
|
23
|
-
- ".rspec"
|
24
|
-
- ".yardopts"
|
25
|
-
- CHANGELOG.md
|
26
|
-
- Gemfile
|
27
|
-
- Gemfile.lock
|
28
|
-
- Guardfile
|
29
|
-
- LICENSE
|
30
|
-
- README.md
|
31
|
-
- Rakefile
|
32
|
-
- bin/console
|
33
|
-
- bin/setup
|
34
|
-
- config/userdata/config/org/openhab/restauth.config
|
35
|
-
- cucumber.yml
|
36
|
-
- docs/_config.yml
|
37
|
-
- docs/contributing/index.md
|
38
|
-
- docs/examples/conversions.md
|
39
|
-
- docs/examples/index.md
|
40
|
-
- docs/index.md
|
41
|
-
- docs/installation/index.md
|
42
|
-
- docs/motivation/index.md
|
43
|
-
- docs/usage/execution.md
|
44
|
-
- docs/usage/execution/delay.md
|
45
|
-
- docs/usage/execution/otherwise.md
|
46
|
-
- docs/usage/execution/run.md
|
47
|
-
- docs/usage/execution/triggered.md
|
48
|
-
- docs/usage/guards.md
|
49
|
-
- docs/usage/guards/between.md
|
50
|
-
- docs/usage/guards/not_if.md
|
51
|
-
- docs/usage/guards/only_if.md
|
52
|
-
- docs/usage/index.md
|
53
|
-
- docs/usage/items.md
|
54
|
-
- docs/usage/items/contact.md
|
55
|
-
- docs/usage/items/dimmer.md
|
56
|
-
- docs/usage/items/groups.md
|
57
|
-
- docs/usage/items/number.md
|
58
|
-
- docs/usage/items/string.md
|
59
|
-
- docs/usage/items/switch.md
|
60
|
-
- docs/usage/misc.md
|
61
|
-
- docs/usage/misc/actions.md
|
62
|
-
- docs/usage/misc/duration.md
|
63
|
-
- docs/usage/misc/gems.md
|
64
|
-
- docs/usage/misc/logging.md
|
65
|
-
- docs/usage/misc/metadata.md
|
66
|
-
- docs/usage/misc/store_states.md
|
67
|
-
- docs/usage/misc/time_of_day.md
|
68
|
-
- docs/usage/misc/timers.md
|
69
|
-
- docs/usage/rule.md
|
70
|
-
- docs/usage/things.md
|
71
|
-
- docs/usage/triggers.md
|
72
|
-
- docs/usage/triggers/changed.md
|
73
|
-
- docs/usage/triggers/channel.md
|
74
|
-
- docs/usage/triggers/command.md
|
75
|
-
- docs/usage/triggers/cron.md
|
76
|
-
- docs/usage/triggers/every.md
|
77
|
-
- docs/usage/triggers/updated.md
|
78
34
|
- lib/openhab.rb
|
79
35
|
- lib/openhab/configuration.rb
|
80
36
|
- lib/openhab/core/cron.rb
|
@@ -126,15 +82,13 @@ files:
|
|
126
82
|
- lib/openhab/core/startup_delay.rb
|
127
83
|
- lib/openhab/osgi.rb
|
128
84
|
- lib/openhab/version.rb
|
129
|
-
- openhab-scripting.gemspec
|
130
|
-
- openhab_rules/warmup.rb
|
131
85
|
homepage: https://boc-tothefuture.github.io/openhab-jruby/
|
132
86
|
licenses: []
|
133
87
|
metadata:
|
134
88
|
homepage_uri: https://boc-tothefuture.github.io/openhab-jruby/
|
135
89
|
source_code_uri: https://github.com/boc-tothefuture/openhab-jruby
|
136
90
|
changelog_uri: https://github.com/boc-tothefuture/openhab-jruby/blob/main/CHANGELOG.md
|
137
|
-
post_install_message:
|
91
|
+
post_install_message:
|
138
92
|
rdoc_options: []
|
139
93
|
require_paths:
|
140
94
|
- lib
|
@@ -149,9 +103,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
103
|
- !ruby/object:Gem::Version
|
150
104
|
version: '0'
|
151
105
|
requirements: []
|
152
|
-
rubyforge_project:
|
106
|
+
rubyforge_project:
|
153
107
|
rubygems_version: 2.7.6.2
|
154
|
-
signing_key:
|
108
|
+
signing_key:
|
155
109
|
specification_version: 4
|
156
110
|
summary: JRuby Helper Libraries for OpenHAB Scripting
|
157
111
|
test_files: []
|
@@ -1,327 +0,0 @@
|
|
1
|
-
name: Openhab-JRuby-Scripting
|
2
|
-
|
3
|
-
on:
|
4
|
-
pull_request:
|
5
|
-
push:
|
6
|
-
branches:
|
7
|
-
- main
|
8
|
-
|
9
|
-
env:
|
10
|
-
RUBY_VERSION: 2.5
|
11
|
-
GITHUB_TOKEN: ${{ github.token }}
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
|
15
|
-
rubocop:
|
16
|
-
runs-on: ubuntu-18.04
|
17
|
-
continue-on-error: true
|
18
|
-
steps:
|
19
|
-
- uses: actions/checkout@v2
|
20
|
-
- uses: actions/setup-ruby@v1
|
21
|
-
with:
|
22
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
23
|
-
- name: Install bundler
|
24
|
-
run: gem install bundler -N
|
25
|
-
- name: Gem Cache
|
26
|
-
uses: actions/cache@v2
|
27
|
-
with:
|
28
|
-
path: vendor/bundle
|
29
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
30
|
-
- name: Install gems
|
31
|
-
run: |
|
32
|
-
bundle config path vendor/bundle
|
33
|
-
bundle install --jobs 4 --retry 3
|
34
|
-
- name: Rubocop
|
35
|
-
run: bundle exec rubocop
|
36
|
-
|
37
|
-
commit-lint:
|
38
|
-
runs-on: ubuntu-latest
|
39
|
-
steps:
|
40
|
-
- uses: actions/checkout@v2
|
41
|
-
with:
|
42
|
-
fetch-depth: 0
|
43
|
-
- uses: wagoid/commitlint-github-action@v2
|
44
|
-
|
45
|
-
cucumber-lint:
|
46
|
-
runs-on: ubuntu-18.04
|
47
|
-
continue-on-error: true
|
48
|
-
steps:
|
49
|
-
- uses: actions/checkout@v2
|
50
|
-
- uses: actions/setup-ruby@v1
|
51
|
-
with:
|
52
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
53
|
-
- name: Install bundler
|
54
|
-
run: gem install bundler -N
|
55
|
-
- name: Gem Cache
|
56
|
-
uses: actions/cache@v2
|
57
|
-
with:
|
58
|
-
path: vendor/bundle
|
59
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
60
|
-
- name: Install gems
|
61
|
-
run: |
|
62
|
-
bundle config path vendor/bundle
|
63
|
-
bundle install --jobs 4 --retry 3
|
64
|
-
- name: Cucumber Lint
|
65
|
-
run: bundle exec cuke_linter
|
66
|
-
|
67
|
-
yard-coverage:
|
68
|
-
runs-on: ubuntu-18.04
|
69
|
-
steps:
|
70
|
-
- uses: actions/checkout@v2
|
71
|
-
- uses: actions/setup-ruby@v1
|
72
|
-
with:
|
73
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
74
|
-
- name: Install bundler
|
75
|
-
run: gem install bundler -N
|
76
|
-
- name: Gem Cache
|
77
|
-
uses: actions/cache@v2
|
78
|
-
with:
|
79
|
-
path: vendor/bundle
|
80
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
81
|
-
- name: Install gems
|
82
|
-
run: |
|
83
|
-
bundle config path vendor/bundle
|
84
|
-
bundle install --jobs 4 --retry 3
|
85
|
-
- name: Yard Coverage
|
86
|
-
run: |
|
87
|
-
bundle exec yard stats --list-undoc
|
88
|
-
bundle exec yard stats | grep "100.00% documented"
|
89
|
-
|
90
|
-
|
91
|
-
openhab-setup:
|
92
|
-
runs-on: ubuntu-18.04
|
93
|
-
steps:
|
94
|
-
- uses: actions/checkout@v2
|
95
|
-
- uses: actions/setup-ruby@v1
|
96
|
-
with:
|
97
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
98
|
-
- uses: actions/setup-java@v1
|
99
|
-
with:
|
100
|
-
java-version: '11.0.8'
|
101
|
-
java-package: jre
|
102
|
-
- name: Install bundler
|
103
|
-
run: gem install bundler -N
|
104
|
-
- name: Cache Gems
|
105
|
-
uses: actions/cache@v2
|
106
|
-
with:
|
107
|
-
path: vendor/bundle
|
108
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
109
|
-
- name: Install gems
|
110
|
-
run: |
|
111
|
-
bundle config path vendor/bundle
|
112
|
-
bundle install --jobs 4 --retry 3
|
113
|
-
- name: Cache OpenHAB setup
|
114
|
-
id: cache
|
115
|
-
uses: actions/cache@v2
|
116
|
-
with:
|
117
|
-
path: tmp/
|
118
|
-
key: OpenHAB-setup-${{ hashFiles('bundle/*jrubyscripting*.jar') }}
|
119
|
-
- name: Setup OpenHAB
|
120
|
-
if: steps.cache.outputs.cache-hit != 'true'
|
121
|
-
run: bundle exec rake openhab:setup
|
122
|
-
|
123
|
-
cucumber-matrix:
|
124
|
-
runs-on: ubuntu-18.04
|
125
|
-
outputs:
|
126
|
-
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
127
|
-
steps:
|
128
|
-
- uses: actions/checkout@v2
|
129
|
-
- uses: actions/setup-ruby@v1
|
130
|
-
with:
|
131
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
132
|
-
- id: set-matrix
|
133
|
-
run: |
|
134
|
-
JSON=$(ruby -e '
|
135
|
-
require "json"
|
136
|
-
feature_maps = Dir["features/**/*.feature"].map { |feature| { feature: File.basename(feature,".feature"), file: feature } }
|
137
|
-
include_map = {}
|
138
|
-
include_map["include"]= feature_maps
|
139
|
-
puts include_map.to_json
|
140
|
-
')
|
141
|
-
echo $JSON
|
142
|
-
echo "::set-output name=matrix::$( echo "$JSON" )"
|
143
|
-
|
144
|
-
cucumber:
|
145
|
-
needs: [cucumber-matrix, openhab-setup]
|
146
|
-
runs-on: ubuntu-18.04
|
147
|
-
strategy:
|
148
|
-
matrix: ${{fromJson(needs.cucumber-matrix.outputs.matrix)}}
|
149
|
-
steps:
|
150
|
-
- uses: actions/checkout@v1
|
151
|
-
- uses: actions/setup-ruby@v1
|
152
|
-
with:
|
153
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
154
|
-
- uses: actions/setup-java@v1
|
155
|
-
with:
|
156
|
-
java-version: '11.0.8'
|
157
|
-
java-package: jre
|
158
|
-
- name: Install bundler
|
159
|
-
run: gem install bundler -N
|
160
|
-
- name: Restore Gems
|
161
|
-
uses: actions/cache@v2
|
162
|
-
with:
|
163
|
-
path: vendor/bundle
|
164
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
165
|
-
- name: Install gems
|
166
|
-
run: |
|
167
|
-
bundle config path vendor/bundle
|
168
|
-
bundle install --jobs 4 --retry 3
|
169
|
-
- name: Restore OpenHAB setup
|
170
|
-
uses: actions/cache@v2
|
171
|
-
with:
|
172
|
-
path: tmp/
|
173
|
-
key: OpenHAB-setup-${{ hashFiles('bundle/*jrubyscripting*.jar') }}
|
174
|
-
- name: Cucumber
|
175
|
-
run: bundle exec rake features[${{ matrix.file }}]
|
176
|
-
- name: Generate OpenHAB Dump
|
177
|
-
run: bundle exec rake openhab:dump
|
178
|
-
if: failure()
|
179
|
-
- name: Upload OpenHAB Logs
|
180
|
-
uses: actions/upload-artifact@v2
|
181
|
-
if: failure()
|
182
|
-
with:
|
183
|
-
name: OpenHAB-logs-${{ github.workflow }}-${{ github.run_number }}-${{ matrix.feature }}
|
184
|
-
path: |
|
185
|
-
tmp/cucumber_logs
|
186
|
-
tmp/karaf.log
|
187
|
-
tmp/openhab/userdata/logs
|
188
|
-
tmp/openhab/userdata/*.zip
|
189
|
-
tmp/openhab/conf/automation/jsr223/ruby/personal/
|
190
|
-
retention-days: 2
|
191
|
-
|
192
|
-
pickles-docs:
|
193
|
-
if: github.ref == 'refs/heads/main'
|
194
|
-
runs-on: windows-latest
|
195
|
-
steps:
|
196
|
-
- uses: actions/checkout@v2
|
197
|
-
- name: Install pickles
|
198
|
-
run: choco install pickles
|
199
|
-
- name: Generate Pickles docs
|
200
|
-
shell: cmd
|
201
|
-
run: |
|
202
|
-
call refreshenv
|
203
|
-
pickles -f features -o pickles --df html || VER>NUL
|
204
|
-
- uses: actions/upload-artifact@v2
|
205
|
-
with:
|
206
|
-
name: pickles-docs
|
207
|
-
path: pickles/
|
208
|
-
if-no-files-found: error
|
209
|
-
retention-days: 1
|
210
|
-
|
211
|
-
docs:
|
212
|
-
needs: [cucumber, pickles-docs]
|
213
|
-
if: github.ref == 'refs/heads/main'
|
214
|
-
runs-on: ubuntu-18.04
|
215
|
-
steps:
|
216
|
-
- uses: actions/checkout@v2
|
217
|
-
- uses: actions/setup-ruby@v1
|
218
|
-
with:
|
219
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
220
|
-
- name: Install bundler
|
221
|
-
run: gem install bundler -N
|
222
|
-
- name: Gem Cache
|
223
|
-
uses: actions/cache@v2
|
224
|
-
with:
|
225
|
-
path: vendor/bundle
|
226
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
227
|
-
- name: Install gems
|
228
|
-
run: |
|
229
|
-
bundle config path vendor/bundle
|
230
|
-
bundle install --jobs 4 --retry 3
|
231
|
-
- name: Build yard docs
|
232
|
-
run: |
|
233
|
-
bundle exec rake yard
|
234
|
-
- name: Download pickles docs
|
235
|
-
uses: actions/download-artifact@v2
|
236
|
-
with:
|
237
|
-
name: pickles-docs
|
238
|
-
path: docs/pickles
|
239
|
-
- name: Publish docs
|
240
|
-
uses: JamesIves/github-pages-deploy-action@3.7.1
|
241
|
-
with:
|
242
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
243
|
-
BRANCH: gh-pages
|
244
|
-
FOLDER: docs
|
245
|
-
CLEAN: true
|
246
|
-
SINGLE_COMMIT: true
|
247
|
-
|
248
|
-
|
249
|
-
release:
|
250
|
-
needs: cucumber
|
251
|
-
if: github.ref == 'refs/heads/main'
|
252
|
-
runs-on: ubuntu-18.04
|
253
|
-
steps:
|
254
|
-
- uses: actions/checkout@v2
|
255
|
-
- uses: actions/setup-ruby@v1
|
256
|
-
with:
|
257
|
-
ruby-version: ${{ env.RUBY_VERSION }}
|
258
|
-
- name: Install bundler
|
259
|
-
run: gem install bundler -N
|
260
|
-
- name: Gem Cache
|
261
|
-
uses: actions/cache@v2
|
262
|
-
with:
|
263
|
-
path: vendor/bundle
|
264
|
-
key: gems-${{ hashFiles('**/Gemfile.lock') }}
|
265
|
-
- name: Install gems
|
266
|
-
run: |
|
267
|
-
bundle config path vendor/bundle
|
268
|
-
bundle install --jobs 4 --retry 3
|
269
|
-
- name: Current Version
|
270
|
-
id: current_version
|
271
|
-
run: |
|
272
|
-
bundle exec rake version
|
273
|
-
VERSION=$( bundle exec rake version )
|
274
|
-
echo "::set-output name=version::$( echo "$VERSION" )"
|
275
|
-
- name: Gets latest created release info
|
276
|
-
id: latest_release
|
277
|
-
run: |
|
278
|
-
git fetch --tags
|
279
|
-
git tag | tail -1
|
280
|
-
TAG_NAME=$(git tag | tail -1)
|
281
|
-
echo "::set-output name=tag_name::$( echo "$TAG_NAME" )"
|
282
|
-
- name: Prepare Release
|
283
|
-
if: ${{ steps.current_version.outputs.version != steps.latest_release.outputs.tag_name}}
|
284
|
-
run: |
|
285
|
-
echo "New version detected, preparing release"
|
286
|
-
echo "Released Version: ${{ steps.latest_release.outputs.tag_name }}"
|
287
|
-
echo "Current Version: ${{ steps.current_version.outputs.version }}"
|
288
|
-
bundle exec rake gh:package
|
289
|
-
- name: Get JRuby Bundle
|
290
|
-
id: jruby_bundle
|
291
|
-
if: ${{ steps.current_version.outputs.version != steps.latest_release.outputs.tag_name}}
|
292
|
-
run: |
|
293
|
-
echo "Finding JRuby Bundle"
|
294
|
-
BUNDLE=$(ls bundle/*.jar)
|
295
|
-
echo "Found: $BUNDLE"
|
296
|
-
echo "::set-output name=file::$( echo "$BUNDLE" )"
|
297
|
-
- name: Create Release
|
298
|
-
if: ${{ steps.current_version.outputs.version != steps.latest_release.outputs.tag_name}}
|
299
|
-
uses: actions/create-release@v1
|
300
|
-
id: create_release
|
301
|
-
env:
|
302
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
303
|
-
with:
|
304
|
-
prerelease: true
|
305
|
-
tag_name: ${{ steps.current_version.outputs.version }}
|
306
|
-
release_name: Release ${{ steps.current_version.outputs.version }}
|
307
|
-
body_path: CHANGELOG.md
|
308
|
-
- name: Upload OpenHAB JRuby Scripting Assets
|
309
|
-
if: ${{ steps.current_version.outputs.version != steps.latest_release.outputs.tag_name}}
|
310
|
-
uses: actions/upload-release-asset@v1
|
311
|
-
env:
|
312
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
313
|
-
with:
|
314
|
-
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
315
|
-
asset_path: ./pkg/OpenHABJRuby-${{steps.current_version.outputs.version}}.zip
|
316
|
-
asset_name: OpenHABJRuby-${{steps.current_version.outputs.version}}.zip
|
317
|
-
asset_content_type: application/zip
|
318
|
-
- name: Upload OpenHAB JRuby Bundle Assets
|
319
|
-
if: ${{ steps.current_version.outputs.version != steps.latest_release.outputs.tag_name}}
|
320
|
-
uses: actions/upload-release-asset@v1
|
321
|
-
env:
|
322
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
323
|
-
with:
|
324
|
-
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
325
|
-
asset_path: ${{ steps.jruby_bundle.outputs.file }}
|
326
|
-
asset_name: OpenHAB JRuby Bundle Jar
|
327
|
-
asset_content_type: application/jar
|