brpm_content_framework 0.2.19 → 0.2.20

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
- ZjQ0NmNiYWVkNjcyYTU4MTgwNDhjODM1ZjEwMjkzN2VjY2EyYTllMg==
4
+ ZWUyMmVmZGY2NmJjMzIzZTJiNjcyZTJiZTA1NDc0YzMyZTQzMTEzNA==
5
5
  data.tar.gz: !binary |-
6
- ZmZiMGUyNTY1OTE5YjgwNWM5YTA5NTRhY2NiZGFkYmIzMGZhMTBkMg==
6
+ YmJlZjRhMGM1ZTFiMjY4ZDBjZWU2MjQ5YzkxNGZkNDliYTgzM2Y0Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjY0NWYzM2JiMTY2OTI2M2Q0OTQ5YjI1YTU4ZmQzOThkN2RmODMyZTkyODY3
10
- OGMzYzg1YmNhZmZiM2YzZTZhYWRhOTVhNzQzNDhkMzQ1NTg5MjA0OTE5YThj
11
- YWM0OGExOGZkNTdjZDRiZDIxMTNmMWE2YTQyNzJjOTliNGU2MTc=
9
+ MjUyNDJmYzJiZDdiODUxNjc0ODVjOGM3ODk5ZGQ4NGY5YTg1MWRiNDcyMjc0
10
+ MjYzNDcxODc0ZWZiNGI3YzY2ZDA1YTNjYjVmODhjZDY1OGI2MTQxMWYwYmRi
11
+ MmJjZjg2MzBhNjQxY2Q4ZTljYWQ1MjBhZDRmYWZlZmVhYTBlOTc=
12
12
  data.tar.gz: !binary |-
13
- ZDA0NTljY2YzN2M1M2I1YzEwZGNhOTBjOWVmNTNiN2YzYWYyODM2ZjVjZDFk
14
- YTlmNWYxMGU3YzQzMzkzYWYyYjAzYzllMDMyMWNlMDI2Yzg4ZTM5OTIzMTRm
15
- ZWZmNGMyOWE4ODRlNzZiNDcwZGM0NGIwOGZmZmM2OTJiYzE5OGI=
13
+ OTJhOWMxY2RmMzlkMGU5Nzk5YWRlY2I4NWI4MmEyODYyZjVkZGIwMzBkOGM1
14
+ MjVmYjY0YmJkOWVmNmQxMzNhMGMwZmZkNTE4ODc0OTBhOTEwMDc4YWVlOWFj
15
+ YTMyMTg0MDE1MDFmNjY4MjliN2UyOWM2ZDM4NTdmNDM1NjBkNDM=
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.19
1
+ version: 0.2.20
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -6,28 +6,19 @@ class BrpmScriptExecutor
6
6
  private_class_method :new
7
7
 
8
8
  class << self
9
- def execute_automation_script(modul, name, params, in_separate_process = nil)
10
- execute_automation_script_internal(modul, name, params, "automation", in_separate_process)
9
+ def execute_automation_script_in_separate_process(modul, name, params)
10
+ execute_automation_script_in_separate_process_internal(modul, name, params, "automation")
11
11
  end
12
12
 
13
- def execute_resource_automation_script(modul, name, params, in_separate_process = nil, parent_id, offset, max_records)
14
- execute_automation_script_internal(modul, name, params, "resource_automation", in_separate_process, parent_id, offset, max_records)
13
+ def execute_resource_automation_script_in_separate_process(modul, name, params, parent_id, offset, max_records)
14
+ execute_automation_script_in_separate_process_internal(modul, name, params, "resource_automation", parent_id, offset, max_records)
15
15
  end
16
16
 
17
- def execute_automation_script_internal(modul, name, params, automation_type, in_separate_process = nil, parent_id = nil, offset = nil, max_records = nil)
17
+ def execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
18
18
  BrpmAuto.setup(params)
19
19
  BrpmAuto.log ""
20
+ BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in a separate process..."
20
21
 
21
- if in_separate_process || BrpmAuto.params["execute_automations_in_separate_process"]
22
- BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in a separate process..."
23
- execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
24
- else
25
- BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in-process..."
26
- execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
27
- end
28
- end
29
-
30
- def execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
31
22
  env_vars = {}
32
23
  env_vars["JRUBY_OPTS"] = "-Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF" # improve jvm startup time (see http://rexchung.com/2013/08/02/speed-up-jruby-rails-startup-time/)
33
24
  env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
@@ -108,7 +99,7 @@ class BrpmScriptExecutor
108
99
  load File.expand_path("#{File.dirname(__FILE__)}/../infrastructure/create_output_file.rb")
109
100
  end
110
101
 
111
- result = execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
102
+ result = execute_automation_script_internal(modul, name, params, automation_type, parent_id, offset, max_records)
112
103
  if automation_type == "resource_automation"
