serverspec_extensions 0.0.2

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 (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/serverspec_extensions.rb +68 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0d89a006f58f9eddbb2cab3b4cf8ece91dd60340
4
+ data.tar.gz: 85dc0ceb44c15125537049a0994307a5545c8c3f
5
+ SHA512:
6
+ metadata.gz: bdd77c67020bffbafe1a94af581dc823631869a3c1620b1224de436f88db4dd64c66427779d87eab3f1c8e0525c21f5ccb00a9731796f8f94cb7544203e6a50e
7
+ data.tar.gz: 62e577c0680caed458104ada33b5f561b438464c1c73838aa15c00c91988f01d55babaf29b5d0cb67d1a567023457a582b4c39ed85c428d79df78c6d92420daf
@@ -0,0 +1,68 @@
1
+ RSpec::Matchers.define :be_running_with_log do
2
+ match do |subject|
3
+ if subject.class.name == 'Serverspec::Type::Service'
4
+ subject.running_with_log?(@under, @logs, @lines)
5
+ else
6
+ subject.running?
7
+ end
8
+ end
9
+
10
+ chain :under do |under, logs, lines|
11
+ @under = under
12
+ @logs = logs
13
+ @lines = lines
14
+ end
15
+
16
+ end
17
+
18
+ module Serverspec # rubocop:disable Documentation
19
+
20
+ module Type # rubocop:disable Documentation
21
+
22
+ class Service < Base # rubocop:disable Documentation
23
+
24
+ def running_with_log?(under, logs, lines = 40)
25
+ if under && logs
26
+ check_method = "check_service_is_running_under_#{under}".to_sym
27
+ @runner.send(check_method, @name, logs, lines)
28
+ else
29
+ @runner.check_service_is_running(@name)
30
+ end
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ module Specinfra
40
+
41
+ module Command
42
+
43
+ class Base
44
+
45
+ class Service < Specinfra::Command::Base # rubocop:disable Documentation
46
+
47
+ class << self
48
+
49
+ def check_is_running_under_supervisor_logs(service, logs, lines = 40)
50
+ s = service
51
+ unless system("supervisorctl status #{escape(s)}|grep RUNNING")
52
+ logs.each do |log|
53
+ puts "log: #{log}"
54
+ system("tail -n #{lines} #{log}")
55
+ end
56
+ end
57
+ "supervisorctl status #{escape(s)} | grep RUNNING"
58
+ end
59
+
60
+ end
61
+
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
68
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: serverspec_extensions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - serenejellyfish@gmail.com
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/serverspec_extensions.rb
20
+ homepage:
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.2.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: some supervisor logging specific extenstions to serverspec
43
+ test_files: []