File: Rakefile

package info (click to toggle)
ruby-byebug 11.1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,252 kB
  • sloc: ruby: 8,835; ansic: 1,662; sh: 6; makefile: 4
file content (156 lines) | stat: -rw-r--r-- 3,157 bytes parent folder | download | duplicates (3)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# frozen_string_literal: true

require "bundler/gem_tasks"
require "chandler/tasks"
require "rake/extensiontask"
require "yard"

#
# Add chandler as a prerequisite for `rake release`
#
task "release:rubygem_push" => "chandler:push"

#
# Prepend DevKit into compilation phase
#
if Gem.win_platform?
  desc "Activates DevKit"
  task :devkit do
    begin
      require "devkit"
    rescue LoadError
      abort "Failed to load DevKit required for compilation"
    end
  end

  task compile: :devkit
end

spec = Gem::Specification.load("byebug.gemspec")
Rake::ExtensionTask.new("byebug", spec) { |ext| ext.lib_dir = "lib/byebug" }

desc "Runs the test suite"
task :test do
  require_relative "test/minitest_runner"

  exit 1 unless Byebug::MinitestRunner.new.run
end

namespace :lint do
  desc "Run all linters"
  task all: %i[clang_format executables tabs trailing_whitespace rubocop mdl]

  require_relative "tasks/linter"

  desc "Run clang_format on C files"
  task :clang_format do
    puts "Running linter on C files"

    CLangFormatLinter.new.run
  end

  desc "Check unnecessary execute permissions"
  task :executables do
    puts "Checking for unnecessary executables"

    ExecutableLinter.new.run
  end

  desc "Check for tabs"
  task :tabs do
    puts "Checking for unnecessary tabs"

    TabLinter.new.run
  end

  desc "Check for trailing whitespace"
  task :trailing_whitespace do
    puts "Checking for unnecessary trailing whitespace"

    TrailingWhitespaceLinter.new.run
  end

  require "rubocop/rake_task"

  desc "Checks ruby code style with RuboCop"
  RuboCop::RakeTask.new

  desc "Checks markdown code style with Markdownlint"
  task :mdl do
    puts "Running mdl"

    sh("mdl", *Dir.glob("*.md"))
  end

  desc "Checks shell code style with shellcheck"
  task :shellcheck do
    puts "Running shellcheck"

    sh("shellcheck", *Dir.glob("bin/*.sh"))
  end
end

desc "Runs lint tasks"
task lint: "lint:all"

namespace :docker do
  require_relative "docker/manager"

  desc "Build all docker images"
  task :build_all do
    Docker::Manager.build_all
  end

  desc "Build the default docker image"
  task :build do
    Docker::Manager.build_default
  end

  desc "Build a ruby trunk image"
  task :build_and_push_head, %i[line_editor compiler] do |_t, opts|
    manager = Docker::Manager.new(
      version: "head",
      line_editor: opts[:line_editor],
      compiler: opts[:compiler]
    )

    manager.build
    manager.login
    manager.push
  end

  desc "Test all docker images"
  task :test_all do
    Docker::Manager.test_all
  end

  desc "Test the default docker image"
  task :test do
    Docker::Manager.test_default
  end

  desc "Push all docker images to dockerhub"
  task :push_all do
    Docker::Manager.push_all
  end

  desc "Push the default docker image to dockerhub"
  task :push do
    Docker::Manager.push_default
  end
end

task default: %i[compile test lint]

YARD::Rake::YardocTask.new

namespace :coverage do
  desc "Merges all result sets into a single coverage report"
  task :collate do
    ENV["COV_COLLATION"] = "true"

    require "simplecov"

    SimpleCov.collate Dir["coverage/*.json"]
  end
end