-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #2604 Alternative to #2605 This moves the two command CI checks into the test suite. They would have cought this error, _expect_ rubocop is available to these. So, create a seperate Gemfile that contains only the gem itself.
- Loading branch information
Showing
7 changed files
with
67 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# typed: strict | ||
# frozen_string_literal: true | ||
|
||
begin | ||
require "rubocop" | ||
rescue LoadError | ||
return | ||
end | ||
|
||
begin | ||
gem("rubocop", ">= 1.4.0") | ||
rescue LoadError | ||
raise StandardError, "Incompatible RuboCop version. Ruby LSP requires >= 1.4.0" | ||
end | ||
|
||
if RuboCop.const_defined?(:LSP) # This condition will be removed when requiring RuboCop >= 1.61. | ||
RuboCop::LSP.enable | ||
end | ||
|
||
require "ruby_lsp/requests/support/rubocop_diagnostic" | ||
require "ruby_lsp/requests/support/rubocop_runner" | ||
require "ruby_lsp/requests/support/rubocop_formatter" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# typed: true | ||
# frozen_string_literal: true | ||
|
||
require "test_helper" | ||
|
||
class IntegrationTest < Minitest::Test | ||
def test_ruby_lsp_doctor_works | ||
skip("CI only") unless ENV["CI"] | ||
in_isolation do | ||
system("bundle exec ruby-lsp --doctor") | ||
assert_equal(0, $CHILD_STATUS) | ||
end | ||
end | ||
|
||
def test_ruby_lsp_check_works | ||
skip("CI only") unless ENV["CI"] | ||
in_isolation do | ||
system("bundle exec ruby-lsp-check") | ||
assert_equal(0, $CHILD_STATUS) | ||
end | ||
end | ||
|
||
private | ||
|
||
def in_isolation(&block) | ||
gem_path = T.must(__dir__) + "/../" | ||
Dir.mktmpdir do |dir| | ||
Dir.chdir(dir) do | ||
File.write(File.join(dir, "Gemfile"), <<~GEMFILE) | ||
source "https://rubygems.org" | ||
gem "ruby-lsp", path: "#{gem_path}" | ||
# This causes ruby-lsp to run in its own directory without | ||
# all the supplementary gems like rubocop | ||
Dir.chdir("#{gem_path}") | ||
GEMFILE | ||
|
||
capture_subprocess_io do | ||
Bundler.with_unbundled_env(&block) | ||
end | ||
end | ||
end | ||
end | ||
end |