test-kitchen 1.0.0.beta.3 → 1.0.0.beta.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,42 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require 'delegate'
20
-
21
- module Kitchen
22
-
23
- # A delegator for Instance which adds Celluloid actor support, boom.
24
- #
25
- # @author Fletcher Nichol <fnichol@nichol.ca>
26
- class InstanceActor < SimpleDelegator
27
-
28
- include Celluloid
29
-
30
- # @!method actor_name()
31
- # Returns the name of the Celluloid actor.
32
- # @return [String] the actor name
33
- alias_method :actor_name, :name
34
-
35
- # Returns the name of the underlying instance.
36
- #
37
- # @return [String] the instance name
38
- def name
39
- __getobj__.name
40
- end
41
- end
42
- end
@@ -1,45 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- module Kitchen
20
-
21
- # A class to manage actors.
22
- #
23
- # @author Fletcher Nichol <fnichol@nichol.ca>
24
- class Manager
25
-
26
- include Celluloid
27
-
28
- trap_exit :actor_died
29
-
30
- # Terminate all actors that are linked.
31
- def stop
32
- Array(links.to_a).map { |actor| actor.terminate if actor.alive? }
33
- end
34
-
35
- private
36
-
37
- def actor_died(actor, reason)
38
- if reason.nil?
39
- Kitchen.logger.debug("Actor terminated cleanly")
40
- else
41
- Kitchen.logger.debug("An actor crashed due to #{reason.inspect}")
42
- end
43
- end
44
- end
45
- end