serverspec 2.0.0.beta14 → 2.0.0.beta15
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 +4 -4
- data/Rakefile +1 -5
- data/lib/serverspec/setup.rb +9 -12
- data/lib/serverspec/type/file.rb +9 -3
- data/lib/serverspec/type/ppa.rb +2 -2
- data/lib/serverspec/type/user.rb +1 -1
- data/lib/serverspec/version.rb +1 -1
- data/serverspec.gemspec +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/type/windows/command_spec.rb +1 -2
- data/spec/type/windows/feature_spec.rb +1 -1
- data/spec/type/windows/file_spec.rb +1 -1
- data/spec/type/windows/group_spec.rb +1 -1
- data/spec/type/windows/host_spec.rb +1 -1
- data/spec/type/windows/hot_fix_spec.rb +1 -1
- data/spec/type/windows/iis_app_pool_spec.rb +1 -1
- data/spec/type/windows/iis_webisite_spec.rb +1 -1
- data/spec/type/windows/package_spec.rb +1 -1
- data/spec/type/windows/port_spec.rb +1 -1
- data/spec/type/windows/registry_key_spec.rb +1 -1
- data/spec/type/windows/scheduled_task_spec.rb +1 -1
- data/spec/type/windows/service_spec.rb +1 -1
- data/spec/type/windows/user_spec.rb +1 -1
- metadata +4 -6
- data/spec/unit/command_spec.rb +0 -81
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9682b482313465065c99631bd9d6406eee5fccba
|
4
|
+
data.tar.gz: f2abbbc406c36925dbac6c6c6dc5cdea5f869a66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a40b33c9ee24d24566dd3af6be3b88ab79e2b52cf5d29e4a1dd53f005a4d66ad46fd396aa46233000cf10cab0807a321ddb62b6feb9a58d9083ae4b8602c9beb
|
7
|
+
data.tar.gz: 4be745c4c19ae16a62892a0e32391b25560f88e7eb2557f0a8cbb8adb7858cd954c4da706c27ddfd728ed2fb3e687db8693236564861ea7c3fbfe30bee7d60c5
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ if defined?(RSpec)
|
|
9
9
|
task :spec => 'spec:all'
|
10
10
|
|
11
11
|
namespace :spec do
|
12
|
-
task :all => [ 'spec:type:all', 'spec:helper'
|
12
|
+
task :all => [ 'spec:type:all', 'spec:helper' ]
|
13
13
|
|
14
14
|
namespace :type do
|
15
15
|
oses = Dir.glob('spec/type/*').map {|d| File.basename(d)}
|
@@ -26,9 +26,5 @@ if defined?(RSpec)
|
|
26
26
|
RSpec::Core::RakeTask.new(:helper) do |t|
|
27
27
|
t.pattern = "spec/helper/*_spec.rb"
|
28
28
|
end
|
29
|
-
|
30
|
-
RSpec::Core::RakeTask.new(:unit) do |t|
|
31
|
-
t.pattern = "spec/unit/*_spec.rb"
|
32
|
-
end
|
33
29
|
end
|
34
30
|
end
|
data/lib/serverspec/setup.rb
CHANGED
@@ -13,7 +13,7 @@ module Serverspec
|
|
13
13
|
ask_windows_backend
|
14
14
|
end
|
15
15
|
|
16
|
-
if @backend_type == '
|
16
|
+
if @backend_type == 'ssh'
|
17
17
|
print 'Vagrant instance y/n: '
|
18
18
|
@vagrant = $stdin.gets.chomp
|
19
19
|
if @vagrant =~ (/(true|t|yes|y|1)$/i)
|
@@ -72,7 +72,7 @@ EOF
|
|
72
72
|
num = $stdin.gets.to_i - 1
|
73
73
|
puts
|
74
74
|
|
75
|
-
@backend_type = ['
|
75
|
+
@backend_type = ['ssh', 'exec'][num] || 'exec'
|
76
76
|
end
|
77
77
|
|
78
78
|
def self.ask_windows_backend
|
@@ -88,7 +88,7 @@ EOF
|
|
88
88
|
num = $stdin.gets.to_i - 1
|
89
89
|
puts
|
90
90
|
|
91
|
-
@backend_type = ['
|
91
|
+
@backend_type = ['winrm', 'cmd'][num] || 'exec'
|
92
92
|
end
|
93
93
|
|
94
94
|
def self.safe_create_spec
|
@@ -241,22 +241,19 @@ end
|
|
241
241
|
def self.spec_helper_template
|
242
242
|
template = <<-'EOF'
|
243
243
|
require 'serverspec'
|
244
|
-
<% if @backend_type == '
|
244
|
+
<% if @backend_type == 'ssh' -%>
|
245
245
|
require 'net/ssh'
|
246
246
|
<% end -%>
|
247
247
|
<%- if @vagrant -%>
|
248
248
|
require 'tempfile'
|
249
249
|
<% end -%>
|
250
|
-
<% if @backend_type == '
|
250
|
+
<% if @backend_type == 'winrm' -%>
|
251
251
|
require 'winrm'
|
252
252
|
<% end -%>
|
253
253
|
|
254
|
-
|
255
|
-
<% if @os_type != 'UN*X' -%>
|
256
|
-
include Specinfra::Helper::Windows
|
257
|
-
<% end -%>
|
254
|
+
set :backend, :<%= @backend_type %>
|
258
255
|
|
259
|
-
<% if @os_type == 'UN*X' && @backend_type == '
|
256
|
+
<% if @os_type == 'UN*X' && @backend_type == 'ssh' -%>
|
260
257
|
if ENV['ASK_SUDO_PASSWORD']
|
261
258
|
begin
|
262
259
|
require 'highline/import'
|
@@ -268,7 +265,7 @@ else
|
|
268
265
|
set :sudo_password, ENV['SUDO_PASSWORD']
|
269
266
|
end
|
270
267
|
|
271
|
-
<%- if @backend_type == '
|
268
|
+
<%- if @backend_type == 'ssh' -%>
|
272
269
|
host = ENV['TARGET_HOST']
|
273
270
|
|
274
271
|
<%- if @vagrant -%>
|
@@ -298,7 +295,7 @@ set :ssh_options, options
|
|
298
295
|
# Set PATH
|
299
296
|
# set :path, '/sbin:/usr/local/sbin:$PATH'
|
300
297
|
|
301
|
-
<% if @backend_type == '
|
298
|
+
<% if @backend_type == 'winrm'-%>
|
302
299
|
user = <username>
|
303
300
|
pass = <password>
|
304
301
|
endpoint = "http://<hostname>:5985/wsman"
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -74,7 +74,7 @@ module Serverspec
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def immutable?
|
77
|
-
|
77
|
+
@runner.check_file_is_immutable(@name)
|
78
78
|
end
|
79
79
|
|
80
80
|
def match_checksum(checksum)
|
@@ -101,13 +101,19 @@ module Serverspec
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def mtime
|
104
|
-
d =
|
104
|
+
d = @runner.get_file_mtime(@name).stdout.strip
|
105
105
|
DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
|
106
106
|
end
|
107
107
|
|
108
108
|
def size
|
109
|
-
|
109
|
+
@runner.get_file_size(@name).stdout.strip.to_i
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
113
113
|
end
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
data/lib/serverspec/type/ppa.rb
CHANGED
data/lib/serverspec/type/user.rb
CHANGED
data/lib/serverspec/version.rb
CHANGED
data/serverspec.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "rspec", "~> 3.0.0"
|
22
22
|
spec.add_runtime_dependency "rspec-its"
|
23
|
-
spec.add_runtime_dependency "specinfra", "~> 2.0.0.
|
23
|
+
spec.add_runtime_dependency "specinfra", "~> 2.0.0.beta15"
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.1.1"
|
26
26
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.0.0.
|
47
|
+
version: 2.0.0.beta15
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.0.0.
|
54
|
+
version: 2.0.0.beta15
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,7 +266,6 @@ files:
|
|
266
266
|
- spec/type/windows/scheduled_task_spec.rb
|
267
267
|
- spec/type/windows/service_spec.rb
|
268
268
|
- spec/type/windows/user_spec.rb
|
269
|
-
- spec/unit/command_spec.rb
|
270
269
|
- wercker.yml
|
271
270
|
homepage: http://serverspec.org/
|
272
271
|
licenses:
|
@@ -398,4 +397,3 @@ test_files:
|
|
398
397
|
- spec/type/windows/scheduled_task_spec.rb
|
399
398
|
- spec/type/windows/service_spec.rb
|
400
399
|
- spec/type/windows/user_spec.rb
|
401
|
-
- spec/unit/command_spec.rb
|
data/spec/unit/command_spec.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Serverspec::Type::Command do
|
4
|
-
subject { command('echo banana') }
|
5
|
-
|
6
|
-
before :each do
|
7
|
-
allow(subject.backend).to receive(:run_command).and_return(
|
8
|
-
CommandResult.new({
|
9
|
-
:stdout => "banana\n",
|
10
|
-
:stderr => "split\n",
|
11
|
-
:exit_status => "42", # Command should convert this to an integer
|
12
|
-
})
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'has stdout' do
|
17
|
-
expect(subject.stdout).to be == "banana\n"
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'has stderr' do
|
21
|
-
expect(subject.stderr).to be == "split\n"
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'has exit_status' do
|
25
|
-
expect(subject.exit_status).to be == 42
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'does not conflate stdout and stderr' do
|
29
|
-
expect(subject.stdout).to eq("banana\n")
|
30
|
-
expect(subject.stderr).to eq("split\n")
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'runs the command lazily' do
|
34
|
-
expect(subject.backend).to receive(:run_command).exactly(0).times
|
35
|
-
|
36
|
-
# Not sending any messages to the subject.
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'does not run the command more than once' do
|
40
|
-
expect(subject.backend).to receive(:run_command).once
|
41
|
-
|
42
|
-
# We can send all these messages, but the command is invoked only once.
|
43
|
-
subject.stdout
|
44
|
-
subject.stderr
|
45
|
-
subject.exit_status
|
46
|
-
subject.return_stdout? 'foo'
|
47
|
-
subject.return_stderr? 'foo'
|
48
|
-
subject.return_exit_status? 0
|
49
|
-
end
|
50
|
-
|
51
|
-
describe '#return_stdout?' do
|
52
|
-
it 'matches against a string, stripping whitespace' do
|
53
|
-
expect(subject.return_stdout? 'banana').to be_truthy
|
54
|
-
expect(subject.return_stdout? 'pancake').to be_falsey
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'matches against a regex' do
|
58
|
-
expect(subject.return_stdout? /anan/).to be_truthy
|
59
|
-
expect(subject.return_stdout? /^anan/).to be_falsey
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe '#return_stderr?' do
|
64
|
-
it 'matches against a string, stripping whitespace' do
|
65
|
-
expect(subject.return_stderr? 'split').to be_truthy
|
66
|
-
expect(subject.return_stderr? 'pancake').to be_falsey
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'matches against a regex' do
|
70
|
-
expect(subject.return_stderr? /pli/).to be_truthy
|
71
|
-
expect(subject.return_stderr? /^pli/).to be_falsey
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
describe '#return_stderr?' do
|
76
|
-
it 'matches against an integer' do
|
77
|
-
expect(subject.return_exit_status? 42).to be_truthy
|
78
|
-
expect(subject.return_exit_status? 43).to be_falsey
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|