Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 65 lines (60 sloc) 1.672 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
require 'rubygems'
require 'bundler'
require 'bundler/setup'
require 'veewee'
Bundler::GemHelper.install_tasks

desc 'Default: run tests'
task :default => :test

require 'rake/testtask'
Bundler::GemHelper.install_tasks

desc 'Tests not requiring an real box'
Rake::TestTask.new do |t|
  t.libs << "test"
  t.pattern = 'test/**/*_test.rb'
end

desc 'Tests requiring an real box'
Rake::TestTask.new do |t|
  t.name="realtest"
  t.libs << "test"
  t.libs << "."
  t.pattern = 'test/**/*_realtest.rb'
end

desc 'Verify ISO'
task :iso, [:box_name] do |t,args|
  require 'net/http'
  #if args.to_hash.size!=1
  #puts "needs one arguments: rake iso [\"yourname\"]"
  #exit
  #end
  Dir.glob("templates/*").each do |name|
    definition_name=File.basename(name)
    puts name
    definition=Veewee::Environment.new(:cwd => ".",:definition_dir => "templates").definitions[definition_name]
    next if definition.nil? || definition.iso_src.nil? || definition.iso_src==""
    begin
      url=definition.iso_src
      found=false
      response = nil
      while found==false
        uri=URI.parse(url)
        Net::HTTP.start(uri.host,uri.port) {|http|
          response = http.head(uri.path)
        }
        unless response['location'].nil?
          #puts "Redirecting to "+response['location']
          url=response['location']
        else
          found=true
        end
      end
      length=response['content-length']
      if length.to_i < 10000
        puts definition.iso_src
        p response['content-type']
        puts uri.host,uri.port, uri.path,response.code
      end
    rescue Exception => ex
      puts "Error"+ex.to_s+definition.iso_src
    end
  end
end
Something went wrong with that request. Please try again.