-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
99 lines (82 loc) · 2.17 KB
/
Rakefile
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# frozen_string_literal: true
# rubocop:disable Metrics/LineLength
# rubocop:disable Metrics/BlockLength
require 'yaml'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'fileutils'
require_relative 'lib/ama-entity-mapper/version'
namespace :test do
task :clean do
%w[metadata report].each do |directory|
FileUtils.rm_rf(::File.join(__dir__, 'test', directory))
end
end
task :report do
sh 'allure generate --clean -o test/report/allure test/metadata/allure/**'
end
types = %i[unit integration acceptance]
types.each do |type|
task type do
Rake::Task[:'test:clean'].invoke
types.each do |stage|
Rake::Task[:"test:#{stage}:only"].invoke
break if stage == type
end
end
namespace type do
RSpec::Core::RakeTask.new(:only).tap do |task|
task.pattern = "suite/#{type}/**/*.spec.rb"
task.rspec_opts = "--default-path test --require support/rspec/#{type}/config"
end
task :'with-report' do
Rake::Task[:'test:clean'].invoke
begin
Rake::Task[:"test:#{type}"].invoke
ensure
Rake::Task[:'test:report'].invoke
end
end
namespace :only do
task :'with-report' do
Rake::Task[:'test:clean'].invoke
begin
Rake::Task[:"test:#{type}:only"].invoke
ensure
Rake::Task[:'test:report'].invoke
end
end
end
end
end
task all: %i[acceptance]
task :'with-report' do
Rake::Task[:'test:clean'].invoke
begin
Rake::Task[:'test:all'].invoke
ensure
Rake::Task[:'test:report'].invoke
end
end
end
task test: %i[test:all]
namespace :lint do
RuboCop::RakeTask.new(:rubocop)
task all: %i[rubocop]
end
task lint: %i[lint:all]
task validate: %i[lint test:with-report]
task :gemspec do
spec = ::Gem::Specification.load("#{__dir__}/ama-entity-mapper.gemspec")
puts spec.to_yaml
end
task :jekyll do
sh 'bundle exec jekyll serve -s docs/ -d docs/_site/ --baseurl /ruby-entity-mapper'
end
task :version do
puts AMA::Entity::Mapper::Version::VERSION
end
task :default do
sh 'bundle exec rake -AT'
end