def self.safe_create_spec
content = "require 'spec_helper'\n\ndescribe package('httpd'), :if => os[:family] == 'redhat' do\nit { should be_installed }\nend\n\ndescribe package('apache2'), :if => os[:family] == 'ubuntu' do\nit { should be_installed }\nend\n\ndescribe service('httpd'), :if => os[:family] == 'redhat' do\nit { should be_enabled }\nit { should be_running }\nend\n\ndescribe service('apache2'), :if => os[:family] == 'ubuntu' do\nit { should be_enabled }\nit { should be_running }\nend\n\ndescribe service('org.apache.httpd'), :if => os[:family] == 'darwin' do\nit { should be_enabled }\nit { should be_running }\nend\n\ndescribe port(80) do\nit { should be_listening }\nend\n"
if File.exists? "spec/#{@hostname}/sample_spec.rb"
old_content = File.read("spec/#{@hostname}/sample_spec.rb")
if old_content != content
$stderr.puts "!! spec/#{@hostname}/sample_spec.rb already exists and differs from template"
end
else
File.open("spec/#{@hostname}/sample_spec.rb", 'w') do |f|
f.puts content
end
puts " + spec/#{@hostname}/sample_spec.rb"
end
end