Sha256: cf052d5574b3da0c4defa329237daea1910d5924b4925ee0d8e7841bfb744146

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require "bundler/gem_tasks"
require "rufo"

begin
  require "rspec/core/rake_task"
  RSpec::Core::RakeTask.new(:spec)
end

require "rubocop/rake_task"
RuboCop::RakeTask.new(:rubocop) do |task|
  task.options = %w[--parallel]
end

desc "Alias for `rake rufo:run`"
task :format => ["rufo:run"]

namespace :rufo do
  require "rufo"

  def rufo_command(*switches, rake_args)
    files_or_dirs = rake_args[:files_or_dirs] || "."
    args = switches + files_or_dirs.split(" ")
    Rufo::Command.run(args)
  end

  desc "Format Ruby code in current directory"
  task :run, [:files_or_dirs] do |_task, rake_args|
    rufo_command(rake_args)
  end

  desc "Check that no formatting changes are produced"
  task :check, [:files_or_dirs] do |_task, rake_args|
    rufo_command("--check", rake_args)
  end
end

desc "Generate test protobuf stubs"
task :gen_test_proto do
  system "grpc_tools_ruby_protoc --ruby_out=. --grpc_out=. spec/support/grpc_service/test.proto"
  Rufo::Command.run(["spec/support/grpc_service/test_pb.rb", "spec/support/grpc_service/test_services_pb.rb"])
end

task :fix => %w[rufo:run rubocop:auto_correct]

task :verify => %w[spec rufo:check rubocop]

task :default => %w[verify build]

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab-labkit-0.19.0 Rakefile
gitlab-labkit-0.18.0 Rakefile
gitlab-labkit-0.17.1 Rakefile