Skip to content

Commit

Permalink
Create sample .rspec
Browse files Browse the repository at this point in the history
  • Loading branch information
mizzy committed Jul 26, 2014
1 parent 8e18675 commit b2fcf32
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/serverspec/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def self.run
safe_create_spec
safe_create_spec_helper
safe_create_rakefile
safe_create_dotrspec
end

def self.ask_os_type
Expand Down Expand Up @@ -285,6 +286,9 @@ def self.spec_helper_template
set :host, options[:host_name] || host
set :ssh_options, options
# Disable sudo
# set :disable_sudo, true
<%- end -%>
<%- end -%>
Expand All @@ -305,5 +309,24 @@ def self.spec_helper_template
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

0 comments on commit b2fcf32

Please sign in to comment.