serverspec 2.0.0.beta14 → 2.0.0.beta15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 10e0a503abed00be31b8a9824c6fabd65493265f
4
- data.tar.gz: 4633170014576075194dc5190171cbc9f8101008
3
+ metadata.gz: 9682b482313465065c99631bd9d6406eee5fccba
4
+ data.tar.gz: f2abbbc406c36925dbac6c6c6dc5cdea5f869a66
5
5
  SHA512:
6
- metadata.gz: b59be2057429d85e4231467ef79ed844364453eca3c041400d56b1709be454c8c1996e642e25b5133ff5cfc290c2da4666f8e41fdca46aa4081cdeb40575fede
7
- data.tar.gz: c480f1dc7ac100e1c7ae24b1a82b04e17d0131fe32ceef6b372c56264c1b51033edcfaa8cae0d1a3cbd8c81b3534282dfc3a981d7d0ab5beb3bd62d5cfe55d06
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', 'spec:unit' ]
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
@@ -13,7 +13,7 @@ module Serverspec
13
13
  ask_windows_backend
14
14
  end
15
15
 
16
- if @backend_type == 'Ssh'
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 = ['Ssh', 'Exec'][num] || 'Exec'
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 = ['WinRM', 'Cmd'][num] || 'Exec'
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 == 'Ssh' -%>
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 == 'WinRM' -%>
250
+ <% if @backend_type == 'winrm' -%>
251
251
  require 'winrm'
252
252
  <% end -%>
253
253
 
254
- include Specinfra::Helper::<%= @backend_type %>
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 == 'Ssh' -%>
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 == 'Ssh' -%>
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 == 'WinRM'-%>
298
+ <% if @backend_type == 'winrm'-%>
302
299
  user = <username>
303
300
  pass = <password>
304
301
  endpoint = "http://<hostname>:5985/wsman"
@@ -74,7 +74,7 @@ module Serverspec
74
74
  end
75
75
 
76
76
  def immutable?
77
- backend.check_file_is_immutable(@name)
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 = backend.get_file_mtime(@name).stdout.strip
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
- backend.get_file_size(@name).stdout.strip.to_i
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
+
@@ -2,11 +2,11 @@ module Serverspec
2
2
  module Type
3
3
  class Ppa < Base
4
4
  def exists?
5
- backend.check_ppa_exists(@name)
5
+ @runner.check_ppa_exists(@name)
6
6
  end
7
7
 
8
8
  def enabled?
9
- backend.check_ppa_is_enabled(@name)
9
+ @runner.check_ppa_is_enabled(@name)
10
10
  end
11
11
  end
12
12
  end
@@ -10,7 +10,7 @@ module Serverspec
10
10
  end
11
11
 
12
12
  def belongs_to_primary_group?(group)
13
- backend.check_user_belongs_to_primary_group(@name, group)
13
+ @runner.check_user_belongs_to_primary_group(@name, group)
14
14
  end
15
15
 
16
16
  def has_uid?(uid)
@@ -1,3 +1,3 @@
1
1
  module Serverspec
2
- VERSION = "2.0.0.beta14"
2
+ VERSION = "2.0.0.beta15"
3
3
  end
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.beta13"
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
@@ -2,7 +2,7 @@ require 'serverspec'
2
2
  require 'pathname'
3
3
  require 'rspec/mocks/standalone'
4
4
 
5
- include Specinfra::Helper::Exec
5
+ set :backend, :exec
6
6
 
7
7
  PROJECT_ROOT = (Pathname.new(File.dirname(__FILE__)) + '..').expand_path
8
8
 
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
4
-
3
+ set :backend, :cmd
5
4
  set :os, :family => 'windows'
6
5
 
7
6
  describe command('test_cmd /test/path/file') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
  set :os, :family => 'windows'
5
5
 
6
6
  describe host('127.0.0.1') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
  set :os, :family => 'windows'
5
5
 
6
6
  describe windows_registry_key('PATH/TO/THE_KEY') do
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- include Specinfra::Helper::Cmd
3
+ set :backend, :cmd
4
4
 
5
5
  set :os, :family => 'windows'
6
6
 
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.beta14
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-07-30 00:00:00.000000000 Z
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.beta13
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.beta13
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
@@ -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