Permalink
Browse files

Hmm, chicken and egg problem on Travis, copy travis:setup task from X…

…codeproj.
  • Loading branch information...
1 parent c8ce61f commit 2fb6ae6dde627cdab627c68af93aa2576c0a72af @alloy alloy committed Mar 25, 2012
Showing with 43 additions and 1 deletion.
  1. +1 −1 .travis.yml
  2. +42 −0 Rakefile
View
@@ -2,5 +2,5 @@ language: ruby
rvm:
- 1.8.7
- 1.9.3
-install: git submodule update --init && bundle install --path bundle && pushd . && cd bundle/ruby/*/bundler/gems/Xcodeproj-* && rake travis:setup && popd && sudo apt-get install subversion
+before_install: git submodule update --init && rake travis:setup && sudo apt-get install subversion
script: bundle exec rake spec
View
@@ -1,3 +1,45 @@
+# Travis support
+def on_rvm?
+ `which ruby`.strip.include?('.rvm')
+end
+
+def rvm_ruby_dir
+ @rvm_ruby_dir ||= File.expand_path('../..', `which ruby`.strip)
+end
+
+namespace :travis do
+ # Used to create the deb package.
+ #
+ # Known to work with opencflite rev 248.
+ task :prepare_deb do
+ sh "sudo apt-get install subversion libicu-dev"
+ sh "svn co https://opencflite.svn.sourceforge.net/svnroot/opencflite/trunk opencflite"
+ sh "cd opencflite && ./configure --target=linux --with-uuid=/usr --with-tz-includes=./include --prefix=/usr/local && make && sudo make install"
+ sh "sudo /sbin/ldconfig"
+ end
+
+ task :install_opencflite_debs do
+ sh "mkdir -p debs"
+ Dir.chdir("debs") do
+ base_url = "https://github.com/downloads/CocoaPods/OpenCFLite"
+ %w{ opencflite1_248-1_i386.deb opencflite-dev_248-1_i386.deb }.each do |deb|
+ sh "wget #{File.join(base_url, deb)}" unless File.exist?(deb)
+ end
+ sh "sudo dpkg -i *.deb"
+ end
+ end
+
+ task :fix_rvm_include_dir do
+ unless File.exist?(File.join(rvm_ruby_dir, 'include'))
+ # Make Ruby headers available, RVM seems to do not create a include dir on 1.8.7, but it does on 1.9.3.
+ sh "mkdir '#{rvm_ruby_dir}/include'"
+ sh "ln -s '#{rvm_ruby_dir}/lib/ruby/1.8/i686-linux' '#{rvm_ruby_dir}/include/ruby'"
+ end
+ end
+
+ task :setup => [:install_opencflite_debs, :fix_rvm_include_dir]
+end
+
namespace :gem do
def gem_version
require File.join(File.dirname(__FILE__), *%w[lib cocoapods])

0 comments on commit 2fb6ae6

Please sign in to comment.