113
104
  result_file = "#{File.dirname(params_file)}/result_#{Process.pid}.yml"
114
105
  BrpmAuto.log " Temporarily storing the result to #{result_file}..."
@@ -119,8 +110,18 @@ class BrpmScriptExecutor
119
110
  end
120
111
  end
121
112
 
122
- def execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
113
+ def execute_automation_script(modul, name, params)
114
+ execute_automation_script_internal(modul, name, params, "automation")
115
+ end
116
+
117
+ def execute_resource_automation_script(modul, name, params, parent_id, offset, max_records)
118
+ execute_automation_script_internal(modul, name, params, "resource_automation", parent_id, offset, max_records)
119
+ end
120
+
121
+ def execute_automation_script_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
123
122
  begin
123
+ BrpmAuto.setup(params)
124
+
124
125
  BrpmAuto.log ""
125
126
  BrpmAuto.log ">>>>>>>>>>>>>> START #{automation_type} #{modul} #{name}"
126
127
  start_time = Time.now
@@ -539,7 +539,7 @@ EOR
539
539
  template += <<EOR
540
540
  require "\#{ENV["BRPM_CONTENT_HOME"] || "\#{ENV["BRPM_HOME"]}/modules"}/gems/brpm_content_framework-\#{params["framework_version"] || "latest"}/lib/brpm_script_executor.rb"
541
541
 
542
- BrpmScriptExecutor.execute_automation_script("#{module_name}", "#{auto_script_name}", params)
542
+ BrpmScriptExecutor.execute_automation_script_in_separate_process("#{module_name}", "#{auto_script_name}", params)
543
543
  EOR
544
544
 
545
545
  elsif automation_type == "ResourceAutomation"
@@ -548,7 +548,7 @@ EOR
548
548
  load "\#{ENV["BRPM_CONTENT_HOME"] || "\#{ENV["BRPM_HOME"]}/modules"}/gems/brpm_content_framework-\#{params["framework_version"] || "latest"}/lib/brpm_script_executor.rb"
549
549
 
550
550
  def execute(script_params, parent_id, offset, max_records)
551
- BrpmScriptExecutor.execute_resource_automation_script("#{module_name}", "#{auto_script_name}", script_params, parent_id, offset, max_records)
551
+ BrpmScriptExecutor.execute_resource_automation_script_in_separate_process("#{module_name}", "#{auto_script_name}", script_params, parent_id, offset, max_records)
552
552
  end
553
553
  EOR
554
554
  end
@@ -35,7 +35,7 @@ describe 'BRPM Script Executor' do
35
35
  # Note: the following tests will run the automation scripts in a separate process and will therefore use an already installed brpm_content_framework module,
36
36
  # either the version from their Gemfile/Gemfile.lock or the latest, but not the one from source code
37
37
  it "should execute an automation script in a separate process inside a bundler context" do
38
- result = BrpmScriptExecutor.execute_automation_script("brpm_module_test", "test_ruby", get_default_params, true)
38
+ result = BrpmScriptExecutor.execute_automation_script_in_separate_process("brpm_module_test", "test_ruby", get_default_params)
39
39
 
40
40
  expect(result).to be_truthy
41
41
  end
@@ -46,22 +46,22 @@ describe 'BRPM Script Executor' do
46
46
  gemfile_path = "#{module_gem_path}/Gemfile"
47
47
 
48
48
  FileUtils.move(gemfile_path, "#{gemfile_path}_tmp")
49
- result = BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby", get_default_params, true)
49
+ result = BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "test_ruby", get_default_params)
50
50
  FileUtils.move("#{gemfile_path}_tmp", gemfile_path)
51
51
 
52
52
  expect(result).to be_truthy
53
53
  end
54
54
 
55
55
  it "should return false when executing an non-existing automation script in a separate process" do
56
- expect{BrpmScriptExecutor.execute_automation_script(@module_name, "xxx", get_default_params, true)}.to raise_exception
56
+ expect{BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "xxx", get_default_params)}.to raise_exception
57
57
  end
58
58
 
59
59
  it "should return false when executing an erroneous automation script in a separate process" do
60
- expect{BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby_raises_error", get_default_params, true)}.to raise_exception
60
+ expect{BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "test_ruby_raises_error", get_default_params)}.to raise_exception
61
61
  end
62
62
 
63
63
  it "should execute a resource automation script in a separate process" do
64
- result = BrpmScriptExecutor.execute_resource_automation_script(@module_name, "test_resource", get_default_params, true, nil, 0, 10)
64
+ result = BrpmScriptExecutor.execute_resource_automation_script_in_separate_process(@module_name, "test_resource", get_default_params, nil, 0, 10)
65
65
 
66
66
  expect(result.count).to eql(3)
67
67
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus