bpm_manager 0.0.1
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 +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +7 -0
- data/bpm_manager.gemspec +26 -0
- data/lib/bpm_manager.rb +47 -0
- data/lib/bpm_manager/version.rb +3 -0
- data/lib/generators/bpm_manager/bpm_manager.rb +16 -0
- data/lib/generators/bpm_manager/install_generator.rb +15 -0
- data/spec/server_spec.rb +50 -0
- data/spec/spec_helper.rb +14 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86e2d7be28e92c98e16c7a87d6c43f9cc81597b2
|
4
|
+
data.tar.gz: b023acd44fd86133128e60d23a4810947713de53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c68a47b9fdcec254f2d0b61f587799b28dd46def9f207ac5428fbf2ce577da9a890bca28d9125bcde1d1354395d188e800cbaf4ffa29ddf2aaaf3d675cf3f119
|
7
|
+
data.tar.gz: d1d3be8b7383dff84aedebee80e2267cf6aab9ebcd03d677be443a904f846b38baba7f0003bc6104895abce06ac6e84c3af6309e90641b3f3479e417657e7ba3
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Ariel Presa
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# BeatCoding BPM Manager Gem
|
2
|
+
BPM Manager Gem for RedHat jBPM & Oracle BPM engines
|
3
|
+
|
4
|
+
Feel free to fork, contribute & distribute
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'bpm_manager'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle install
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install bpm_manager
|
21
|
+
|
22
|
+
Also do not forget to execute the initializer with:
|
23
|
+
|
24
|
+
$ rails generate bpm_manager:install
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
1. First configure properly the gem using the bpm_manager.rb file in 'config/initializers/bpm_manager.rb'
|
29
|
+
2. Assign the Server with:
|
30
|
+
|
31
|
+
$ @server = BpmManager.new
|
32
|
+
|
33
|
+
3. Make a call:
|
34
|
+
|
35
|
+
$ result = @server.get_deployments()
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/BeatCoding/bpm_manager/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bpm_manager.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bpm_manager/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bpm_manager"
|
8
|
+
spec.version = BpmManager::VERSION
|
9
|
+
spec.authors = ["Ariel Presa"]
|
10
|
+
spec.email = ["arielpresa@gmail.com"]
|
11
|
+
spec.summary = %q{BPM Manager Gem for RedHat jBPM & Oracle BPM engines.}
|
12
|
+
spec.description = %q{Simple BPM integration with RedHat jBPM & Oracle BPM engines. Use this gem to avoid REST calls in your code. Enjoy.}
|
13
|
+
spec.homepage = "http://www.beatcoding.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rest-client"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
end
|
data/lib/bpm_manager.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
require "bpm_manager/version"
|
2
|
+
require "rest-client"
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module BpmManager
|
6
|
+
class Server
|
7
|
+
@valid_config_keys = @config
|
8
|
+
|
9
|
+
# Initializes the defaults
|
10
|
+
def initialize
|
11
|
+
@config = {
|
12
|
+
:bpm_vendor => "RedHat",
|
13
|
+
:bpm_url => "bpm.beatcoding.com",
|
14
|
+
:bpm_username => "Administrator",
|
15
|
+
:bpm_password => "bc-power",
|
16
|
+
:bpm_use_ssl => false,
|
17
|
+
:time_stamp => Time.now.to_i }
|
18
|
+
|
19
|
+
raise LoadError 'BpmManager Gem Configuration file has errors' if @config.values.any?{|v| v.nil?}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Configure through hash
|
23
|
+
def configure(opts = {})
|
24
|
+
opts.each{ |k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns the configuration hash
|
28
|
+
def config
|
29
|
+
@config
|
30
|
+
end
|
31
|
+
|
32
|
+
# Returns the URI for the server plus a suffix
|
33
|
+
def uri(suffix)
|
34
|
+
case @config[:bpm_vendor]
|
35
|
+
when 'RedHat'
|
36
|
+
URI.encode('http' + (@config[:bpm_use_ssl] ? 's' : '') + '://' + @config[:bpm_username] + ':' + @config[:bpm_password] + '@' + @config[:bpm_url] + '/business-central/rest' + (suffix.nil? ? '' : suffix))
|
37
|
+
else
|
38
|
+
''
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Gets all server deployments
|
43
|
+
def deployments()
|
44
|
+
return JSON.parse(RestClient.get(uri('/deployment'), :accept => :json))
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
BpmManager.configure do |config|
|
2
|
+
# Sets the BPM engine vendor [RedHat || Oracle]
|
3
|
+
config.bpm_vendor = "RedHat"
|
4
|
+
|
5
|
+
# Sets the BPM url address without http:// or https://
|
6
|
+
config.bpm_url = "bpm.company.com"
|
7
|
+
|
8
|
+
# Sets the BPM connection username
|
9
|
+
config.bpm_username = "scott"
|
10
|
+
|
11
|
+
# Sets the BPM connection password
|
12
|
+
config.bpm_password = "tiger"
|
13
|
+
|
14
|
+
# Turns on|off the SSL protocol for the server (false is default)
|
15
|
+
config.bpm_use_ssl = false
|
16
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module BpmManager
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
5
|
+
desc "Generates the BpmManager configuration file"
|
6
|
+
|
7
|
+
def self.source_root
|
8
|
+
@source_root ||= File.expand_path(File.dirname(__FILE__))
|
9
|
+
end
|
10
|
+
|
11
|
+
def copy_initializer
|
12
|
+
copy_file 'bpm_manager.rb', 'config/initializers/bpm_manager.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/server_spec.rb
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "#uri" do
|
4
|
+
before :each do
|
5
|
+
@server = BpmManager::Server.new()
|
6
|
+
@uri = @server.uri('/test')
|
7
|
+
end
|
8
|
+
|
9
|
+
it "expect to be a String" do
|
10
|
+
expect(@uri).to be_an_instance_of String
|
11
|
+
end
|
12
|
+
|
13
|
+
it "expect to not be nil" do
|
14
|
+
expect(@uri).not_to eq(nil)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#config" do
|
19
|
+
before :each do
|
20
|
+
@server = BpmManager::Server.new
|
21
|
+
@config = @server.config()
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should be a Hash" do
|
25
|
+
expect(@config).to be_an_instance_of Hash
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should not be empty' do
|
29
|
+
expect(@config.length).to be > 0
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'must have all the keys' do
|
33
|
+
expect(@config.has_key? :bpm_vendor).to be true
|
34
|
+
expect(@config.has_key? :bpm_url).to be true
|
35
|
+
expect(@config.has_key? :bpm_username).to be true
|
36
|
+
expect(@config.has_key? :bpm_password).to be true
|
37
|
+
expect(@config.has_key? :bpm_use_ssl).to be true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "#deployments" do
|
42
|
+
before :each do
|
43
|
+
@server = BpmManager::Server.new()
|
44
|
+
@deployments = @server.deployments()
|
45
|
+
end
|
46
|
+
|
47
|
+
it "must return something" do
|
48
|
+
expect(@deployments.length).to be > 0
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'bpm_manager'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.expect_with :rspec do |expectations|
|
8
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
9
|
+
end
|
10
|
+
|
11
|
+
config.mock_with :rspec do |mocks|
|
12
|
+
mocks.verify_partial_doubles = true
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bpm_manager
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ariel Presa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Simple BPM integration with RedHat jBPM & Oracle BPM engines. Use this
|
70
|
+
gem to avoid REST calls in your code. Enjoy.
|
71
|
+
email:
|
72
|
+
- arielpresa@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bpm_manager.gemspec
|
83
|
+
- lib/bpm_manager.rb
|
84
|
+
- lib/bpm_manager/version.rb
|
85
|
+
- lib/generators/bpm_manager/bpm_manager.rb
|
86
|
+
- lib/generators/bpm_manager/install_generator.rb
|
87
|
+
- spec/server_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: http://www.beatcoding.com
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.4.2
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: BPM Manager Gem for RedHat jBPM & Oracle BPM engines.
|
113
|
+
test_files:
|
114
|
+
- spec/server_spec.rb
|
115
|
+
- spec/spec_helper.rb
|