Skip to content

Commit 362d46d

Browse files
authored
2025-04-28 v. 9.3.5.1: added new checkers
2 parents 3b8eabd + 126dc95 commit 362d46d

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

Rakefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@ require 'rake/testtask'
1919
end
2020

2121
desc 'Run all custom checks for CI'
22+
require_relative './ci/master_checker'
2223
require_relative './ci/links_checker'
2324
require_relative './ci/readme_duplicates_checker'
2425
require_relative './ci/readme_paths_checker'
2526
require_relative './ci/tests_checker'
2627
require_relative './ci/version_checker'
2728
require_relative './ci/duplicate_links_checker'
29+
require_relative './ci/stage_checker'
2830
task :ci do
2931
[
32+
::CI::MasterChecker.new,
3033
::CI::LinksChecker.new,
3134
::CI::ReadmeDuplicatesChecker.new,
3235
::CI::ReadmePathsChecker.new,
3336
::CI::TestsChecker.new,
3437
::CI::VersionChecker.new,
35-
::CI::DuplicateLinksChecker.new
38+
::CI::DuplicateLinksChecker.new,
39+
::CI::StageChecker.new
3640
].each(&:process)
3741
end

ci/ci_job.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def run
2020
end
2121

2222
# Use this method in your realization when task completed with error.
23-
# @param {String} details
23+
# @param {Proc} details
2424
# @return {Void}
2525
def end_with_error(details)
2626
details.call

ci/master_checker.rb

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# frozen_string_literal: true
2+
3+
require_relative './ci_job'
4+
5+
module CI
6+
# CI job that checks that we are not in master branch.
7+
class MasterChecker < CIJob
8+
# Process MasterChecker.
9+
# @return {Void}
10+
def process
11+
current_branch = `git rev-parse --abbrev-ref HEAD`.strip
12+
13+
return unless current_branch == 'master'
14+
15+
end_with_error(-> { puts('MasterChecker ends with an error. You cannot commit directly to master branch.') })
16+
end
17+
end
18+
end

ci/stage_checker.rb

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
require_relative './ci_job'
4+
5+
module CI
6+
# CI job that add all files to stage for commit.
7+
class StageChecker < ::CI::CIJob
8+
# Process StageChecker.
9+
# @return {Void}
10+
def process = `git add -u`
11+
end
12+
end

leetcode-ruby.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require 'English'
55
::Gem::Specification.new do |s|
66
s.required_ruby_version = '>= 3.0'
77
s.name = 'leetcode-ruby'
8-
s.version = '9.3.5'
8+
s.version = '9.3.5.1'
99
s.license = 'MIT'
1010
s.files = ::Dir['lib/**/*.rb'] + %w[README.md]
1111
s.executable = 'leetcode-ruby'

0 commit comments

Comments
 (0)