Sha256: 2ef09be16a2b207c4d9b65fba41dce4c13ddbfff8b10e702f892002eb8432d87

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

require 'test/unit'
require 'webrick'
require 'fileutils'
require 'zlib'
require 'archive/tar/minitar'
require 'fileutils'
require 'erb'
require 'mini_portile2'

class TestCase < Test::Unit::TestCase
  class << self
    HTTP_PORT = 23523

    attr_accessor :webrick

    def start_webrick(path)
      @webrick = WEBrick::HTTPServer.new(:Port => HTTP_PORT, :DocumentRoot => path).tap do |w|
        Thread.new do
          w.start
        end
        until w.status==:Running
          sleep 0.1
        end
      end
    end

    def stop_webrick
      if w=@webrick
        w.shutdown
        until w.status==:Stop
          sleep 0.1
        end
      end
    end

    def create_tar(tar_path, assets_path)
      FileUtils.mkdir_p(File.dirname(tar_path))
      Zlib::GzipWriter.open(tar_path) do |fdtgz|
        Dir.chdir(assets_path) do
          Archive::Tar::Minitar.pack("test mini portile-1.0.0", fdtgz)
        end
      end
    end

    def work_dir(r=recipe)
      "tmp/#{r.host}/ports/#{r.name}/#{r.version}/#{r.name}-#{r.version}"
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/mini_portile2-2.0.0/test/helper.rb
mini_portile2-2.0.0 test/helper.rb
mini_portile2-2.0.0.rc2 test/helper.rb
mini_portile2-2.0.0.rc1 test/helper.rb