Skip to content

Commit 97f817d

Browse files
vinistockKaanOzkanMorriaralexcrochajesse-shopify
committed
Remove --branch flag from server
Co-authored-by: Kaan Ozkan <KaanOzkan@users.noreply.github.com> Co-authored-by: Alexandre Terrasa <Morriar@users.noreply.github.com> Co-authored-by: Alex Rocha <alexcrocha@users.noreply.github.com> Co-authored-by: Jesse Johnson <jesse-shopify@users.noreply.github.com> Co-authored-by: Stan Lo <st0012@users.noreply.github.com> Co-authored-by: Julia Boutin <dejmedus@users.noreply.github.com>
1 parent 9e53e7e commit 97f817d

6 files changed

Lines changed: 4 additions & 35 deletions

File tree

exe/ruby-lsp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@ parser = OptionParser.new do |opts|
2121
options[:time_index] = true
2222
end
2323

24-
opts.on(
25-
"--branch [BRANCH]",
26-
"Launch the Ruby LSP using the specified branch rather than the release version",
27-
) do |branch|
28-
options[:branch] = branch
29-
end
30-
3124
opts.on("--doctor", "Run troubleshooting steps") do
3225
options[:doctor] = true
3326
end
@@ -70,7 +63,6 @@ if ENV["BUNDLE_GEMFILE"].nil?
7063
flags = []
7164
flags << "--debug" if options[:debug]
7265
flags << "--beta" if options[:beta]
73-
flags.push("--branch", options[:branch]) if options[:branch]
7466
exit exec(Gem.ruby, File.expand_path("ruby-lsp-launcher", __dir__), *flags)
7567
end
7668

exe/ruby-lsp-launcher

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ reboot = false
2020
workspace_uri = ARGV.first
2121
raw_initialize_path = File.join(".ruby-lsp", "raw_initialize")
2222

23-
# Extract CLI options that affect bundle composition (e.g. --branch, --beta) from the arguments passed by the server
23+
# Extract CLI options that affect bundle composition (e.g. --beta) from the arguments passed by the server
2424
cli_options = {}
25-
branch_index = ARGV.index("--branch")
26-
cli_options[:branch] = ARGV[branch_index + 1] if branch_index
2725
cli_options[:beta] = true if ARGV.include?("--beta")
2826

2927
raw_initialize = if workspace_uri && !workspace_uri.start_with?("--")
@@ -57,7 +55,6 @@ pid = if Gem.win_platform?
5755

5856
cli_flags = []
5957
cli_flags << "--beta" if cli_options[:beta]
60-
cli_flags.push("--branch", cli_options[:branch]) if cli_options[:branch]
6158

6259
Process.spawn(
6360
Gem.ruby,

lib/ruby_lsp/scripts/compose_bundle_windows.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@
77
# invoke the compose method from inside a forked process
88
options = {}
99
options[:beta] = true if ARGV.include?("--beta")
10-
branch_index = ARGV.index("--branch")
11-
options[:branch] = ARGV[branch_index + 1] if branch_index
1210
compose(ARGV.first, **options)

lib/ruby_lsp/setup_bundler.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def stdout
3939
#: (String project_path, **untyped options) -> void
4040
def initialize(project_path, **options)
4141
@project_path = project_path
42-
@branch = options[:branch] #: String?
4342
@launcher = options[:launcher] #: bool?
4443
@beta = options[:beta] #: bool?
4544
force_output_to_stderr! if @launcher
@@ -178,9 +177,7 @@ def write_custom_gemfile
178177

179178
unless @dependencies["ruby-lsp"]
180179
version = @beta ? "0.a" : RUBY_LSP_MIN_VERSION
181-
ruby_lsp_entry = +"gem \"ruby-lsp\", \">= #{version}\", require: false, group: :development"
182-
ruby_lsp_entry << ", github: \"Shopify/ruby-lsp\", branch: \"#{@branch}\"" if @branch
183-
parts << ruby_lsp_entry
180+
parts << "gem \"ruby-lsp\", \">= #{version}\", require: false, group: :development"
184181
end
185182

186183
unless @dependencies["debug"]

test/server_test.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ def test_invalid_location_errors_are_not_reported_to_telemetry
17001700

17011701
def test_launch_bundle_compose_forwards_argv_to_launcher
17021702
original_argv = ARGV.dup
1703-
ARGV.replace(["--branch", "main"])
1703+
ARGV.replace(["--beta"])
17041704

17051705
@server.global_state.apply_options({
17061706
workspaceFolders: [{ uri: URI::Generic.from_path(path: Dir.pwd).to_s }],
@@ -1721,8 +1721,7 @@ def test_launch_bundle_compose_forwards_argv_to_launcher
17211721
thread = @server.send(:launch_bundle_compose, "Test") { |_stderr, _status| }
17221722
thread.join
17231723

1724-
assert_includes(captured_args, "--branch")
1725-
assert_includes(captured_args, "main")
1724+
assert_includes(captured_args, "--beta")
17261725
ensure
17271726
ARGV.replace(original_argv)
17281727
end

test/setup_bundler_test.rb

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -302,20 +302,6 @@ def test_does_not_create_composed_gemfile_if_both_ruby_lsp_and_debug_are_gemspec
302302
end
303303
end
304304

305-
def test_creates_composed_bundle_with_specified_branch
306-
in_temp_dir do |dir|
307-
Bundler.with_unbundled_env do
308-
stub_bundle_with_env(bundle_env(dir, ".ruby-lsp/Gemfile"))
309-
run_script(File.realpath(dir), branch: "test-branch")
310-
end
311-
312-
assert_path_exists(".ruby-lsp")
313-
assert_path_exists(".ruby-lsp/Gemfile")
314-
assert_match(%r{ruby-lsp.*github: "Shopify/ruby-lsp", branch: "test-branch"}, File.read(".ruby-lsp/Gemfile"))
315-
assert_match("debug", File.read(".ruby-lsp/Gemfile"))
316-
end
317-
end
318-
319305
def test_returns_bundle_app_config_if_there_is_local_config
320306
in_temp_dir do |dir|
321307
Bundler.with_unbundled_env do

0 commit comments

Comments
 (0)