lib/serverspec/setup.rb in serverspec-2.0.0.beta10 vs lib/serverspec/setup.rb in serverspec-2.0.0.beta11
- old
+ new
@@ -37,10 +37,11 @@
['spec', "spec/#{@hostname}"].each { |dir| safe_mkdir(dir) }
safe_create_spec
safe_create_spec_helper
safe_create_rakefile
+ safe_create_dotrspec
end
def self.ask_os_type
prompt = <<-EOF
Select OS type:
@@ -283,13 +284,22 @@
options[:user] ||= Etc.getlogin
set :host, options[:host_name] || host
set :ssh_options, options
+
+# Disable sudo
+# set :disable_sudo, true
<%- end -%>
<%- end -%>
+# Set environment variables
+# set :env, 'LANG' => 'C', 'LC_MESSAGES' => 'C'
+
+# Set PATH
+# set :path, '/sbin:/usr/local/sbin:$PATH'
+
<% if @backend_type == 'WinRM'-%>
user = <username>
pass = <password>
endpoint = "http://<hostname>:5985/wsman"
@@ -297,7 +307,26 @@
c.winrm.set_timeout 300 # 5 minutes max timeout for any operation
<% end -%>
EOF
template
end
+
+ def self.safe_create_dotrspec
+ content = <<-'EOF'
+--color
+--format documentation
+ EOF
+ if File.exists? '.rspec'
+ old_content = File.read('.rspec')
+ if old_content != content
+ $stderr.puts '!! .rspec already exists and differs from template'
+ end
+ else
+ File.open('.rspec', 'w') do |f|
+ f.puts content
+ end
+ puts ' + .rspec'
+ end
+ end
+
end
end