tuya-ci-DSL 0.1.6 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tuya/ci/DSL/trigger_create.rb +6 -5
- data/lib/tuya/ci/DSL/trigger_test.rb +5 -2
- data/lib/tuya/ci/DSL/tuya_ci_monitor.rb +13 -7
- data/lib/tuya/ci/DSL/tuya_dsl.rb +10 -0
- data/lib/tuya/ci/DSL/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d888aefc22a4cb176670515597d9b25829b3c62
|
4
|
+
data.tar.gz: d15f941ee449a50bbf4687f6a1f621fc742c80bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45f8b08ff69578d133c076cdc26519ec45de171c9a76ad81a33a24c6b10f9e5f6e62ea313c6fa854ef528408f2173621dc7919333aaa8f1555e8c1a9a19f7cc6
|
7
|
+
data.tar.gz: 69d05f5c4b56a6b5197843cd832b3b819e81af62bc09fff163ccc1d95e154673c31e3a90146bfa426aeb17b9e628baeceb5959711383b84e65e83b96c52d5198
|
@@ -74,14 +74,15 @@ building_project_pod_update_end do |options|
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# trigger 执行策略
|
77
|
-
# strategy_always_open
|
78
77
|
# strategy_always_close
|
78
|
+
# strategy_always_open
|
79
79
|
# strategy_auto
|
80
|
-
# 如果不指定 strategy 默认为
|
80
|
+
# 如果不指定 strategy 默认为 strategy_open
|
81
|
+
# :test 为trigger 标识符 只有在 strategy_auto 时才有效
|
81
82
|
strategy do |options|
|
82
|
-
|
83
|
-
[
|
84
|
-
[
|
83
|
+
[strategy_auto, :bool_key]
|
84
|
+
# [strategy_always_close, :bool_key]
|
85
|
+
# [strategy_always_open, :bool_key]
|
85
86
|
end
|
86
87
|
|
87
88
|
error do |exception, position, options, process|
|
@@ -10,8 +10,11 @@ module TuyaCIDSL
|
|
10
10
|
dsl = TuyaCIDSL::TuyaDSL.instance
|
11
11
|
dsl.load_monitors
|
12
12
|
|
13
|
-
data = Hash.new
|
14
|
-
data[:test] = "some data"
|
13
|
+
# data = Hash.new
|
14
|
+
# data[:test] = "some data"
|
15
|
+
# dsl.insert_strategy data
|
16
|
+
|
17
|
+
data = {"bool_key"=>{"value"=>true}, "choice_key"=>{"value"=>"option-key-001"}, "choices_key"=>{"value"=>["options-key-001", "options-key-002"]}, "string_key"=>{"value"=>"defaultstring"}}
|
15
18
|
dsl.insert_strategy data
|
16
19
|
|
17
20
|
|
@@ -15,6 +15,7 @@ class TuyaCIMonitor
|
|
15
15
|
begin
|
16
16
|
strategy_method = @methods[:strategy]
|
17
17
|
strategy, strategy_key = strategy_method.call options if strategy_method
|
18
|
+
|
18
19
|
unless strategy.class == Fixnum
|
19
20
|
strategy = ALWAYS_OPEN
|
20
21
|
end
|
@@ -35,18 +36,23 @@ class TuyaCIMonitor
|
|
35
36
|
def trigger_call(method, action, options, key, strategy, strategy_key)
|
36
37
|
|
37
38
|
call_strategy = false
|
38
|
-
if strategy ==
|
39
|
-
call_strategy = true if method
|
40
|
-
elsif strategy == ALWAYS_CLOSE
|
39
|
+
if strategy == ALWAYS_CLOSE
|
41
40
|
call_strategy = false
|
41
|
+
elsif strategy == ALWAYS_OPEN
|
42
|
+
call_strategy = true
|
42
43
|
elsif strategy == AUTO
|
43
44
|
monitors = TuyaCIDSL::TuyaDSL.instance
|
44
|
-
|
45
|
+
if monitors.strategy_auto.has_key? strategy_key
|
46
|
+
call_strategy = true
|
47
|
+
options[:strategy] = monitors.strategy_auto[strategy_key]
|
48
|
+
end
|
45
49
|
end
|
46
50
|
|
47
51
|
if call_strategy
|
48
|
-
|
49
|
-
|
52
|
+
if method
|
53
|
+
puts "Trigger '#{action}' in '#{key}'".green
|
54
|
+
method.call options
|
55
|
+
end
|
50
56
|
end
|
51
57
|
end
|
52
58
|
|
@@ -81,7 +87,7 @@ class TuyaCIMonitor
|
|
81
87
|
def exe_error(process, error, position, options)
|
82
88
|
method = @methods['error'.to_sym]
|
83
89
|
# require 'tuya/ci/DSL/exe/dsl_exe'
|
84
|
-
method.call error, position, options, process
|
90
|
+
method.call error, position, options, process if method
|
85
91
|
end
|
86
92
|
|
87
93
|
def exe
|
data/lib/tuya/ci/DSL/tuya_dsl.rb
CHANGED
@@ -30,6 +30,16 @@ module TuyaCIDSL
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def insert_strategy(strategy)
|
33
|
+
|
34
|
+
unless strategy.class == Hash
|
35
|
+
return
|
36
|
+
end
|
37
|
+
|
38
|
+
strategy.keys.each do |item|
|
39
|
+
unless item.is_a?(Symbol)
|
40
|
+
strategy[item.to_sym] = strategy[item]
|
41
|
+
end
|
42
|
+
end
|
33
43
|
@strategy_auto = strategy
|
34
44
|
end
|
35
45
|
|
data/lib/tuya/ci/DSL/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tuya-ci-DSL
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- fangdong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|