brpm_content 0.1.26 → 0.1.27

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGZjMzAyNjYxMzE1YWVkNzU1ZGE2MTFmODM2ZmMyOWY2ZTI0MGU2Yg==
4
+ NTQyZTc5NjQ5NGE2NTNiZjhhMTZkYTcyMDYzNmY4NTdiNTYxMTRlNQ==
5
5
  data.tar.gz: !binary |-
6
- YmI4ZDA4ZjZlZWM1ZjBmMzI4Zjk5NWMxNmJmZWVlNGNjMDY3NTllMQ==
6
+ YWMxMmM0MzczYjFlMTlhNDQwNGI2NGMwOTZjNGQ5YzlmNzgxOTIyYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjBlMGM5YWRlMzlhNTFlY2I1MDE1YzM0YjhhMTQ1YmQ5ZDc3ZWYyOTdiMDM2
10
- MDQ5NzNlNzk2NGI4YTEwMGRjM2Y4N2NlYjlhYzI5NTQ5ZDAzYWQwNDNiOWEy
11
- YTM5YzMxMzMwYzgzN2JlNThkYjBiOTU2ZGU5ZDdlNmI4YWQ0YmY=
9
+ NDExYThkNzJmMWU0MDRhYzUwNWU1MzkzYzM5ZDMxOTMyOWEwZDFiMDliYmFh
10
+ OTc5Mjc5YTcwMjc2MjYzZDM0NzFlMTg3NDNmODhmMzM5Y2I1YjA1YzMzZTE1
11
+ NTgyNDZkYzc5NDU0Nzc5NGQzZjlkODI1OTZmYjI2ZGQxMGMyNmM=
12
12
  data.tar.gz: !binary |-
13
- YTBiMTcwYzY1MzQzYTU0OTY4YzVkYTRlMGNjYTFlYmUwYjYxM2I4NGVhNWZk
14
- MjUxNTIwMzMzNzZhYzA0MzFhYjM1NzgxNWZlOTQwMjVhMjE1ZTdjMDExNjIw
15
- Njg2NGNhODE2OTVkODQwMWZmNDEzOGRhOWNjZDAwYzhhYmNmNTQ=
13
+ YjE5NjgwMTFiNjZmYTU2MzVjYmY1YTVlOTRjMTg2NDZmOGUzZjg5NmNhN2Jk
14
+ NWRjNjA0NjM5YWJhMGNkNTM3ZmQwZmM1MTYxNDE5ZjhiY2JlZmNkN2E2NjNk
15
+ MWI5NTY5Mzc2Y2Y4MTZlMGVmODU1MzIyMjUzZjlmYTJhYjE4NzE=
@@ -1,10 +1,10 @@
1
- ###
2
- # command:
3
- # name: command to run
4
- # position: A1:F1
5
- # type: in-text
6
- # success:
7
- # name: term to indicate success
8
- # position: A2:D2
9
- # type: in-text
10
- ###
1
+ params:
2
+ command:
3
+ name: command to run
4
+ position: A1:F1
5
+ type: in-text
6
+ success:
7
+ name: term to indicate success
8
+ position: A2:D2
9
+ type: in-text
10
+
@@ -1,10 +1,10 @@
1
- ###
2
- # name:
3
- # name: name
4
- # type: in-text
5
- # required: yes
6
- # version:
7
- # name: version
8
- # type: in-text
9
- # required: no
10
- ###
1
+ params:
2
+ name:
3
+ name: name
4
+ type: in-text
5
+ required: yes
6
+ version:
7
+ name: version
8
+ type: in-text
9
+ required: no
10
+
@@ -1,4 +1,4 @@
1
- version: 0.1.26
1
+ version: 0.1.27
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -119,12 +119,12 @@ class ModuleInstaller
119
119
  end
120
120
 
121
121
  def create_automation_category_if_not_exists(module_friendly_name)
122
- list_item = @brpm_rest_client.get_list_item_by_name(module_friendly_name)
122
+ list_item = @brpm_rest_client.get_list_item_by_name("AutomationCategory", module_friendly_name)
123
123
 
124
124
  unless list_item
125
125
  BrpmAuto.log "Automation category #{module_friendly_name} doesn't exist yet, so creating it now..."
126
126
  list_item = {}
127
- list_item["list_id"] = 24 # AutomationCategory TODO: find the id by the name of the list
127
+ list_item["list_id"] = @brpm_rest_client.get_list_by_name("AutomationCategory")
128
128
  list_item["value_text"] = module_friendly_name
129
129
  @brpm_rest_client.create_list_item_by_hash(list_item)
130
130
  end
