apollo_commons_ruby_cli 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +9 -0
  4. data/CODE_OF_CONDUCT.md +74 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +19 -0
  7. data/README.md +40 -0
  8. data/Rakefile +2 -0
  9. data/apollo_commons_ruby.gemspec +26 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/lib/apollo_commons_ruby/AtroposSubscription.rb +88 -0
  13. data/lib/apollo_commons_ruby/BackfillSampleData.rb +41 -0
  14. data/lib/apollo_commons_ruby/DomainEvent.rb +181 -0
  15. data/lib/apollo_commons_ruby/ExecuteCommand.rb +20 -0
  16. data/lib/apollo_commons_ruby/FileUtils.rb +136 -0
  17. data/lib/apollo_commons_ruby/MarioConfigsStability.rb +181 -0
  18. data/lib/apollo_commons_ruby/MarioEvent.rb +45 -0
  19. data/lib/apollo_commons_ruby/NetworkUtils.rb +188 -0
  20. data/lib/apollo_commons_ruby/Operation.rb +5 -0
  21. data/lib/apollo_commons_ruby/Permission.rb +51 -0
  22. data/lib/apollo_commons_ruby/RequestDataUtils.rb +28 -0
  23. data/lib/apollo_commons_ruby/ResolveTemplate.rb +40 -0
  24. data/lib/apollo_commons_ruby/SecretConfig.rb +65 -0
  25. data/lib/apollo_commons_ruby/ShopHook.rb +79 -0
  26. data/lib/apollo_commons_ruby/TemplateDebug.rb +207 -0
  27. data/lib/apollo_commons_ruby/TemplatePusher.rb +159 -0
  28. data/lib/apollo_commons_ruby/TemplatesHelper.rb +808 -0
  29. data/lib/apollo_commons_ruby/TemplatesRakefile.rb +864 -0
  30. data/lib/apollo_commons_ruby/TenantInfo.rb +26 -0
  31. data/lib/apollo_commons_ruby/TenantTokenCreator.rb +16 -0
  32. data/lib/apollo_commons_ruby/VerifyMarioConfig.rb +220 -0
  33. data/lib/apollo_commons_ruby/ViewGroup.rb +64 -0
  34. data/lib/apollo_commons_ruby/ViewGroupComponent.rb +73 -0
  35. data/lib/apollo_commons_ruby/ViewGroupDefinition.rb +68 -0
  36. data/lib/apollo_commons_ruby/WebhookReporting.rb +13 -0
  37. data/lib/apollo_commons_ruby/Zebugger.rb +125 -0
  38. data/lib/apollo_commons_ruby.rb +60 -0
  39. data/lib/jar/v1_atroposDevTools.jar +0 -0
  40. data/lib/tasks/add_translations.rake +9 -0
  41. data/lib/tasks/backfill_sample_data.rake +7 -0
  42. data/lib/tasks/checkValidJson.rake +17 -0
  43. data/lib/tasks/delete_domain_event.rake +7 -0
  44. data/lib/tasks/delete_view_group.rake +7 -0
  45. data/lib/tasks/delete_view_group_component.rake +21 -0
  46. data/lib/tasks/delete_view_group_definition.rake +26 -0
  47. data/lib/tasks/deploy_all_templates.rake +7 -0
  48. data/lib/tasks/deploy_permissions.rake +6 -0
  49. data/lib/tasks/deploy_shophooks.rake +6 -0
  50. data/lib/tasks/display_on_zebugger.rake +19 -0
  51. data/lib/tasks/get_tenant_token.rake +6 -0
  52. data/lib/tasks/runTests.rake +27 -0
  53. data/lib/tasks/template_debug.rake +32 -0
  54. data/lib/tasks/update_all.rake +36 -0
  55. data/lib/tasks/update_all_domain_events.rake +24 -0
  56. data/lib/tasks/update_all_view_group_components.rake +18 -0
  57. data/lib/tasks/update_domain_event.rake +12 -0
  58. data/lib/tasks/update_one_template.rake +42 -0
  59. data/lib/tasks/update_translations.rake +24 -0
  60. data/lib/tasks/update_view_group_component.rake +9 -0
  61. data/lib/tasks/update_view_group_definition.rake +7 -0
  62. data/lib/tasks/update_view_group_for_user_0.rake +36 -0
  63. data/lib/tasks/validate_mario_configs.rake +10 -0
  64. data/lib/tasks/verify_mario_config.rake +15 -0
  65. data/lib/version.rb +3 -0
  66. metadata +109 -0
