-
-
Notifications
You must be signed in to change notification settings - Fork 100
It would be nice to be able to run the plugin in Docker #1241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I will attempt to fix this, but I highly suggest you just run with https://github.com/ruby-syntax-tree/syntax_tree, it's going to make your life a lot easier. |
We solved this by adding the prettier gem in the Gemfile group :prettier do
gem 'prettier'
end and then running something like this in the Dockerfile RUN bundle config set without default development production test && bundle install
RUN npm run prettier ( This way, it just installs the prettier group without the other stuff you don't need for linting. |
We've been getting this same error in CircleCI and haven't been able to sort out a solution for it yet. It's working locally and in my editor (Atom) unsure on VSCode yet. But the main problem is CI.
I've tried about everything in terms of putting the gems in our I'm currently trying to bump ruby to @kddnewton are you suggesting to replace |
@darrenterhune, yeah I would highly suggest going with syntax tree for formatting. It is only Ruby, so the setup should be much simpler. |
@dhughes I'm really not sure what the issue is to be honest. It seems like you probably don't have all of the right gems installed OR they're not on a path that Ruby can find them. If they were on a path where Ruby could find them, you'd be able to run the Another thing to try for debugging would be |
Also, #1232 (comment) might provide more insight into what you're facing. |
@dhughes can you let me know if this is still a problem once you have the dependencies? I'll close for now. |
Metadata
@prettier/plugin-ruby
orprettier
gem version: 3.1.2syntax_tree
version: 2.7.1Input
N/A
Suggestion
My team uses Docker for development. We run a set of containers that host our application and its assorted dependencies. We write code in whatever editor an engineer chooses on our local machines. Most of us use Macs, since that's what the company supplies, but one engineer prefers Windows. When provided to engineers, the Macs are minimally provisioned with most of the requirements for development work. Since we don't use Ruby on the host machine for development, the provisioning process doesn't install Ruby, which leaves engineers with the system Ruby as a default. Our application currently runs on Ruby 2.7.4. It uses gems that are difficult to install on Mac, such as rmagick (and I have no idea if they can be installed on Windows). The Mac system version of Ruby is currently 2.6.x, I think.
All of that is to say, our application won't even run on Mac OS out of the box due to the default Ruby version and gem challenges. Maybe it could be made to, but it'd be really difficult. I'm just trying to give some context on this request....
With plugin-ruby depending on a few gems, it seems logical that we could just add them to our gem file, bundle install, and start using Prettier with plugin-ruby. That works just fine in Docker, but not on our host Macs. (Side note: we don't have problems with Prettier for JS and JSX, since we happen to have a useful version of Node installed and there are no dependencies that won't install. For the ruby side of things, we can't even run a bundle install. This makes plugin-ruby unusable on the Mac side of things.
I did try manually installing Ruby 2.7.4 (which plugin-ruby supports) and manually installing the gems with
gem install bundler prettier_print syntax_tree syntax_tree-haml syntax_tree-rbs
, but for some reason Prettier reports that some gems aren't installed and an error is printed:We've been using plugin-ruby version 2.0.0 with a bit of success, though there are some formatting errors that prevent us from really using it as a team.
Anyhow, it would be really nice if, somehow, we could optionally use the Ruby dependencies for plugin-ruby in a Docker container. I realize this would be significantly slower, but it would help out team get over this hurdle.
FWIW, I tried creating a wrapper for Prettier that would just run the prettier command in docker. This works from the command line, but won't work for the code editors I've looked at (VS Code and Rubymine) since they both depend on the path in
node_modules
.I'd be interested in suggestions you may have and wanted to share my teams experience. I appreciate the hard work on this project!
The text was updated successfully, but these errors were encountered: