brpm_content_framework 0.2.23 → 0.2.24

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
- ZDVkOWNjZTU4NGY5ZmIzZmIxNmIzOTIxOTYzMmEzYmQwMTJkZWJmYw==
4
+ YzViYmI0MTk3MjM1MThmZGFkNTQ5YjQ4NDBkMjZhNDQ3N2M3MDkyMg==
5
5
  data.tar.gz: !binary |-
6
- Mzc0NTM4ODM1OWQwMTRhOTBmYThkNjgyZWNjNjI1YjE2YTczNjhmYw==
6
+ ODNmZmEwMzM3ZmY1N2Q4YjM4MTFjNTYxYjE3NjNmNGY0OTI1MDQ2Mw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDRkZDIyMTA4ZjNmOTEzZmNiMzAzZDI3ZGYxN2IyNmE4ZDQzMGEyNzhmNWQ2
10
- ZDMyNjdiMmE5MTQ2NzgxNjYwYTE4YmMxMTk3MzIwMmRjZGIzNWFmMmYwMjFk
11
- NDIzNWExZTM0ODc2ZDk3MjRmNzNiNzE1NjNmOGMyYjg4ZGU4M2E=
9
+ NmI0NGM5ZjMwOWZhNmQzMDMxZjJkOWJlZGMzOTk1Y2NlYWRkNGExN2M5MmJh
10
+ NjFhODEwMTM2NWU0NWNjODFjYjIyYmRkZDk2NGFjOTM0ZGUzOTg5YTlkNTZl
11
+ MjcwMDliZGNiNTE2YzVjYWYxZWFmMjAyYTUyZjQxNTdkMTBjYTM=
12
12
  data.tar.gz: !binary |-
13
- N2RiMjMzNmQ2OTE3YWUzZTZjODk0YTljNDdiMmNmY2VkYWFiYjAwYWZiYzU0
14
- MjExYTY2NTA5NjIxZTJmZDc2YTQ2NzAzMjNlNTc1NzAyMWY1YzNiODJlNDFk
15
- ODE4ZDk1YjcxODFiMTc3M2YwZWM3NzNkYTlmZjdlYTlmZDc0MTE=
13
+ ZDNjZWNjYTk1M2ExYzZlZDQ0MjUwM2NkMzA3ZDBjOWJhYTZjMTVlMWExMmFk
14
+ ZjE4MDBkODBmNzQyZGU5YzQyODk1NjIwMGNkNDg3OGQ4ZTIxN2Y0YzY4NzUz
15
+ NWZkY2UwYmE0YTNlNDM4M2NjN2NkOTk0ZWM1MGMzOTMxOGEzMzQ=
data/bin/event_handler CHANGED
@@ -1,7 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'torquebox'
4
- require 'torquebox-messaging'
2
+ require 'stomp'
5
3
  require 'xmlsimple'
6
4
  require "brpm_script_executor"
7
5
 
@@ -12,47 +10,39 @@ port = ENV["EVENT_HANDLER_MESSAGING_PORT"]
12
10
  username = ENV["EVENT_HANDLER_MESSAGING_USERNAME"]
13
11
  password = ENV["EVENT_HANDLER_MESSAGING_PASSWORD"]
14
12
  process_event_script = ENV["EVENT_HANDLER_PROCESS_EVENT_SCRIPT"]
13
+ messaging_path = "jms.topic./topics/messaging/brpm_event_queue"
15
14
 
16
15
  require process_event_script
17
16
 
18
- class MessagingProcessor < TorqueBox::Messaging::MessageProcessor
17
+ def process(message)
18
+ begin
19
+ BrpmAuto.log "Processing new event..."
20
+ BrpmAuto.log "Message content:" if ENV["EVENT_HANDLER_LOG_EVENT"]=="1"
21
+ BrpmAuto.log message if ENV["EVENT_HANDLER_LOG_EVENT"]=="1"
22
+ xml = "<root>#{message}</root>"
19
23
 
20
- MESSAGING_PATH = '/topics/messaging/brpm_event_queue'
24
+ event = XmlSimple.xml_in(xml)
21
25
 
22
- def initialize(host, port, username, password)
23
- BrpmAuto.log "Initializing the message processor..."
24
- @destination = TorqueBox::Messaging::Topic.new(
25
- MESSAGING_PATH,
26
- :host => host,
27
- :port => port,
28
- :username => username,
29
- :password => password
30
- )
31
- end
32
-
33
- def run
34
- begin
35
- xml = "<root>#{@destination.receive}</root>"
26
+ process_event(event)
36
27
 
37
- BrpmAuto.log "Processing new event..."
38
- BrpmAuto.log xml if ENV["EVENT_HANDLER_LOG_EVENT"]=="1"
28
+ rescue Exception => e
29
+ BrpmAuto.log_error(e)
30
+ BrpmAuto.log "\n\t" + e.backtrace.join("\n\t")
31
+ end
32
+ end
39
33
 
40
- event = XmlSimple.xml_in(xml)
34
+ begin
41
35
 
42
- process_event(event)
36
+ BrpmAuto.log "Connecting to the BRPM event system ..."
37
+ client = Stomp::Client.new username, password, host, port, true
43
38
 
44
- rescue Exception => e
45
- BrpmAuto.log_error(e)
46
- BrpmAuto.log "\n\t" + e.backtrace.join("\n\t")
47
- end
39
+ BrpmAuto.log "Subscribing to the BRPM event queue ..."
40
+ client.subscribe messaging_path do |message|
41
+ process(Marshal.load(message.body))
48
42
  end
49
- end
50
43
 
51
- begin
52
- consumer = MessagingProcessor.new(host, port, username, password)
53
- BrpmAuto.log "Starting to listen for events ..."
54
44
  loop do
55
- consumer.run
45
+ sleep 1
56
46
  end
57
47
 
58
48
  rescue Exception => e
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.23
1
+ version: 0.2.24
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -1,4 +1,11 @@
1
1
  #!/bin/bash
2
+ # temporarily link it to the jruby platform because we depend on torquebox to receive the messages
3
+ export JAVA_HOME="$BRPM_HOME/lib/jre"
4
+ export JRUBY_HOME="$BRPM_HOME/lib/jruby"
5
+ export GEM_HOME="$BRPM_HOME/modules"
6
+
7
+ export PATH="$GEM_HOME/bin:$JRUBY_HOME/bin:$PATH"
8
+
2
9
  # mandatory settings
3
10
  export EVENT_HANDLER_BRPM_HOST=localhost
4
11
 
@@ -11,5 +11,5 @@ set WEBHOOK_RECEIVER_BRPM_PORT=8080
11
11
  set WEBHOOK_RECEIVER_BRPM_TOKEN=???
12
12
  set WEBHOOK_RECEIVER_JIRA_RELEASE_FIELD_ID=???
13
13
 
14
- jruby -J-Djava.library.path= webhook_receiver
14
+ webhook_receiver
15
15
 
@@ -12,4 +12,4 @@ export WEBHOOK_RECEIVER_BRPM_PORT=8088
12
12
  export WEBHOOK_RECEIVER_BRPM_TOKEN=???
13
13
  export WEBHOOK_RECEIVER_JIRA_RELEASE_FIELD_ID=???
14
14
 
15
- jruby -J-Djava.library.path= $(which webhook_receiver)
15
+ webhook_receiver
@@ -20,7 +20,6 @@ class BrpmScriptExecutor
20
20
  BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in a separate process..."
21
21
 
22
22
  env_vars = {}
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/)
24
23
  env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
25
24
 
26
25
  BrpmAuto.log "Finding the module path..."
@@ -59,7 +58,7 @@ class BrpmScriptExecutor
59
58
  end
60
59
 
61
60
  BrpmAuto.log "Executing the script in a separate process..."
62
- return_value = Bundler.clean_system(env_vars, RbConfig.ruby, "-e", "#{require_bundler}require 'brpm_script_executor'; BrpmScriptExecutor.execute_automation_script_from_other_process(\"#{modul}\", \"#{name}\", \"#{params_file}\", \"#{automation_type}\", \"#{parent_id}\", \"#{offset}\", \"#{max_records}\")")
61
+ return_value = Bundler.clean_system(env_vars, "ruby", "-e", "#{require_bundler}require 'brpm_script_executor'; BrpmScriptExecutor.execute_automation_script_from_other_process(\"#{modul}\", \"#{name}\", \"#{params_file}\", \"#{automation_type}\", \"#{parent_id}\", \"#{offset}\", \"#{max_records}\")")
63
62
  FileUtils.rm(params_file) if File.exists?(params_file)
64
63
  if return_value.nil?
65
64
  message = "The process that executed the automation script returned with 'Command execution failed'."
data/module.gemspec CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.required_rubygems_version = ">= 2.1.9"
17
17
 
18
+ spec.add_runtime_dependency "bundler"
18
19
  spec.add_runtime_dependency "rest-client"
19
20
  spec.add_runtime_dependency "json"
20
21
  spec.add_runtime_dependency "savon", '~>1.1.0'
@@ -23,6 +24,9 @@ Gem::Specification.new do |spec|
23
24
  spec.add_development_dependency "rake"
24
25
  spec.add_development_dependency "rspec"
25
26
 
27
+ spec.add_development_dependency "stomp"
28
+ spec.add_development_dependency "xml-simple"
29
+
26
30
  spec.files = `git ls-files`.split("\n")
27
31
  spec.require_path = 'lib'
28
32
 
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.23
4
+ version: 0.2.24
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-15 00:00:00.000000000 Z
11
+ date: 2015-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rest-client
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +108,34 @@ dependencies:
94
108
  - - ! '>='
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: stomp
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: xml-simple
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
97
139
  description: The BRPM Content Framework is a lightweight framework that allows to
98
140
  run automation logic on top of BRPM in a modular, re-usable, testable and developer-friendly
99
141
  way