Sha256: acd3a5f2aed70f734cdb29dbfb8624e1cd292bad662b6db52d8111ea19b93095
Contents?: true
Size: 1.79 KB
Versions: 8
Compression:
Stored size: 1.79 KB
Contents
# frozen_string_literal: true require "refinements/arrays" module Gemsmith module Generators # Generates Rake support. class Rake < Base using Refinements::Arrays def generate_code_quality_task return "" if code_quality_tasks.empty? %(\ndesc "Run code quality checks"\ntask code_quality: %i[#{code_quality_tasks}]\n) end def generate_default_task return "" if default_task.empty? %(\ntask default: %i[#{default_task}]\n) end def run template "%gem_name%/Rakefile.tt" append_code_quality_task append_default_task end private def rspec_task configuration.dig(:generate, :rspec) ? "spec" : "" end def bundler_audit_task configuration.dig(:generate, :bundler_audit) ? "bundle:audit" : "" end def git_cop_task configuration.dig(:generate, :git_cop) ? "git_cop" : "" end def reek_task configuration.dig(:generate, :reek) ? "reek" : "" end def rubocop_task configuration.dig(:generate, :rubocop) ? "rubocop" : "" end def code_quality_tasks [ bundler_audit_task, git_cop_task, reek_task, rubocop_task ].compress.join " " end def code_quality_task code_quality_tasks.empty? ? "" : "code_quality" end def default_task [code_quality_task, rspec_task].compress.join " " end def append_code_quality_task return if code_quality_task.empty? cli.append_to_file "%gem_name%/Rakefile", generate_code_quality_task end def append_default_task return if default_task.empty? cli.append_to_file "%gem_name%/Rakefile", generate_default_task end end end end
Version data entries
8 entries across 8 versions & 1 rubygems