This repository was archived by the owner on Jul 31, 2023. It is now read-only.
This repository was archived by the owner on Jul 31, 2023. It is now read-only.
Gitpod: Can't find rubocop command #761
Open
Description
Your environment
vscode-ruby
version: 0.27.0- Ruby version: 3.0.0
- Ruby version manager (if any): RVM
- VS Code version: 1.58.2
- Operating System: Gitpod (I think Linux)
- Using language server? (eg
useLanguageServer
is true in your configuration?) Yes
Expected behavior
I expect VS Code to find rubocop
as it is installed as a gem and is accessible from the terminal.
Actual behavior
This issue is probably specific to Gitpod and I have found a solution that feels hacky. So I would like to discuss it here and see if I'm missing something. When I install Ruby with the following Dockerfile, rubocop
is accessible from the terminal but VS Code can't find the command:
FROM gitpod/workspace-postgres
USER gitpod
# Install the Ruby version specified in '.ruby-version'
COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc
I get the following error in the Language Server Output:
Lint: executing rubocop -s '/workspace/fugu/app/controllers/projects_controller.rb' -f json -R -l...
Lint: unable to execute rubocop -s '/workspace/fugu/app/controllers/projects_controller.rb' -f json -R -l as the command could not be found
SIGPIPE received
which ruby
returns this:
/home/gitpod/.rvm/rubies/ruby-3.0.0/bin/ruby
which rubocop
returns this:
/workspace/.rvm/ruby-3.0.0/bin/rubocop
Both paths are in my $PATH
variable.
If I install the rubocop gems like this in the Dockerfile, it works:
FROM gitpod/workspace-postgres
USER gitpod
# Install the Ruby version specified in '.ruby-version'
COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails rubocop rubocop-performance rubocop-rails rubocop-rspec"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc
You can find my repo here run it directly in Gitpod here (you need a free Gitpod account).
Is this expected behavior or some bug?