capistrano-karaf 1.0.0 → 1.1.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.
- checksums.yaml +7 -0
- data/lib/capistrano-karaf.rb +77 -58
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fdd56615ed6078429913010f47255f2bae3c7492
|
4
|
+
data.tar.gz: ae7ff71216a4f651322ede1ebc98c63ccfc2d763
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 598b1266d1c1663e2961114f6e611cf045da453126be269dfd321eb5d5c651e6bec04b2102d459d9e8af2dacaa3ea4948ab4be91b43201c0744693d5cd7c9ef2
|
7
|
+
data.tar.gz: 84801dcb29581e76771bf38a05e3fa090fbc26087b5bb1c2e9e31c3a6bf7e0be3d1b626b83cf16d2e7718d1e0e808495ff838c729a1d9f4406222b0a43ed9fbf
|
data/lib/capistrano-karaf.rb
CHANGED
@@ -1,82 +1,101 @@
|
|
1
|
-
require '
|
1
|
+
require 'sshkit'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
SSHKit.config.command_map =
|
4
|
+
{
|
5
|
+
:features_addurl => 'features:addurl',
|
6
|
+
:features_removeurl => 'features:removeurl',
|
7
|
+
:features_install => 'features:install',
|
8
|
+
:features_list => 'features:list',
|
9
|
+
:features_info => 'features:info',
|
10
|
+
:headers => 'headers',
|
11
|
+
:list => 'list'
|
12
|
+
}
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
set :user, params[:username]
|
11
|
-
set :password, params[:password]
|
12
|
-
close_sessions
|
13
|
-
end
|
14
|
-
|
15
|
-
yield
|
14
|
+
def add_url (url)
|
15
|
+
execute(:features_addurl, url)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
20
|
-
sessions.clear
|
18
|
+
def remove_url (url)
|
19
|
+
execute(:features_removeurl, url)
|
21
20
|
end
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
with_karaf params do
|
26
|
-
run "features:addurl #{url}", {:shell => false}
|
27
|
-
end
|
22
|
+
def feature_install (name)
|
23
|
+
execute(:features_install, name)
|
28
24
|
end
|
29
25
|
|
30
|
-
def
|
31
|
-
|
32
|
-
run "features:removeurl #{url}", {:shell => false}
|
33
|
-
end
|
26
|
+
def feature_uninstall (name)
|
27
|
+
execute(:features_uninstall, name)
|
34
28
|
end
|
35
29
|
|
36
|
-
def
|
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 = {})
|
30
|
+
def list_bundles ()
|
49
31
|
bundle_line_matcher = /^\[(?<BundleId>[ \d]+)\] \[(?<BundleStatus>[ \w]+)\] \[[ ]*\] \[(?<ContextStatus>[ \w]+)\] \[(?<BundleLevel> [ \d]+)\] (?<BundleName>[\w\-\:]+) \((?<BundleVersion>.+)\)/
|
50
32
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
33
|
+
|
34
|
+
data = capture(:list)
|
35
|
+
bundles = []
|
36
|
+
data.lines.each do |line|
|
37
|
+
m = bundle_line_matcher.match(line)
|
38
|
+
if m then
|
39
|
+
bundles.push({ :id => m['BundleId'],
|
40
|
+
:status => m['BundleStatus'],
|
41
|
+
:context => m['ContextStatus'],
|
42
|
+
:level => m['BundleLevel'],
|
43
|
+
:name => m['BundleName'],
|
44
|
+
:version => m['BundleVersion']
|
45
|
+
})
|
65
46
|
end
|
66
47
|
bundles
|
67
48
|
end
|
68
|
-
end
|
69
49
|
end
|
70
50
|
|
71
|
-
def started? (name
|
51
|
+
def started? (name)
|
72
52
|
bundle = list_bundles.find {|b| b[:name] == name}
|
73
53
|
bundle[0][:context] == 'Started'
|
74
54
|
end
|
75
55
|
|
76
|
-
def list (
|
77
|
-
|
78
|
-
run "features:list", {:shell => false}
|
79
|
-
end
|
56
|
+
def list ()
|
57
|
+
capture(:features_list)
|
80
58
|
end
|
81
59
|
|
60
|
+
def headers (bundle)
|
61
|
+
data = capture(:headers, bundle)
|
62
|
+
extract_bundle_headers(data)
|
63
|
+
end
|
64
|
+
|
65
|
+
def feature_bundles (name)
|
66
|
+
data = capture(:features_info, name)
|
67
|
+
extract_bundles_from_feature(data)
|
68
|
+
end
|
69
|
+
|
70
|
+
def feature_bundles_numbers (name)
|
71
|
+
bundles = list_bundles
|
72
|
+
bundleIds = bundles.map {|bundle| bundle[:id]}
|
73
|
+
bundleHeaders = bundleIds.map {|bundleId| headers(bundleId).store(:bundleId, bundleId)}
|
74
|
+
featureBundles = feature_bundles(name)
|
75
|
+
bundlesInFeature = bundles.select {|b| find_feature_bundle(featureBundles, b[:artifactId], b[:version] != nil)}
|
76
|
+
bundlesInFeature.map {|b| b[:id]}
|
77
|
+
end
|
78
|
+
|
79
|
+
def find_feature_bundle (featureBundles, name, version)
|
80
|
+
featureBundles.select {|fb| fb["Bundle-SymbolicName"] == name && fb["Bundle-Version"] == version }
|
81
|
+
end
|
82
|
+
|
83
|
+
def extract_bundle_headers (headers)
|
84
|
+
re = /(.+) = (.+)/
|
85
|
+
header = {}
|
86
|
+
headers.lines.map {|l| m = l.match(re); if m then header[m[1].strip!] = m[2] end}
|
87
|
+
header
|
88
|
+
end
|
82
89
|
|
90
|
+
def extract_bundles_from_feature (data)
|
91
|
+
bundles = []
|
92
|
+
data.lines.each do |l|
|
93
|
+
m = l.match(/.*mvn:(?<GroupId>[\w\.]+)\/(?<ArtifactId>[\w-\.]+)\/(?<Version>[\d\w\.-]+)/)
|
94
|
+
if m then
|
95
|
+
bundles.push({:groupId => m['GroupId'],
|
96
|
+
:artifactId => m['ArtifactId'],
|
97
|
+
:version => m['Version']})
|
98
|
+
end
|
99
|
+
end
|
100
|
+
bundles
|
101
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-karaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brecht Hoflack
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-31 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description:
|
15
14
|
email: brecht.hoflack@gmail.com
|
@@ -21,26 +20,25 @@ files:
|
|
21
20
|
homepage: http://github.com/bhoflack/capistrano-karaf
|
22
21
|
licenses:
|
23
22
|
- bsd
|
23
|
+
metadata: {}
|
24
24
|
post_install_message:
|
25
25
|
rdoc_options: []
|
26
26
|
require_paths:
|
27
27
|
- lib
|
28
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
-
none: false
|
30
29
|
requirements:
|
31
|
-
- -
|
30
|
+
- - '>='
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
34
|
requirements:
|
37
|
-
- -
|
35
|
+
- - '>='
|
38
36
|
- !ruby/object:Gem::Version
|
39
37
|
version: '0'
|
40
38
|
requirements: []
|
41
39
|
rubyforge_project:
|
42
|
-
rubygems_version:
|
40
|
+
rubygems_version: 2.0.3
|
43
41
|
signing_key:
|
44
|
-
specification_version:
|
42
|
+
specification_version: 4
|
45
43
|
summary: Capistrano functions for communicating with karaf
|
46
44
|
test_files: []
|