capistrano-karaf 1.2.2 → 1.2.3

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.
Files changed (2) hide show
  1. data/lib/capistrano-karaf.rb +29 -9
  2. metadata +2 -2
@@ -53,25 +53,45 @@ end
53
53
  def list_bundles ()
54
54
  bundle_line_matcher = %r{(?<id> \d+){0}
55
55
  (?<status> \w+){0}
56
+ (?<blueprint> \w*){0}
56
57
  (?<context> \w*){0}
57
58
  (?<level> \d+){0}
58
59
  (?<name> [\w\s\-\:]+){0}
59
60
  (?<version> .+){0}
60
61
 
61
- ^\[\s*\g<id>\]\s\[\s*\g<status>\s*\]\s\[\s{12}\]\s\[\s*\g<context>\s*\]\s\[\s*\g<level>\s*\]\s\g<name>\s\(\g<version>\)
62
+ ^\[\s*\g<id>\]\s\[\s*\g<status>\s*\]\s\[\s*\g<blueprint>\s*\]\s\[\s*\g<context>\s*\]\s\[\s*\g<level>\s*\]\s\g<name>\s\(\g<version>\)
62
63
  }x
63
64
 
64
- data = capture(:list)
65
- bundles = []
66
- data.lines.each do |line|
67
- m = bundle_line_matcher.match(line)
68
- if m then
69
- bundles.push(m)
70
- end
65
+ data = capture(:list)
66
+ bundles = []
67
+ data.lines.each do |line|
68
+ m = bundle_line_matcher.match(line)
69
+ if m then
70
+ bundles.push(m)
71
71
  end
72
- bundles
72
+ end
73
+ bundles.collect {|m| Hash[m.names.zip(m.captures)]}
74
+ end
75
+
76
+ def wait_for_all_bundles (timeout = 5, sleeptime = 1, &pred)
77
+ timeout1 = Time.now + timeout
78
+
79
+ until Time.now > timeout1 or list_bundles.all? { |b| pred.call b}
80
+ puts "Some bundles are still failing the predicate"
81
+ sleep sleeptime
82
+ end
73
83
  end
74
84
 
85
+ def wait_for_bundle (timeout = 5, sleeptime = 1, &pred)
86
+ timeout1 = Time.now + timeout
87
+
88
+ while Time.now < timeout1 and list_bundles.none? { |b| pred.call b}
89
+ puts "Bundle not yet started"
90
+ sleep sleeptime
91
+ end
92
+ end
93
+
94
+
75
95
  def started? (name)
76
96
  bundle = list_bundles.find {|b| b[:name] == name}
77
97
  bundle[0][:context] == 'Started'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-karaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-03 00:00:00.000000000 Z
12
+ date: 2014-01-23 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: brecht.hoflack@gmail.com