Sha256: 08a3cd5b3249e8210fe0621a9ea5fc3ec5a94cea151a3ba90951d4788ee19709

Contents?: true

Size: 1.48 KB

Versions: 16

Compression:

Stored size: 1.48 KB

Contents

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "open-uri"

def yellow(str)
  "\e[33m#{str}\e[m"
end

ENV['VAGRANT_CWD'] = File.expand_path('spec/integration/vm')


desc 'Run unit and integration tests'
task :spec => ['spec:unit', 'spec:integration']

namespace :spec do
  RSpec::Core::RakeTask.new("unit") do |task|
    task.pattern = "./spec/unit{,/*/**}/*_spec.rb"
  end

  RSpec::Core::RakeTask.new("integration") do |task|
    task.pattern = "./spec/integration{,/*/**}/*_spec.rb"
  end

  namespace :integration do
    integration_dir = 'spec/integration'

    desc 'Clean'
    task :clean => ['destroy_vm', 'remove_berks'] do
    end

    desc 'Prepare'
    task :prepare => ['start_vm'] do
    end

    task :berks_vendor do
      dir = File.join(integration_dir, 'vm/vendor/cookbooks')
      # Berkshelf
      if Dir.exist?(dir)
        puts yellow("'#{dir}' already exists. If you want update cookbooks, delete the directory and re-run rake command")
      else
        puts yellow('Installing cookbooks by berkshelf...')
        system "cd #{integration_dir}/vm && berks vendor vendor/cookbooks"
      end
    end

    task :start_vm => ['berks_vendor'] do
      puts yellow('Starting VM...')
      system '/usr/bin/vagrant up'
    end

    task :destroy_vm do
      puts yellow('Destroying VM...')
      system '/usr/bin/vagrant destroy -f'
    end

    task :remove_berks do
      dir = File.join(integration_dir, 'vm/vendor/cookbooks')
      FileUtils.rm_rf(dir)
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
infrataster-0.3.1 Rakefile
infrataster-0.3.0 Rakefile
infrataster-0.2.6 Rakefile
infrataster-0.2.5 Rakefile
infrataster-0.2.4 Rakefile
infrataster-0.2.3 Rakefile
infrataster-0.2.2 Rakefile
infrataster-0.2.1 Rakefile
infrataster-0.2.0 Rakefile
infrataster-0.2.0.beta1 Rakefile
infrataster-0.1.13 Rakefile
infrataster-0.1.12 Rakefile
infrataster-0.1.11 Rakefile
infrataster-0.1.10 Rakefile
infrataster-0.1.9 Rakefile
infrataster-0.1.8 Rakefile