@@ -188,28 +188,28 @@ class ModuleInstaller
188
188
  auto_script_config_path = "#{File.dirname(auto_script_path)}/#{auto_script_name}.txt"
189
189
 
190
190
  auto_script_config_content = File.exists?(auto_script_config_path) ? File.read(auto_script_config_path) : ""
191
- match = auto_script_config_content.match(/###\n(.*)\n###/m)
192
- input_params_content = match ? "#{match[1]}\n" : ""
191
+ auto_script_config = YAML.load(auto_script_config_content) || {}
192
+ auto_script_config["params"] = {} unless auto_script_config["params"]
193
193
 
194
194
  if automation_type == "Automation"
195
- matches = input_params_content.scan(/^# {0,1}(.*)/) || []
196
- input_params_yaml = YAML.load(matches.join("\n")) || {}
197
-
198
- input_params_content += get_input_params_template(input_params_yaml)
195
+ add_version_params(auto_script_config["params"])
199
196
  end
200
197
 
201
198
  wrapper_script_content = ""
202
- unless input_params_content.empty?
203
- wrapper_script_content = "###\n#{input_params_content}###\n"
199
+ if auto_script_config["params"].size > 0
200
+ params_content = auto_script_config["params"].to_yaml
201
+ params_content.sub!("---\n", "") # Remove the yaml document separator line
202
+ params_content.gsub!("required: 'yes'", "required: yes") # yaml adding quotes to reserved keywords yes and no :-(
203
+ params_content.gsub!("required: 'no'", "required: no") # yaml adding quotes to reserved keywords yes and no :-(
204
+ params_content.gsub!(/(^)+/, "# ") # Prepend "# " to each line
205
+ wrapper_script_content = "###\n#{params_content}###\n"
204
206
  end
205
207
 
206
- auto_script_config = YAML.load(auto_script_config_content) || {}
207
-
208
208
  integration_server = nil
209
209
  if auto_script_config["integration_server_type"]
210
210
  server_type_id = @brpm_rest_client.get_id_for_project_server_type(auto_script_config["integration_server_type"])
211
211
  if server_type_id
212
- integration_server = integration_servers.find { |integration_server| integration_server["server_name_id"] == server_type_id } #TODO: support multiple integration servers of same type (user should pick one)
212
+ integration_server = integration_servers.find { |integr_server| integr_server["server_name_id"] == server_type_id } #TODO: support multiple integration servers of same type (user should pick one)
213
213
 
214
214
  if integration_server
215
215
  wrapper_script_content += "\n"
@@ -263,33 +263,23 @@ class ModuleInstaller
263
263
  end
264
264
  end
265
265
 
266
- def get_input_params_template(input_params_yaml)
266
+ def add_version_params(auto_script_params)
267
267
  include_position_attribute = false
268
- if input_params_yaml.find {|_, param| param.has_key?("position")}
268
+ if auto_script_params.find { |_, param| param.has_key?("position") }
269
269
  include_position_attribute = true
270
270
  end
271
271
 
272
- template = <<EOR
273
- # framework_version:
274
- # name: Framework version
275
- # required: no
276
- EOR
277
-
278
- if include_position_attribute
279
- template += "# position: A#{input_params_yaml.size + 1}:C#{input_params_yaml.size + 1}\n"
280
- end
281
-
282
- template += <<EOR
283
- # module_version:
284
- # name: Module version
285
- # required: no
286
- EOR
287
-
288
- if include_position_attribute
289
- template += "# position: A#{input_params_yaml.size + 2}:C#{input_params_yaml.size + 2}\n"
290
- end
291
-
292
- template
272
+ module_version_param = {}
273
+ module_version_param["name"] = "module_version"
274
+ module_version_param["required"] = "no"
275
+ module_version_param["position"] = "A#{auto_script_params.size + 1}:C#{auto_script_params.size + 1}" if include_position_attribute
276
+ auto_script_params["module_version"] = module_version_param
277
+
278
+ framework_version_param = {}
279
+ framework_version_param["name"] = "framework_version"
280
+ framework_version_param["required"] = "no"
281
+ framework_version_param["position"] = "A#{auto_script_params.size + 1}:C#{auto_script_params.size + 1}" if include_position_attribute
282
+ auto_script_params["framework_version"] = framework_version_param
293
283
  end
294
284
 
295
285
  def get_integration_server_template(integration_server_id, integration_server_name, integration_server_type)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.26
4
+ version: 0.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus
8
8
  autorequire:
9
9
  bindir: modules/framework/bin
10
10
  cert_chain: []
11
- date: 2015-07-20 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client