Sha256: 03b6fce4804e8a03e20ff322f686e499dffb94c099864d524059c82d66ee3521

Contents?: true

Size: 1.11 KB

Versions: 41

Compression:

Stored size: 1.11 KB

Contents

require "rake"
require "rake/tasklib"

module Fog
  module Rake
    class TestTask < ::Rake::TaskLib
      def initialize
        desc "Run the mocked tests"
        task :test do
          ::Rake::Task[:mock_tests].invoke
        end

        task :mock_tests do
          tests(true)
        end

        task :real_tests do
          tests(false)
        end
      end

      def tests(mocked)
        Fog::Formatador.display_line
        start = Time.now.to_i
        threads = []
        Thread.main[:results] = []
        Fog.providers.each do |key, value|
          threads << Thread.new do
            Thread.main[:results] << {
              :provider => value,
              :success  => sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}")
            }
          end
        end
        threads.each(&:join)
        Fog::Formatador.display_table(Thread.main[:results].sort { |x, y| x[:provider] <=> y[:provider] })
        Fog::Formatador.display_line("[bold]FOG_MOCK=#{mocked}[/] tests completed in [bold]#{Time.now.to_i - start}[/] seconds")
        Fog::Formatador.display_line
      end
    end
  end
end

Version data entries

41 entries across 38 versions & 3 rubygems

Version Path
fog-core-2.3.0 lib/tasks/test_task.rb
fog-core-2.2.4 lib/tasks/test_task.rb
fog-core-2.2.3 lib/tasks/test_task.rb
fog-core-2.2.2 lib/tasks/test_task.rb
fog-core-2.2.1 lib/tasks/test_task.rb
fog-core-2.2.0 lib/tasks/test_task.rb
fog-core-2.1.2 lib/tasks/test_task.rb
fog-core-2.1.1 lib/tasks/test_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/lib/tasks/test_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-1.45.0/lib/tasks/test_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-2.1.0/lib/tasks/test_task.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-core-1.45.0/lib/tasks/test_task.rb
fog-core-2.1.0 lib/tasks/test_task.rb
fog-core-2.0.0 lib/tasks/test_task.rb
fog-core-1.45.0 lib/tasks/test_task.rb
fog-core-1.44.3 lib/tasks/test_task.rb
fog-core-1.44.2 lib/tasks/test_task.rb
fog-core-1.44.1 lib/tasks/test_task.rb
fog-core-1.44.0 lib/tasks/test_task.rb
fog-core-1.43.0 lib/tasks/test_task.rb