steplib 0.9.0.4 → 0.9.0.5

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: 04dc0c48eee3e907fd062848412a925a9fcd0233
4
- data.tar.gz: 5a5511cb083d6feb3bde08c4e8e87c602d2e658d
3
+ metadata.gz: 66e4f21e8f660fc8d451a6827b4f37cc6521dcdb
4
+ data.tar.gz: a71aba9ebcb1794b4b8cf6b4fc2118e23bdc78a4
5
5
  SHA512:
6
- metadata.gz: baf1579589f42f85c282e9d91891b8c0748f989da70a6d00acab923da7edbbb0909f237403f951e0e921022edde2a46a3de2ff12decee8fdc0c1f8c742b9486a
7
- data.tar.gz: 51ba060c848921e7deb3487a5559e4d5aae3cac6c5dae0eba41394592ffc987f559a83a83a8d47ab2ad1eea0a2b4ab134a13cfff8edb16b5f505f5cff8c72689
6
+ metadata.gz: 8c80e7a566e9f6436518e9d83a2f6a3ee0a7cf3e502452f73ef2da3788e45335c636c97b179188ec1d02b00ce9346b8d6990606cc803f37fb1d487c56bb33bf1
7
+ data.tar.gz: 9c2712aa277c6ea674ef8f8be3484d73f763e5ea5c674d0a837666a3ba28dd4472b3e47e2bd4a07c8e5acfdcea9693d88b42fad14bcbc888270a47361fda3373
@@ -58,7 +58,7 @@ module Steplib
58
58
  # from copy_to hash.
59
59
  # Doesn't do a copy of input hash, will inline-set
60
60
  # the attributes / modify the input hash!
61
- def copy_missing_defaults(hsh_copy_to, hsh_copy_from, attr_to_copy_list)
61
+ def copy_missing_attributes(hsh_copy_to, hsh_copy_from, attr_to_copy_list)
62
62
  attr_to_copy_list.each do |a_attr_to_copy|
63
63
  if hsh_copy_to[a_attr_to_copy].nil?
64
64
  hsh_copy_to[a_attr_to_copy] = hsh_copy_from[a_attr_to_copy]
@@ -68,9 +68,9 @@ module Steplib
68
68
  end
69
69
  # Deep-copy version
70
70
  # Returns a new hash, the original input hash will be kept unchanged!
71
- def copy_missing_defaults_dcopy(in_hsh_copy_to, hsh_copy_from, attr_to_copy_list)
71
+ def copy_missing_attributes_dcopy(in_hsh_copy_to, hsh_copy_from, attr_to_copy_list)
72
72
  hsh_copy_to = deep_copy(in_hsh_copy_to)
73
- return copy_missing_defaults(hsh_copy_to, hsh_copy_from, attr_to_copy_list)
73
+ return copy_missing_attributes(hsh_copy_to, hsh_copy_from, attr_to_copy_list)
74
74
  end
75
75
 
76
76
  #
@@ -82,26 +82,31 @@ module Steplib
82
82
  raise "Workflow-step 'version_tag' doesn't match the steplib-step-version's"
83
83
  end
84
84
  #
85
- # copy all except:
86
- # * name
85
+ # copy all except the ones which are used for identifying the input inside a step(-version):
86
+ # * steplib_source
87
+ # * id
87
88
  # * version_tag
89
+ #
90
+ # copy no-matter-what:
88
91
  workflow_step = HashUtils.copy_attributes(
89
92
  workflow_step,
90
93
  steplib_step_version,
91
- [
92
- 'id', 'steplib_source', 'description',
93
- 'website', 'fork_url', 'source', 'host_os_tags',
94
+ ['description', 'website', 'fork_url', 'source', 'host_os_tags',
94
95
  'project_type_tags', 'type_tags', 'is_requires_admin_user',
95
- 'icon_url_256'
96
- ]
96
+ 'icon_url_256']
97
+ )
98
+ #
99
+ # copy only if missing
100
+ # see "@WorkflowUserMod" in the steplib format spec for more information
101
+ workflow_step = HashUtils.copy_missing_attributes(
102
+ workflow_step,
103
+ steplib_step_version,
104
+ ['name']
97
105
  )
98
106
 
99
107
  # update inputs and remove the ones which can't be
100
108
  # found in the steplib step version's inputs
101
109
  # and add the missing ones
102
- # update except:
103
- # * mapped_to
104
- # * value
105
110
  steplib_step_version_inputs = steplib_step_version['inputs']
106
111
  workflow_step['inputs'] = workflow_step['inputs'].map { |a_wf_step_inp|
107
112
  # search for the same input in the steplib-step-version
@@ -117,12 +122,22 @@ module Steplib
117
122
  # return:
118
123
  nil
119
124
  else
125
+ # copy all except the ones which are used for identifying the input inside a step(-version):
126
+ # * mapped_to
127
+ # copy no matter what
120
128
  a_wf_step_inp = HashUtils.copy_attributes(
121
129
  a_wf_step_inp,
122
130
  related_steplib_input,
123
- ['title', 'description', 'is_expand',
131
+ ['title', 'description',
124
132
  'is_required', 'value_options', 'is_dont_change_value']
125
133
  )
134
+ # copy only if missing
135
+ # see "@WorkflowUserMod" in the steplib format spec for more information
136
+ a_wf_step_inp = HashUtils.copy_missing_attributes(
137
+ a_wf_step_inp,
138
+ related_steplib_input,
139
+ ['value', 'is_expand']
140
+ )
126
141
  # return:
127
142
  a_wf_step_inp
128
143
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steplib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.4
4
+ version: 0.9.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bitrise