Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
centralize travis setup into a rake task
Browse files Browse the repository at this point in the history
Conflicts:
	.travis.yml
  • Loading branch information
indirect committed Dec 29, 2012
1 parent 9aa6343 commit 399d900
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
@@ -1,8 +1,6 @@
language: ruby
script: rake spec:travis
before_script:
- sudo apt-get install groff -y
- rake spec:deps
before_script: rake spec:travis:deps
notifications:
email:
- mail@arko.net
Expand Down
16 changes: 13 additions & 3 deletions Rakefile
Expand Up @@ -127,6 +127,19 @@ begin
task "rubygems:all" => "co"
end

namespace :travis do
task :deps do
# Give the travis user a name so that git won't fatally error
system("sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd")
# Strip secure_path so that RVM paths transmit through sudo -E
system("sudo sed -i '/secure_path/d' /etc/sudoers")
# Install groff for the ronn gem
system("sudo apt-get install groff -y")
# Install the other gem deps, etc.
Rake::Task["spec:deps"].invoke
end
end

desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
task :travis do
rg = ENV['RGV'] || 'master'
Expand All @@ -137,9 +150,6 @@ begin
Rake::Task["spec:rubygems:#{rg}"].reenable

puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
# fix the sudoers file so that RVM paths transmit through sudo -E
system("sudo sed -i '/secure_path/d' /etc/sudoers")
# run the sudo specs themselves
sudos = system("sudo -E rake spec:rubygems:#{rg}:sudo")
# clean up by chowning the newly root-owned tmp directory back to the travis user
system("sudo chown -R #{ENV['USER']} #{File.join(File.dirname(__FILE__), 'tmp')}")
Expand Down

0 comments on commit 399d900

Please sign in to comment.