ruby-lsp 0.7.1 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ruby_lsp/setup_bundler.rb +21 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dba33af47ce558162b73c39422465b451e4af9e835d9446ff90414de0f44fd66
|
4
|
+
data.tar.gz: fb9b769fceb2563b2392b6395cb65a17511e5dee9614d8158fb28c5bd5628843
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53b879df720b44940dc838245a174bebc08849d6673a9076b612df90a47036e69fdc367cc7e0dc3df934a762758e36cebea2d6c84e4b3e992023f2bf9056b14f
|
7
|
+
data.tar.gz: 65856714024b1329d693cc49eb3e846af1b7737dfd4f914ddb2b677ddada993cca65f81ec9447605325380aee2564930ee2401efc87e57f9d11e92600533d9ca
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.3
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# typed: strict
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
require "sorbet-runtime"
|
4
5
|
require "bundler"
|
5
6
|
require "fileutils"
|
6
7
|
|
@@ -16,6 +17,14 @@ module RubyLsp
|
|
16
17
|
def initialize(project_path)
|
17
18
|
@project_path = project_path
|
18
19
|
@dependencies = T.let(load_dependencies, T::Hash[String, T.untyped])
|
20
|
+
@custom_bundle_dependencies = T.let(
|
21
|
+
if File.exist?(".ruby-lsp/Gemfile.lock")
|
22
|
+
Bundler::LockfileParser.new(Bundler.read_file(".ruby-lsp/Gemfile.lock")).dependencies
|
23
|
+
else
|
24
|
+
{}
|
25
|
+
end,
|
26
|
+
T::Hash[String, T.untyped],
|
27
|
+
)
|
19
28
|
end
|
20
29
|
|
21
30
|
sig { void }
|
@@ -30,6 +39,11 @@ module RubyLsp
|
|
30
39
|
# Do not setup a custom bundle if both `ruby-lsp` and `debug` are already in the Gemfile
|
31
40
|
if @dependencies["ruby-lsp"] && @dependencies["debug"]
|
32
41
|
warn("Ruby LSP> Skipping custom bundle setup since both `ruby-lsp` and `debug` are already in the Gemfile")
|
42
|
+
|
43
|
+
# If the user decided to add the `ruby-lsp` and `debug` to their Gemfile after having already run the Ruby LSP,
|
44
|
+
# then we need to remove the `.ruby-lsp` folder, otherwise we will run `bundle install` for the top level and
|
45
|
+
# try to execute the Ruby LSP using the custom bundle, which will fail since the gems are not installed there
|
46
|
+
FileUtils.rm_r(".ruby-lsp") if Dir.exist?(".ruby-lsp")
|
33
47
|
run_bundle_install
|
34
48
|
return
|
35
49
|
end
|
@@ -111,7 +125,13 @@ module RubyLsp
|
|
111
125
|
command << "BUNDLE_PATH=#{File.expand_path(path, Dir.pwd)} " if path
|
112
126
|
command << "BUNDLE_GEMFILE=#{bundle_gemfile} " if bundle_gemfile
|
113
127
|
|
114
|
-
|
128
|
+
# If both `ruby-lsp` and `debug` are already in the Gemfile, then we shouldn't try to upgrade them or else we'll
|
129
|
+
# produce undesired source control changes. If the custom bundle was just created and either `ruby-lsp` or `debug`
|
130
|
+
# weren't a part of the Gemfile, then we need to run `bundle install` for the first time to generate the
|
131
|
+
# Gemfile.lock with them included or else Bundler will complain that they're missing. We can only update if the
|
132
|
+
# custom `.ruby-lsp/Gemfile.lock` already exists and includes both gems
|
133
|
+
if (@dependencies["ruby-lsp"] && @dependencies["debug"]) ||
|
134
|
+
@custom_bundle_dependencies["ruby-lsp"].nil? || @custom_bundle_dependencies["debug"].nil?
|
115
135
|
# Install gems using the custom bundle
|
116
136
|
command << "bundle install "
|
117
137
|
else
|