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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
require "bundler/gem_tasks"
defaults = []
# See: https://docs.gitlab.com/ci/variables/predefined_variables/
is_gitlab = ENV.fetch("GITLAB_CI", "false").casecmp("true") == 0
### DEVELOPMENT TASKS
# Setup Kettle Soup Cover
begin
require "kettle-soup-cover"
Kettle::Soup::Cover.install_tasks
# NOTE: Coverage on CI is configured independent of this task.
# This task is for local development, as it opens results in browser
defaults << "coverage" unless Kettle::Soup::Cover::IS_CI
rescue LoadError
desc("(stub) coverage is unavailable")
task("coverage") do
warn("NOTE: kettle-soup-cover isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
# Setup Bundle Audit
begin
require "bundler/audit/task"
Bundler::Audit::Task.new
defaults.push("bundle:audit:update", "bundle:audit")
rescue LoadError
desc("(stub) bundle:audit is unavailable")
task("bundle:audit") do
warn("NOTE: bundler-audit isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
desc("(stub) bundle:audit:update is unavailable")
task("bundle:audit:update") do
warn("NOTE: bundler-audit isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
defaults << "spec"
rescue LoadError
desc("spec task stub")
task(:spec) do
warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
desc "run spec task with test task"
task test: :spec
# Setup RuboCop-LTS
begin
require "rubocop/lts"
Rubocop::Lts.install_tasks
# Make autocorrect the default rubocop task
defaults << "rubocop_gradual:autocorrect"
rescue LoadError
desc("(stub) rubocop_gradual is unavailable")
task(:rubocop_gradual) do
warn("NOTE: rubocop-lts isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
# Setup Yard
begin
require "yard"
YARD::Rake::YardocTask.new(:yard) do |t|
t.files = [
# Source Splats (alphabetical)
"lib/**/*.rb",
"-", # source and extra docs are separated by "-"
# Extra Files (alphabetical)
"*.md",
"*.txt",
]
end
defaults << "yard"
rescue LoadError
desc("(stub) yard is unavailable")
task(:yard) do
warn("NOTE: yard isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
# Setup Reek
begin
require "reek/rake/task"
Reek::Rake::Task.new do |t|
t.fail_on_error = true
t.verbose = false
t.source_files = "{lib,spec}/**/*.rb"
end
defaults << "reek" unless is_gitlab
rescue LoadError
desc("(stub) reek is unavailable")
task(:reek) do
warn("NOTE: reek isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
### RELEASE TASKS
# Setup stone_checksums
begin
require "stone_checksums"
GemChecksums.install_tasks
rescue LoadError
desc("(stub) build:generate_checksums is unavailable")
task("build:generate_checksums") do
warn("NOTE: stone_checksums isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
task default: defaults
|