Sha256: 7908236913caaf24c953c34c6e9528362dcbe287f45406081b82d4a926043b05

Contents?: true

Size: 1.75 KB

Versions: 3

Compression:

Stored size: 1.75 KB

Contents

# frozen_string_literal: true

# Tests
namespace :test do
  desc 'Test ForemanSnapshotManagement'
  Rake::TestTask.new(:foreman_snapshot_management) do |t|
    test_dir = File.join(File.dirname(__FILE__), '../..', 'test')
    t.libs << ['test', test_dir]
    t.pattern = "#{test_dir}/**/*_test.rb"
    t.verbose = true
    t.warning = false
  end
end

begin
  require 'rubocop/rake_task'

  test_patterns = ["#{ForemanSnapshotManagement::Engine.root}/app/**/*.rb",
                   "#{ForemanSnapshotManagement::Engine.root}/lib/**/*.rb",
                   "#{ForemanSnapshotManagement::Engine.root}/test/**/*.rb"]

  namespace :foreman_snapshot_management do
    task :rubocop do
      RuboCop::RakeTask.new(:rubocop_foreman_snapshot_management) do |task|
        task.patterns = test_patterns
      end

      Rake::Task['rubocop_foreman_snapshot_management'].invoke
    end

    desc 'Runs Rubocop style checker with xml output for Jenkins'
    RuboCop::RakeTask.new('rubocop:jenkins') do |task|
      task.patterns = test_patterns
      task.requires = ['rubocop/formatter/checkstyle_formatter']
      task.formatters = ['RuboCop::Formatter::CheckstyleFormatter']
      task.options = ['--no-color', '--out', 'rubocop.xml']
    end
  end
rescue LoadError
  puts 'Rubocop not loaded.'
end

namespace :jenkins do
  desc 'Test ForemanSnapshotManagement with XML output for jenkins'
  task 'foreman_snapshot_management' do
    Rake::Task['jenkins:setup:minitest'].invoke
    Rake::Task['rake:test:foreman_snapshot_management'].invoke
  end
end

Rake::Task[:test].enhance ['test:foreman_snapshot_management']

load 'tasks/jenkins.rake'
Rake::Task['jenkins:unit'].enhance ['test:foreman_snapshot_management', 'foreman_snapshot_management:rubocop'] if Rake::Task.task_defined?(:'jenkins:unit')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_snapshot_management-1.7.1 lib/tasks/foreman_snapshot_management_tasks.rake
foreman_snapshot_management-1.7.0 lib/tasks/foreman_snapshot_management_tasks.rake
foreman_snapshot_management-1.6.1 lib/tasks/foreman_snapshot_management_tasks.rake