Binary file
@@ -0,0 +1,9 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Add translated language"
5
+ task :add_translations do
6
+ language = ENV["language"]
7
+ puts "Adding Translations for language #{language}"
8
+ add_translations_for_language(language)
9
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../apollo_commons_ruby/Operation'
2
+ require_relative '../apollo_commons_ruby/BackfillSampleData'
3
+
4
+ desc "Backfill Sample Data"
5
+ task :backfill_sample_data do
6
+ backfill_sample_data_for_configs(ENV)
7
+ end
@@ -0,0 +1,17 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Check if all JSON files in the repo are valid"
5
+ task :checkValidJson do
6
+ require 'find'
7
+ Find.find(Dir.pwd) do |file|
8
+ # process
9
+ if (file.include? ".json" and file.include? "Templates/")
10
+ data = read_data_from_file_path(file)
11
+ puts file
12
+ if data.strip != ""
13
+ parsedData = JSON.parse(data)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../apollo_commons_ruby/DomainEvent'
2
+ require_relative '../apollo_commons_ruby/Operation'
3
+
4
+ desc "Delete Domain Event"
5
+ task :delete_domain_event do
6
+ handle_domain_event_task(ENV, Operation::DELETE)
7
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroup'
2
+ require_relative '../apollo_commons_ruby/Operation'
3
+
4
+ desc "Delete View Group for user"
5
+ task :delete_view_group do
6
+ handle_view_group_task(ENV, Operation::DELETE)
7
+ end
@@ -0,0 +1,21 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
2
+ require_relative '../apollo_commons_ruby/DomainEvent'
3
+ require_relative '../apollo_commons_ruby/Operation'
4
+
5
+ desc "Delete View Group Component"
6
+ task :delete_view_group_component do
7
+ viewGroupDefinition = ENV["view_group_definition"]
8
+ environment = ENV["environment"]
9
+ tenantId = ENV["tenant_id"]
10
+ projectId = ENV["project_id"]
11
+ viewGroupComponent = ENV["view_group_component"]
12
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent) do |topic|
13
+ next if topic == '.' || topic == '..' || topic == 'view_group_component_properties.json' || topic == '.DS_Store'
14
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent + "/" + topic) do |eventName|
15
+ next if eventName == '.' || eventName == '..' || eventName == '.DS_Store'
16
+ puts "Deleting domain event for topic " + topic + " and eventName = " + eventName + " and component = " + viewGroupComponent
17
+ handle_domain_event(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, topic, eventName, Operation::DELETE)
18
+ end
19
+ handle_view_group_component(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, Operation::DELETE)
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/DomainEvent'
4
+ require_relative '../apollo_commons_ruby/Operation'
5
+
6
+ desc "Delete View Group Definition"
7
+ task :delete_view_group_definition do
8
+ viewGroupDefinition = ENV["view_group_definition"]
9
+ environment = ENV["environment"]
10
+ tenantId = ENV["tenant_id"]
11
+ projectId = ENV["project_id"]
12
+
13
+ Dir.foreach('./configs/' + viewGroupDefinition) do |viewGroupComponent|
14
+ next if viewGroupComponent == '.' || viewGroupComponent == '..' || viewGroupComponent == 'view_group_definition_properties.json' || viewGroupComponent == '.DS_Store'
15
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent) do |topic|
16
+ next if topic == '.' || topic == '..' || topic == 'view_group_component_properties.json' || topic == '.DS_Store'
17
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent + "/" + topic) do |eventName|
18
+ next if eventName == '.' || eventName == '..' || eventName == '.DS_Store'
19
+ puts "Deleting domain event for topic " + topic + " and eventName = " + eventName + " and component = " + viewGroupComponent
20
+ handle_domain_event(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, topic, eventName, Operation::DELETE)
21
+ end
22
+ handle_view_group_component(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, Operation::DELETE)
23
+ end
24
+ handle_view_group_definition(viewGroupDefinition, environment, tenantId, projectId, Operation::DELETE)
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Deploy All templates"
5
+ task :deploy_all_templates do
6
+ deploy_all_templates()
7
+ end
@@ -0,0 +1,6 @@
1
+ require_relative '../apollo_commons_ruby/Permission'
2
+
3
+ desc "Deploy permissions"
4
+ task :deploy_permissions do
5
+ deploy_permissions(ENV)
6
+ end
@@ -0,0 +1,6 @@
1
+ require_relative '../apollo_commons_ruby/ShopHook'
2
+
3
+ desc "Deploy shophooks"
4
+ task :deploy_shophooks do
5
+ deploy_shophooks(ENV)
6
+ end
@@ -0,0 +1,19 @@
1
+ require_relative '../apollo_commons_ruby/Zebugger'
2
+
3
+ desc "Run template on zebugger"
4
+ task :zebugger do
5
+ task = OpenStruct.new
6
+ task.environment = ENV["environment"]
7
+ task.template_group = ENV["template_group"]
8
+ task.language = ENV["language"]
9
+ task.view_type = ENV["view_type"]
10
+ task.platform = ENV["platform"]
11
+ task.tenant_id = ENV["tenant_id"]
12
+ task.project_id = ENV["project_id"]
13
+ templated_data_ready = false
14
+ if(ENV["templated_data_ready"] == "true")
15
+ templated_data_ready = true
16
+ end
17
+ task.task_id = 1
18
+ build_template(task, templated_data_ready)
19
+ end
@@ -0,0 +1,6 @@
1
+ require_relative '../apollo_commons_ruby/TenantTokenCreator'
2
+
3
+ desc "Get Tenant Token"
4
+ task :get_tenant_token do
5
+ get_tenant_token_from_apollo_app(ENV)
6
+ end
@@ -0,0 +1,27 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Unit test"
5
+ task :runTests do
6
+ require 'find'
7
+ if !Dir.pwd.include? "/Users/ios-ci/.jenkins/jobs/"
8
+ puts "Make sure that you have NodeJS installed."
9
+ puts "Export the necessary functions. Eg: exports.functionName = functionName;"
10
+ puts "For running individual tests, use the command: node <filename>.js"
11
+ puts "Example: node AndroidCurrencyUtilsTest.js"
12
+ end
13
+ puts "\n"
14
+ puts "NodeJS version: "
15
+ system("node -v")
16
+ puts "\n"
17
+ Find.find(Dir.pwd + "/commons/tests/") do |file|
18
+ if (file.include? ".js" and !file.include? "TestUtils.js")
19
+ puts "Running tests from " + file.sub(Dir.pwd, '')
20
+ result = system("node " + file)
21
+ if (!result)
22
+ exec("exit 1")
23
+ end
24
+ puts "\n"
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ require_relative '../apollo_commons_ruby/TemplateDebug'
2
+ require_relative '../apollo_commons_ruby/FileUtils'
3
+ require 'json'
4
+
5
+ $secretConfig = nil
6
+ $environmentProperties = nil
7
+
8
+ desc "Get template group details"
9
+ task :get_template_group do
10
+ load_environment_properties_for_debug(ENV['environment'], ENV['tenant_id'], ENV['project_id'])
11
+ template_group_details = get_template_group_entity(ENV)
12
+ File.open('./tempTemplateGroupDetails.json', 'w') {|file| file.truncate(0) }
13
+ File.open("./tempTemplateGroupDetails.json", "w") do |f|
14
+ f.write(template_group_details.to_json)
15
+ end
16
+ end
17
+
18
+ def get_template_group_entity(env)
19
+ task = OpenStruct.new
20
+ task.environment = env['environment']
21
+ task.template_group = env["templateGroup"]
22
+ task.view_type = 'MARIO'
23
+ task.template_name = 'default'
24
+ task.tenant_id = env['tenant_id']
25
+ task.project_id = env['project_id']
26
+ task.is_v8_mario_template = true
27
+ task.should_update_inbox = false
28
+ task.scope_id = env['project_id']
29
+ task.is_debug_api = true
30
+ task.template_directory = $secretConfig.templateDirectory
31
+ return get_template_group_details(task)
32
+ end
@@ -0,0 +1,36 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/DomainEvent'
4
+ require_relative '../apollo_commons_ruby/MarioEvent'
5
+ require_relative '../apollo_commons_ruby/Operation'
6
+
7
+ desc "Update all"
8
+ task :update_all do
9
+ environment = ENV["environment"]
10
+ tenantId = ENV["tenant_id"]
11
+ projectId = ENV["project_id"]
12
+
13
+ Dir.foreach('./configs') do |viewGroupDefinition|
14
+ next if viewGroupDefinition == '.' || viewGroupDefinition == '..' || viewGroupDefinition == '.DS_Store' || viewGroupDefinition.start_with?('0_') == true
15
+
16
+ puts "Updating definition " + viewGroupDefinition
17
+ handle_view_group_definition(viewGroupDefinition, environment, tenantId, projectId, Operation::PUT)
18
+
19
+ Dir.foreach('./configs/' + viewGroupDefinition) do |viewGroupComponent|
20
+ next if viewGroupComponent == '.' || viewGroupComponent == '..' || viewGroupComponent == 'view_group_definition_properties.json'
21
+
22
+ puts "Updating component " + viewGroupComponent
23
+ handle_view_group_component(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, Operation::PUT)
24
+
25
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent) do |topic|
26
+ next if topic == '.' || topic == '..' || topic == 'view_group_component_properties.json'
27
+
28
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent + "/" + topic) do |eventName|
29
+ next if eventName == '.' || eventName == '..'
30
+ puts "Updating domain event for topic " + topic + " and eventName = " + eventName
31
+ handle_domain_event(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, topic, eventName, Operation::PUT)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/DomainEvent'
4
+ require_relative '../apollo_commons_ruby/Operation'
5
+
6
+ desc "Update all Domain Events"
7
+ task :update_all_domain_events do
8
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent) do |topic|
9
+ next if topic == '.' || topic == '..' || topic == 'view_group_component_properties.json' || topic == '.DS_Store'
10
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent + "/" + topic) do |eventName|
11
+ next if eventName == '.' || eventName == '..' || eventName == '.DS_Store'
12
+ puts "Updating domain event for topic " + topic + " and eventName = " + eventName
13
+ task = []
14
+ task["view_group_definition"] = ENV["view_group_definition"]
15
+ task["view_group_component"]= ENV["view_group_component"]
16
+ task["environment"] = ENV["environment"]
17
+ task["tenant_id"] = ENV["tenant_id"]
18
+ task["project_id"] = ENV["project_id"]
19
+ task["event_name"] = eventName
20
+ task["topic"] = topic
21
+ update_domain_event(task)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/Operation'
4
+
5
+ desc "Update all View Group Components"
6
+ task :update_all_view_group_components do
7
+ handle_view_group_definition_task(ENV, Operation::PUT)
8
+ viewGroupDefinition = ENV["view_group_definition"]
9
+ environment = ENV["environment"]
10
+ tenantId = ENV["tenant_id"]
11
+ projectId = ENV["project_id"]
12
+
13
+ Dir.foreach('./configs/' + viewGroupDefinition) do |component|
14
+ next if component == '.' || component == '..' || component == 'view_group_definition_properties.json'
15
+ puts "Updating component " + component
16
+ handle_view_group_component(viewGroupDefinition, environment, tenantId, projectId, component, Operation::PUT)
17
+ end
18
+ end
@@ -0,0 +1,12 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/DomainEvent'
4
+ require_relative '../apollo_commons_ruby/Operation'
5
+ require_relative '../apollo_commons_ruby/VerifyMarioConfig'
6
+ require_relative '../apollo_commons_ruby/AtroposSubscription'
7
+ require_relative '../apollo_commons_ruby/RequestDataUtils'
8
+
9
+ desc "Update Domain Event"
10
+ task :update_domain_event do
11
+ update_domain_event(ENV)
12
+ end
@@ -0,0 +1,42 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Update given template name to Inbox/Apollo-config"
5
+ task :update_one_template do
6
+ task_to_schedule = OpenStruct.new
7
+ task_to_schedule.environment = ENV['environment']
8
+ task_to_schedule.template_group = ENV['template_group']
9
+ task_to_schedule.language = ENV['language']
10
+ task_to_schedule.view_type = ENV['view_type']
11
+ task_to_schedule.template_name = ENV['template_name']
12
+ task_to_schedule.version = ENV['version']
13
+ task_to_schedule.tenant_id = ENV['tenant_id']
14
+ task_to_schedule.project_id = ENV['project_id']
15
+ if ENV['should_update_inbox'] == 'true'
16
+ task_to_schedule.should_update_inbox = true
17
+ else
18
+ task_to_schedule.should_update_inbox = false
19
+ end
20
+ if ENV['scope_id'] === nil
21
+ raise "scope_id is mandatory for deploying templates."
22
+ end
23
+ task_to_schedule.scope_id = ENV['scope_id']
24
+ task_to_schedule.task_id = 1
25
+
26
+ # current_dir = Dir.pwd
27
+ # if !current_dir.include? "/Users/ios-ci/.jenkins/jobs/"
28
+ # puts "This rake command is no more supported. Please use jenkins build http://iosci.corp.zeta.in:8080/job/"
29
+ # return nil
30
+ # end
31
+
32
+ if task_to_schedule.environment == nil or task_to_schedule.template_group == nil
33
+ puts "`environment`, `template_group` has to be passed. Environment = `Prod`/'PreProd'/`Staging`"
34
+ return
35
+ end
36
+
37
+ if task_to_schedule.environment.eql?("Prod")
38
+ #perform_git_checks
39
+ end
40
+
41
+ deploy_one_template(task_to_schedule)
42
+ end
@@ -0,0 +1,24 @@
1
+ require_relative '../apollo_commons_ruby/TemplatesRakefile'
2
+ require_relative '../apollo_commons_ruby/TemplatesHelper'
3
+
4
+ desc "Replace translation strings in an existing resource file from new provided translations"
5
+ task :update_translations do
6
+ # Expectations:
7
+ # 1) Source file should have traslated strings in key,translated_string format per line
8
+ # 2) Destination will be always be one of the languages added to Resources folder previously
9
+ source_csv_file_path = ENV['source_csv']
10
+ language = ENV['language']
11
+ if source_csv_file_path == nil
12
+ log_error("source_csv has to be passed.")
13
+ abort()
14
+ end
15
+
16
+ if language == nil
17
+ log_error("language has to be passed.")
18
+ abort()
19
+ end
20
+
21
+ language_file_path = "Resources/#{language}.json"
22
+ update_existing_translations(source_csv_file_path, language_file_path)
23
+
24
+ end
@@ -0,0 +1,9 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/Operation'
4
+
5
+ desc "Update View Group Component"
6
+ task :update_view_group_component do
7
+ handle_view_group_definition_task(ENV, Operation::PUT)
8
+ handle_view_group_component_task(ENV, Operation::PUT)
9
+ end
@@ -0,0 +1,7 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/Operation'
3
+
4
+ desc "Update View Group Definition"
5
+ task :update_view_group_definition do
6
+ handle_view_group_definition_task(ENV, Operation::PUT)
7
+ end
@@ -0,0 +1,36 @@
1
+ require_relative '../apollo_commons_ruby/ViewGroupDefinition'
2
+ require_relative '../apollo_commons_ruby/ViewGroupComponent'
3
+ require_relative '../apollo_commons_ruby/DomainEvent'
4
+ require_relative '../apollo_commons_ruby/MarioEvent'
5
+ require_relative '../apollo_commons_ruby/Operation'
6
+
7
+ desc "Update view group for user 0"
8
+ task :update_view_group_for_user_0 do
9
+ environment = ENV["environment"]
10
+ tenantId = ENV["tenant_id"]
11
+ projectId = ENV["project_id"]
12
+
13
+ Dir.foreach('./configs') do |viewGroupDefinition|
14
+ next if viewGroupDefinition == '.' || viewGroupDefinition == '..' || viewGroupDefinition == '.DS_Store' || viewGroupDefinition.start_with?('0_') == false
15
+
16
+ handle_view_group_definition(viewGroupDefinition, environment, tenantId, projectId, Operation::PUT)
17
+
18
+ Dir.foreach('./configs/' + viewGroupDefinition) do |viewGroupComponent|
19
+ next if viewGroupComponent == '.' || viewGroupComponent == '..' || viewGroupComponent == 'view_group_definition_properties.json' || viewGroupComponent == '.DS_Store'
20
+
21
+ handle_view_group_component(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, Operation::PUT)
22
+
23
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent) do |topic|
24
+ next if topic == '.' || topic == '..' || topic == 'view_group_component_properties.json' || topic == '.DS_Store'
25
+
26
+ Dir.foreach('./configs/' + viewGroupDefinition + "/" + viewGroupComponent + "/" + topic) do |eventName|
27
+ next if eventName == '.' || eventName == '..' || eventName == '.DS_Store'
28
+ puts "Updating domain event for topic " + topic + " and eventName = " + eventName
29
+ handle_domain_event(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, topic, eventName, Operation::PUT)
30
+ viewGroupUpdationBody = "{ \"data\" : {} }"
31
+ handle_mario_event(viewGroupDefinition, environment, tenantId, projectId, viewGroupComponent, topic, eventName, viewGroupUpdationBody)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,10 @@
1
+ require_relative '../apollo_commons_ruby/MarioConfigsStability'
2
+
3
+ desc "Validate Mario Configs"
4
+ task :validate_mario_configs do
5
+ if ENV["is_local_testing"] != nil && ENV["is_local_testing"] == 'true'
6
+ validate_local_configs(ENV)
7
+ else
8
+ validate_mario_configs(ENV)
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ require_relative '../apollo_commons_ruby/Operation'
2
+ require_relative '../apollo_commons_ruby/VerifyMarioConfig'
3
+
4
+ desc "Debug Mario configs"
5
+ task :debug_mario_configs do
6
+ requestData = ENV['request_data_file']
7
+ location = Dir.pwd + "/configs/" + ENV['view_group_definition'] + "/" + ENV['view_group_component'] + "/" + ENV['topic'] + "/" + ENV['event_name'] + "/sampleData/" + ENV['environment']
8
+ sample_data_location = location + "/" + requestData + ".json"
9
+ atropos_transformer_js_validation_jar_output_data = validate_atropos_transformer_and_get_output(ENV, sample_data_location)
10
+ if atropos_transformer_js_validation_jar_output_data.include? "topic"
11
+ handle_mario_debugger(ENV, ENV['request_data_file'], atropos_transformer_js_validation_jar_output_data, true, true, true)
12
+ else
13
+ puts "Invalid Atropos Subscription Transformer"
14
+ end
15
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module ApolloCommonsRuby
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apollo_commons_ruby_cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sahil Prakash
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Used in ruby functions
14
+ email:
15
+ - sahilpr@zeta.tech
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".DS_Store"
21
+ - ".gitignore"
22
+ - CODE_OF_CONDUCT.md
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - README.md
26
+ - Rakefile
27
+ - apollo_commons_ruby.gemspec
28
+ - bin/console
29
+ - bin/setup
30
+ - lib/apollo_commons_ruby.rb
31
+ - lib/apollo_commons_ruby/AtroposSubscription.rb
32
+ - lib/apollo_commons_ruby/BackfillSampleData.rb
33
+ - lib/apollo_commons_ruby/DomainEvent.rb
34
+ - lib/apollo_commons_ruby/ExecuteCommand.rb
35
+ - lib/apollo_commons_ruby/FileUtils.rb
36
+ - lib/apollo_commons_ruby/MarioConfigsStability.rb
37
+ - lib/apollo_commons_ruby/MarioEvent.rb
38
+ - lib/apollo_commons_ruby/NetworkUtils.rb
39
+ - lib/apollo_commons_ruby/Operation.rb
40
+ - lib/apollo_commons_ruby/Permission.rb
41
+ - lib/apollo_commons_ruby/RequestDataUtils.rb
42
+ - lib/apollo_commons_ruby/ResolveTemplate.rb
43
+ - lib/apollo_commons_ruby/SecretConfig.rb
44
+ - lib/apollo_commons_ruby/ShopHook.rb
45
+ - lib/apollo_commons_ruby/TemplateDebug.rb
46
+ - lib/apollo_commons_ruby/TemplatePusher.rb
47
+ - lib/apollo_commons_ruby/TemplatesHelper.rb
48
+ - lib/apollo_commons_ruby/TemplatesRakefile.rb
49
+ - lib/apollo_commons_ruby/TenantInfo.rb
50
+ - lib/apollo_commons_ruby/TenantTokenCreator.rb
51
+ - lib/apollo_commons_ruby/VerifyMarioConfig.rb
52
+ - lib/apollo_commons_ruby/ViewGroup.rb
53
+ - lib/apollo_commons_ruby/ViewGroupComponent.rb
54
+ - lib/apollo_commons_ruby/ViewGroupDefinition.rb
55
+ - lib/apollo_commons_ruby/WebhookReporting.rb
56
+ - lib/apollo_commons_ruby/Zebugger.rb
57
+ - lib/jar/v1_atroposDevTools.jar
58
+ - lib/tasks/add_translations.rake
59
+ - lib/tasks/backfill_sample_data.rake
60
+ - lib/tasks/checkValidJson.rake
61
+ - lib/tasks/delete_domain_event.rake
62
+ - lib/tasks/delete_view_group.rake
63
+ - lib/tasks/delete_view_group_component.rake
64
+ - lib/tasks/delete_view_group_definition.rake
65
+ - lib/tasks/deploy_all_templates.rake
66
+ - lib/tasks/deploy_permissions.rake
67
+ - lib/tasks/deploy_shophooks.rake
68
+ - lib/tasks/display_on_zebugger.rake
69
+ - lib/tasks/get_tenant_token.rake
70
+ - lib/tasks/runTests.rake
71
+ - lib/tasks/template_debug.rake
72
+ - lib/tasks/update_all.rake
73
+ - lib/tasks/update_all_domain_events.rake
74
+ - lib/tasks/update_all_view_group_components.rake
75
+ - lib/tasks/update_domain_event.rake
76
+ - lib/tasks/update_one_template.rake
77
+ - lib/tasks/update_translations.rake
78
+ - lib/tasks/update_view_group_component.rake
79
+ - lib/tasks/update_view_group_definition.rake
80
+ - lib/tasks/update_view_group_for_user_0.rake
81
+ - lib/tasks/validate_mario_configs.rake
82
+ - lib/tasks/verify_mario_config.rake
83
+ - lib/version.rb
84
+ homepage: https://bitbucket.org/zetaengg/apollo_commons_ruby/src
85
+ licenses: []
86
+ metadata:
87
+ homepage_uri: https://bitbucket.org/zetaengg/apollo_commons_ruby/src
88
+ source_code_uri: https://bitbucket.org/zetaengg/apollo_commons_ruby/src
89
+ changelog_uri: https://bitbucket.org/zetaengg/apollo_commons_ruby/src
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 2.3.0
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.0.6
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Ruby utilities for apollo projects
109
+ test_files: []