apollo_commons_ruby 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1209bbab616c107bf54448dcd426790c00d68b7bf7164f6d1a886a48576e72af
4
- data.tar.gz: b5962d1cbd4726c3239545ff0055f9289b7155a2743255fe4fc0d02bc667fa38
3
+ metadata.gz: b9739f1f60d3cba8ec527798c6d8ea95d564d0086ea2d9464e04353b834413d1
4
+ data.tar.gz: ca8d6782fa6e0c6c9d7666953bac08cf56f2eb460de447882fff0becffbc4792
5
5
  SHA512:
6
- metadata.gz: 5138c814c68b53f37b1d4dc73f933e3d1271153c62072d01b84bbfe3363115ec360d24d4015a6fb4ed86d323f374d5a540642654cb2727079855267fefcb9e89
7
- data.tar.gz: 4450538d4e02a204e061f129aab9cfb67f580791cdd9078f952c2ec9f628a9206780a11ad1c5f0610f7274ab3f810b5eee4eba2574e2a0436edba86ee42b83d7
6
+ metadata.gz: 665b2cc6700a520ff75cffb79055b02be35de62536eb0ef7344d216f7b0f3b6ca00d18c0e215ae36e9335d78fc225ab53ec814f4be3ace58529a0435396c431d
7
+ data.tar.gz: daaa84ffbdd975afe730f67df4faf1c09fee6856d44feda6efc93293f3236bf90696cef3e537f2c23a05a4473937f1a0d9f6360dcfc808d3b1f6ff7b33c0719a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apollo_commons_ruby (0.7.0)
4
+ apollo_commons_ruby (0.7.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -5,7 +5,7 @@ require_relative 'ResolveTemplate'
5
5
  require_relative 'TemplatesHelper'
6
6
  # require "google/cloud/translate"
7
7
 
8
- def create_template_from_file (configuration, template_group, language, view, template_name, template_path, is_apollo_config, tenant_id, project_id)
8
+ def create_template_from_file (is_mario_template, configuration, template_group, language, view, template_name, template_path, is_apollo_config, tenant_id, project_id)
9
9
  begin
10
10
 
11
11
  puts "template_name #{template_name}"
@@ -164,6 +164,9 @@ def create_template_from_file (configuration, template_group, language, view, te
164
164
 
165
165
  data_template = ResolveTemplate.new.resolveEnv(data_template, configuration, tenant_id, project_id)
166
166
  data_template = ResolveTemplate.new.resolveLang(data_template, configuration, language)
167
+ if is_mario_template
168
+ data_template = modify_data_template_if_its_mario_template(data_template)
169
+ end
167
170
  data_template = Base64.encode64(data_template.newline).newline
168
171
 
169
172
  if is_apollo_config
@@ -176,6 +179,28 @@ def create_template_from_file (configuration, template_group, language, view, te
176
179
  end
177
180
  end
178
181
 
182
+ def modify_data_template_if_its_mario_template(data_template)
183
+ if data_template.include? "'\\n'"
184
+ data_template.gsub! "'\\n'", "'$$n$$'"
185
+ end
186
+ if data_template.include? "\\\”"
187
+ data_template.gsub! "\\\”", "$$q$$"
188
+ end
189
+ if data_template.include? "\n"
190
+ data_template.gsub! "\n", ""
191
+ end
192
+ if data_template.include? "\""
193
+ data_template.gsub! "\"", "'"
194
+ end
195
+ if data_template.include? "'$$n$$'"
196
+ data_template.gsub! "'$$n$$'", "'\\n'"
197
+ end
198
+ if data_template.include? "$$q$$"
199
+ data_template.gsub! "$$q$$", "\\\”"
200
+ end
201
+ return data_template
202
+ end
203
+
179
204
  def create_template_mapping_payload(template_group, language, view_type, templateMappings, version)
180
205
  body = {
181
206
  "templateGroup" => template_group,
@@ -540,6 +565,7 @@ def deploy_one_template(task)
540
565
  should_update_inbox = task.should_update_inbox
541
566
  tenant_id = task.tenant_id
542
567
  project_id = task.project_id
568
+ is_mario_template = task.is_mario_template
543
569
 
544
570
  configuration = Configuration.new(environment)
545
571
  return if configuration == nil
@@ -649,11 +675,11 @@ def deploy_one_template(task)
649
675
  if template_mapping_hash["template_name"] == "default"
650
676
  if version == nil
651
677
  puts "\n*For template_name #{template_mapping_hash["template_name"]}*\n"
652
- templates = create_template_from_file(configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
678
+ templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
653
679
  else
654
680
  puts "\n*For template_name #{template_mapping_hash["template_name"]}*\n"
655
681
  version_path = "#{dir_path}"
656
- templates = create_template_from_file(configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
682
+ templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
657
683
  end
658
684
  end
659
685
  request_payload = CreateTemplatePayload.new(template_group, language, view_type, templates, version)
@@ -670,14 +696,14 @@ def deploy_one_template(task)
670
696
  if version == nil
671
697
  template_mapping_hash = template_mapping.create_hash
672
698
  puts "\n*For template_name #{template_mapping_hash["template_name"]}*\n"
673
- templates = create_template_from_file(configuration, template_group, language, view_type, inbox_template_name, template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
674
- apollo_config_templates = create_template_from_file(configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], true, tenant_id, project_id).create_hash
699
+ templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, inbox_template_name, template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
700
+ apollo_config_templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], true, tenant_id, project_id).create_hash
675
701
  else
676
702
  template_mapping_hash = template_mapping.create_hash
677
703
  puts "\n*For template_name #{template_mapping_hash["template_name"]}*\n"
678
704
  version_path = "#{dir_path}"
679
- templates = create_template_from_file(configuration, template_group, language, view_type, inbox_template_name, template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
680
- apollo_config_templates = create_template_from_file(configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], true, tenant_id, project_id).create_hash
705
+ templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, inbox_template_name, template_mapping_hash["template_path"], false, tenant_id, project_id).create_hash
706
+ apollo_config_templates = create_template_from_file(is_mario_template, configuration, template_group, language, view_type, template_mapping_hash["template_name"], template_mapping_hash["template_path"], true, tenant_id, project_id).create_hash
681
707
  end
682
708
  if should_update_inbox
683
709
  request_payload = CreateTemplatePayload.new(template_group, language, view_type, templates, version)
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module ApolloCommonsRuby
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apollo_commons_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sahil Prakash
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-12 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Used in ruby functions
14
14
  email: