brpm_content_framework 0.2.18 → 0.2.19

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjY5YmEwNzU4M2E3NjI1ZGRlZWU3YTBiZWQxMjM2ZTNhZmM5NGY4YQ==
4
+ ZjQ0NmNiYWVkNjcyYTU4MTgwNDhjODM1ZjEwMjkzN2VjY2EyYTllMg==
5
5
  data.tar.gz: !binary |-
6
- MjExNWRhNDA4OTNiZjUwMzZjMjY2Mzk3OGU1NmJhODJkNTU2ODkwOA==
6
+ ZmZiMGUyNTY1OTE5YjgwNWM5YTA5NTRhY2NiZGFkYmIzMGZhMTBkMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDM0NzVjZjY0YTA3MmQ4MmNlZDZjZDM2MzNjOGExMWQ0YjNmZTM3MzNjMDhl
10
- ZWNmNTEyOGM1NWM5ZmQ0M2QzYmFlMjFkNTg4ZjAwNDY3NjYwOTRmNmYzMzYy
11
- OTE0OGEzMWUxOGYzZmU3MDAzZDQzMDUwZGVmOGYzMjc2NjdkMTk=
9
+ NjY0NWYzM2JiMTY2OTI2M2Q0OTQ5YjI1YTU4ZmQzOThkN2RmODMyZTkyODY3
10
+ OGMzYzg1YmNhZmZiM2YzZTZhYWRhOTVhNzQzNDhkMzQ1NTg5MjA0OTE5YThj
11
+ YWM0OGExOGZkNTdjZDRiZDIxMTNmMWE2YTQyNzJjOTliNGU2MTc=
12
12
  data.tar.gz: !binary |-
13
- MGNkYjI3MmFkMTcyZWY2ZjM2M2VlMjIwNWY3NDA4N2YyNmIxZTdhNGQ1Mjcy
14
- YmIyZjU2ZWJlMmEyMDRmNzc0MzM3YjQ4MGUxMDliZGU3ZTIxMGM3MzRmNDA5
15
- MGFkNTE2OTE1ZDg2MDE1Yzc4NTk2NTdiOGI3MTQxMDRlMjA4ZjU=
13
+ ZDA0NTljY2YzN2M1M2I1YzEwZGNhOTBjOWVmNTNiN2YzYWYyODM2ZjVjZDFk
14
+ YTlmNWYxMGU3YzQzMzkzYWYyYjAzYzllMDMyMWNlMDI2Yzg4ZTM5OTIzMTRm
15
+ ZWZmNGMyOWE4ODRlNzZiNDcwZGM0NGIwOGZmZmM2OTJiYzE5OGI=
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.18
1
+ version: 0.2.19
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -6,19 +6,28 @@ class BrpmScriptExecutor
6
6
  private_class_method :new
7
7
 
8
8
  class << self
9
- def execute_automation_script_in_separate_process(modul, name, params)
10
- execute_automation_script_in_separate_process_internal(modul, name, params, "automation")
9
+ def execute_automation_script(modul, name, params, in_separate_process = nil)
10
+ execute_automation_script_internal(modul, name, params, "automation", in_separate_process)
11
11
  end
12
12
 
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)
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)
15
15
  end
16
16
 
17
- def execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
17
+ def execute_automation_script_internal(modul, name, params, automation_type, in_separate_process = nil, 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..."
21
20
 
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)
22
31
  env_vars = {}
23
32
  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/)
24
33
  env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
@@ -99,7 +108,7 @@ class BrpmScriptExecutor
99
108
  load File.expand_path("#{File.dirname(__FILE__)}/../infrastructure/create_output_file.rb")
100
109
  end
101
110
 
102
- result = execute_automation_script_internal(modul, name, params, automation_type, parent_id, offset, max_records)
111
+ result = execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
103
112
  if automation_type == "resource_automation"
104
113
  result_file = "#{File.dirname(params_file)}/result_#{Process.pid}.yml"
105
114
  BrpmAuto.log " Temporarily storing the result to #{result_file}..."
@@ -110,18 +119,8 @@ class BrpmScriptExecutor
110
119
  end
111
120
  end
112
121
 
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)
122
+ def execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
122
123
  begin
123
- BrpmAuto.setup(params)
124
-
125
124
  BrpmAuto.log ""
126
125
  BrpmAuto.log ">>>>>>>>>>>>>> START #{automation_type} #{modul} #{name}"
127
126
  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_in_separate_process("#{module_name}", "#{auto_script_name}", params)
542
+ BrpmScriptExecutor.execute_automation_script("#{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_in_separate_process("#{module_name}", "#{auto_script_name}", 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)
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_in_separate_process("brpm_module_test", "test_ruby", get_default_params)
38
+ result = BrpmScriptExecutor.execute_automation_script("brpm_module_test", "test_ruby", get_default_params, true)
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_in_separate_process(@module_name, "test_ruby", get_default_params)
49
+ result = BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby", get_default_params, true)
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_in_separate_process(@module_name, "xxx", get_default_params)}.to raise_exception
56
+ expect{BrpmScriptExecutor.execute_automation_script(@module_name, "xxx", get_default_params, true)}.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_in_separate_process(@module_name, "test_ruby_raises_error", get_default_params)}.to raise_exception
60
+ expect{BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby_raises_error", get_default_params, true)}.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_in_separate_process(@module_name, "test_resource", get_default_params, nil, 0, 10)
64
+ result = BrpmScriptExecutor.execute_resource_automation_script(@module_name, "test_resource", get_default_params, true, nil, 0, 10)
65
65
 
66
66
  expect(result.count).to eql(3)
67
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.18
4
+ version: 0.2.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-13 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client