def self.safe_create_spec
content = "require 'spec_helper'\n\ndescribe package('httpd') do\nit { should be_installed }\nend\n\ndescribe service('httpd') do\nit { should be_enabled }\nit { should be_running }\nend\n\ndescribe port(80) do\nit { should be_listening }\nend\n\ndescribe file('/etc/httpd/conf/httpd.conf') do\nit { should be_file }\nits(:content) { should match /ServerName \#{@hostname}/ }\nend\n"
if File.exists? "spec/#{@hostname}/httpd_spec.rb"
old_content = File.read("spec/#{@hostname}/httpd_spec.rb")
if old_content != content
$stderr.puts "!! spec/#{@hostname}/httpd_spec.rb already exists and differs from template"
end
else
File.open("spec/#{@hostname}/httpd_spec.rb", 'w') do |f|
f.puts content
end
puts " + spec/#{@hostname}/httpd_spec.rb"
end
end