capistrano-karaf 1.0.0
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.
- data/lib/capistrano-karaf.rb +82 -0
- metadata +46 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'capistrano'
|
2
|
+
|
3
|
+
def with_karaf (params={}, &block)
|
4
|
+
params = { :username => 'smx',
|
5
|
+
:password => 'smx',
|
6
|
+
:port => 8101 }.merge(params)
|
7
|
+
|
8
|
+
unless self[:username] == params[:username]
|
9
|
+
set :port, params[:port]
|
10
|
+
set :user, params[:username]
|
11
|
+
set :password, params[:password]
|
12
|
+
close_sessions
|
13
|
+
end
|
14
|
+
|
15
|
+
yield
|
16
|
+
end
|
17
|
+
|
18
|
+
def close_sessions
|
19
|
+
sessions.values.each {|session| session.close}
|
20
|
+
sessions.clear
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def add_url (url, params={})
|
25
|
+
with_karaf params do
|
26
|
+
run "features:addurl #{url}", {:shell => false}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove_url (url, params={})
|
31
|
+
with_karaf params do
|
32
|
+
run "features:removeurl #{url}", {:shell => false}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def feature_install (name, params={})
|
37
|
+
with_karaf params do
|
38
|
+
run "features:install #{name}", {:shell => false, :pty => true}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def feature_uninstall (name, params={})
|
43
|
+
with_karaf params do
|
44
|
+
run "features:uninstall #{name}", {:shell => false}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def list_bundles (params = {})
|
49
|
+
bundle_line_matcher = /^\[(?<BundleId>[ \d]+)\] \[(?<BundleStatus>[ \w]+)\] \[[ ]*\] \[(?<ContextStatus>[ \w]+)\] \[(?<BundleLevel> [ \d]+)\] (?<BundleName>[\w\-\:]+) \((?<BundleVersion>.+)\)/
|
50
|
+
|
51
|
+
with_karaf params do
|
52
|
+
run "list" do |_, _, data|
|
53
|
+
bundles = []
|
54
|
+
data.lines.each do |line|
|
55
|
+
m = bundle_line_matcher.match(line)
|
56
|
+
if m then
|
57
|
+
bundles.push({ :id => m['BundleId'],
|
58
|
+
:status => m['BundleStatus'],
|
59
|
+
:context => m['ContextStatus'],
|
60
|
+
:level => m['BundleLevel'],
|
61
|
+
:name => m['BundleName'],
|
62
|
+
:version => m['BundleVersion']
|
63
|
+
})
|
64
|
+
end
|
65
|
+
end
|
66
|
+
bundles
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def started? (name, params={})
|
72
|
+
bundle = list_bundles.find {|b| b[:name] == name}
|
73
|
+
bundle[0][:context] == 'Started'
|
74
|
+
end
|
75
|
+
|
76
|
+
def list (params={})
|
77
|
+
with_karaf params do
|
78
|
+
run "features:list", {:shell => false}
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: capistrano-karaf
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brecht Hoflack
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description:
|
15
|
+
email: brecht.hoflack@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- lib/capistrano-karaf.rb
|
21
|
+
homepage: http://github.com/bhoflack/capistrano-karaf
|
22
|
+
licenses:
|
23
|
+
- bsd
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 1.8.23
|
43
|
+
signing_key:
|
44
|
+
specification_version: 3
|
45
|
+
summary: Capistrano functions for communicating with karaf
|
46
|
+
test_files: []
|