|
2 | 2 |
|
3 | 3 | require 'rake' |
4 | 4 | require 'rspec/core/rake_task' |
5 | | -require 'yard' |
| 5 | + |
| 6 | +is_lite_mode = ENV.fetch('MINDEE_GEM_NAME', 'mindee') == 'mindee-lite' |
6 | 7 |
|
7 | 8 | begin |
8 | 9 | require 'bundler/setup' |
9 | | - Bundler::GemHelper.install_tasks |
| 10 | + require 'bundler/gem_helper' |
| 11 | + Bundler::GemHelper.install_tasks(name: ENV.fetch('MINDEE_GEM_NAME', 'mindee')) |
10 | 12 | rescue LoadError |
11 | 13 | puts 'although not required, bundler is recommended for running the tests' |
12 | 14 | end |
13 | 15 |
|
14 | 16 | task default: :spec |
| 17 | +exclusion_opts = is_lite_mode ? ['--tag', '~all_deps'] : [] |
| 18 | +RSpec::Core::RakeTask.new(:spec) do |t| |
| 19 | + t.rspec_opts = exclusion_opts |
| 20 | +end |
| 21 | +unless is_lite_mode |
| 22 | + require 'yard' |
| 23 | + desc 'Generate documentation' |
| 24 | + YARD::Rake::YardocTask.new(:doc) do |task| |
| 25 | + task.files = ['lib/**/*.rb'] |
| 26 | + end |
15 | 27 |
|
16 | | -RSpec::Core::RakeTask.new(:spec) |
17 | | - |
18 | | -desc 'Generate documentation' |
19 | | -YARD::Rake::YardocTask.new(:doc) do |task| |
20 | | - task.files = ['lib/**/*.rb'] |
| 28 | + Rake::Task[:doc].enhance do |
| 29 | + FileUtils.cp_r( |
| 30 | + File.join('docs', 'code_samples'), |
| 31 | + File.join('docs', '_build') |
| 32 | + ) |
| 33 | + end |
21 | 34 | end |
22 | 35 |
|
23 | 36 | desc 'Run integration tests' |
24 | 37 | RSpec::Core::RakeTask.new(:integration) do |t| |
25 | 38 | t.pattern = 'spec/**/*_integration.rb' |
26 | | - t.rspec_opts = ['--require', 'integration_helper'] |
27 | | -end |
28 | | - |
29 | | -Rake::Task[:doc].enhance do |
30 | | - FileUtils.cp_r( |
31 | | - File.join('docs', 'code_samples'), |
32 | | - File.join('docs', '_build') |
33 | | - ) |
| 39 | + t.rspec_opts = ['--require', 'integration_helper'] + exclusion_opts |
34 | 40 | end |
0 commit comments