Skip to content

Commit

Permalink
modified rakefile for cucumber setup
Browse files Browse the repository at this point in the history
  • Loading branch information
vertiginous committed Jun 11, 2010
1 parent 47a58c6 commit f804e38
Showing 1 changed file with 41 additions and 8 deletions.
49 changes: 41 additions & 8 deletions Rakefile
Expand Up @@ -101,30 +101,60 @@ end
require 'cucumber'
require 'cucumber/rake/task'

@dir = Pathname(File.dirname(__FILE__))
@test_versions = {
'JRuby' => ['1.5.1'],
'IronRuby' => ['0.9.2'],
'Ruby' => [
'1.9.1-p378-1',
'1.8.6-p398-2',
'1.8.7-p249-1'
]
}

namespace :cucumber do

directory "C:/temp"

desc "sets up C:\\temp for pik's cuke tests"
task :setup => "C:/temp" do
ENV['HOME'] = "C:\\temp"
Pik::Implementations.implementations.each{|i|
url = URI.parse(i.url)
query = url.query || ''
path = (Pathname('phony_web/public') + (url.path + query.gsub("group_id=","")).gsub(/^\//,''))
mkdir_p path
File.open(path + 'index.html', 'w+'){|f| f.puts i.read }
}

sh "pik config installs=\"C:\\temp\\more spaces in path\\ruby\""
sh "pik install jruby"
sh "pik install ironruby"
sh "pik install ruby"
sh "pik install ruby 1.8"
list = Pik::Implementations.list
@test_versions.each{|k,v|
v.each{|ver|
path = File.dirname(URI.parse(list[k][ver]).path)
dir = @dir + 'phony_web/public'
dir += path.sub(/^\//,'')
puts dir.to_windows
sh "pik config downloads=#{dir.to_windows}"
mkdir_p path
sh "pik install #{k} #{ver}"
}
}
sh "pik gem in rake"
mv "c:/temp/.pik/config.yml", "c:/temp/.pik/config.bak"
end

namespace :phonyweb do

task :start => 'hosts:add' do
@web = Process.create(:app_name => "ruby C:\\scripts\\repo\\pik\\phony_web\\server.rb")

task :start do #=> 'hosts:add' do
dir = @dir + 'phony_web/server.rb'
@web = Process.create(:app_name => "ruby #{dir.to_windows}")
end

task :kill => 'hosts:remove' do
Process.kill(3, @web.process_id)
end

end

# this is used with the phony web server for
Expand All @@ -137,7 +167,7 @@ namespace :cucumber do
desc "adds fake hosts to system's hosts file"
task :add do
File.open(HOSTS,'a+'){|f|
f.puts "127.0.0.1 www.jruby.org rubyforge.org www.rubyforge.org jruby.kenai.com dist.codehaus.org"
f.puts "127.0.0.1 www.jruby.org rubyforge.org www.rubyforge.org jruby.org.s3.amazonaws.com"
}
end

Expand All @@ -150,6 +180,7 @@ namespace :cucumber do
task :rm => :remove

end

end

Cucumber::Rake::Task.new(:features) do |t|
Expand All @@ -158,4 +189,6 @@ end

task :cuke => ['cucumber:phonyweb:start', :features, 'cucumber:phonyweb:kill']


# vim: syntax=Ruby

0 comments on commit f804e38

Please sign in to comment.