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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5bb46b1b4cda6e39577b28d949b0a1f91b10491
4
- data.tar.gz: 8b80824cff9ff9a50625f6ea468d972f8e774309
3
+ metadata.gz: 7d888aefc22a4cb176670515597d9b25829b3c62
4
+ data.tar.gz: d15f941ee449a50bbf4687f6a1f621fc742c80bd
5
5
  SHA512:
6
- metadata.gz: d0269bf8f4abc9cfbeb9d8f7f222a822d0902c38c45a264130f172613aac7fc9417d42667e1b730d778d1a0ee7136d262cf37d53badcd7330d44e36967f13131
7
- data.tar.gz: bde2f19ad421425240e1e85ff492b8ccd557cf5053fba485a820ccc0904040f29d120f9238e922c4227fab4a218a0046551b54495b0608863baf1266317f64cc
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 默认为 strategy_always_open
80
+ # 如果不指定 strategy 默认为 strategy_open
81
+ # :test 为trigger 标识符 只有在 strategy_auto 时才有效
81
82
  strategy do |options|
82
- [strategy_auto, :test]
83
- [strategy_always_open, :test]
84
- [strategy_always_close, :test]
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 == ALWAYS_OPEN
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
- call_strategy = true if ( (monitors.strategy_auto.has_key? strategy_key) && method )
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
- puts "Trigger '#{action}' in '#{key}'".green
49
- method.call options
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
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  module Tuya
2
2
  module Ci
3
3
  module DSL
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.9"
5
5
  end
6
6
  end
7
7
  end
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.6
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-07-29 00:00:00.000000000 Z
11
+ date: 2019-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler