I fool-hardily removed my system installation of gem. I was trying to get rbenv to work and was having some problems so I thought I could easily re-install all my Ruby stuff and start from scratch. This however is clearly not the case.
Any ideas short of breaking out the system disk would be appreciated.
Related
I am searching for simple Ruby gem that would be able to find definitions of methods.
First I installed this:
But it requires some gems(rubocop, ruby-debug-ide or solargraph) to be installed in order to work. It provides a lot of features as debugging etc, but I dont need them. I only want to be able to find methods definition.
I am using Vscode to access Rails project on network directory. So I don't want to install Ruby on my host OS (Windoiws 10 x64). Instead I provide a network directory to a guest Guiless Ubuntu (as Guest OS). The Rails server is run on the Ubuntu OS.
VSCode works perfectly well with network directories, but the extensions need Ruby environment that is pretty sad.
For example Sublime Text 3 does this painlessly and donesn't complain for gems. Even without having any Ruby stuff on the OS it is running on:
I want to stick with VSCode because it is the best I have used so far.
So the question is: Is there a Ruby extension for VSCODE that works without Ruby installed?
The only thing that can really parse Ruby is Ruby, so you need Ruby when working with Ruby code. Same goes for a lot of other languages in Visual Studio Code. Sublime provides a "good enough" reflector based on a very simplistic syntax parse. Visual Studio Code uses Solargraph which does way more.
If you don't like that requirement you can always use or write a different Ruby plugin that has no such dependencies. As someone who does a lot of Ruby work, though, the installation is a minor inconvenience for all the benefits it provides.
#Hairi have you tried the ruby-symbols extension?
https://github.com/rubyide/vscode-ruby/issues/40
Keyboard shortcut for Windows is Ctrl + Shift + O.
And for Macs, it's Cmd + Shift + O.
Due to my own idiocracy I have managed to run two versions of Apache on my Mac OS. Since a late update to Sierra my webserver has fallen into decay. I feel it is only a matter of time, until the whole environment breaks down and the OS is doomed for reincarnation.
For now I have managed to get my system side Apache running. However I have found that my "apachectl" command has been replaced with the brew version of apache. Since I am not strong with cmd line I want to ask how I can revert this? For now I am starting system side apache with "/usr/sbin/apachectl start".
If anyone could give me some advice how to keep the two versions from colliding, I would be more than grateful: keep brew apache from autoloading, check for which httpd processes are running and where they are rooted, put brew apache in a dumpster in the middle of the night etc.
I also have brew versions of php installed but I dare not to uninstall due to dependencies... any advide here would be appreciated as well.
IF ANY NEWCOMER READS THIS THREAD: Since I updated my Mac OS to the new Sierra my whole Apache configurations have gone mad. Unfortunately I have followed a very, very bad tutorial a few updates ago (https://www.getgrav.org/blog/macos-sierra-apache-multiple-php-versions) to configure my web development environment. I RECOMMEND EVERYONE TO AVOID THIS TUTORIAL! The blogger writes that his tutorial is only for advanced developers, however the tutorial itself is a total mess: there are no hints for any backup files and the configurations are all in bad style... I would advise anyone to double check on custom configurations in apache and always backup every file you change! For me it is too late and I feel only a hard reset of the system will suffice. Dark days on the horizon...
When you upgraded to the new OS, it does change your default apache config. The good thing is it does save a copy and renames it to httpd.conf~previous also creates a folder under etc/apache2/original for the previous default version. Just copy them back over and you're good to go.
Also you can throw homebrew in the dumpster using their own script
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Hope that helps.
It seems every week I have to clean up the environment variables, uninstall all gems (I've even memorized the one liner command by now) and reinstall Ruby, DevKit, Gems, Rails, Heroku, etc. Most of the time it works and it's ok for a few days, but it's not long before the "x is not recognized as an internal or external command" or "The native gem requires installed build tools" errors start creeping up, until development becomes impossible.
Surely this can't be normal, but as far as I know I'm not doing anything explicitly wrong. I do things the same way I used to do on my Mac, and it just worked. But I'm at the end of my rope with this OS.
Any ideas?
Really all you should need is to have the Ruby you're using's bin folder at the start of your PATH (start for safety sake). And make sure you don't have any others in there.
For the "requires installed build tools" I usually just add these to the system path, your equivalent:
C:\installs\devkit451\devkit451\bin;C:\installs\devkit451\devkit451\mingw\bin;
HTH.
What's the simplest way -- ideally a single click -- to set up a ruby (not rails) runtime environment on a local Windows system (not a web site), with specific gems?
I have code for a customer that runs on their local system. I've been sending them ocra executables, and that sorta, kinda, usually works, but is showing more problems all the time.
So I want to set up a native ruby environment there -- actually I want them to set it up -- so I can just send straight ruby code. But it's got to have the specific gems I use (FxRuby, several others).
Most important, it's gotta be dead simple for them -- ideally a single click. I'm trying to avoid a physical trip to their site.
Thanks.
As they are running Windows why not go to the ruby-lang.org website and download the windows installer - depending on the edition they do come with gems - some with FXRuby (which I use myself) you can then send the app to them and they can install Ruby - It is quiite simple to do.
In the ruby code before you make it an ocra file put
`gem install mygem`
`gem install myothergem`
in backsticks...
This will run in the command line of the receiving computer. Then require the gems later in your script.
Let me know if this works.
I love RVM. I realize that the main use case for it is letting different users switch between different versions of Ruby. But let's say I'm deploying a Rails app to a server and I just want a single version of Ruby running. In particular, I want 1.9.2, which is a breeze to install with RVM but a pain without it. Is there a way that I can say "I want this to be the canonical Ruby installation for all users" (along with all of its gems) without having to create a bunch of symlinks by hand and change them every time I update to a newer Ruby release?
Install RVM as root and do a sudo rvm use 1.9.2 --default. Any user sourcing /usr/local/rvm/scripts/rvm will per default have 1.9.2.
I know this doesn't quite answer your question, but:
I ran into several problems with installing RVM globally and resorted to using one user account for deployment and for all Ruby / Rails processes -- that users account exists on all dev and production servers, and the .rvm directory is rsync'ed from one dev-server to all other servers.
How many different users on your App servers do really need to access Ruby 1.9.2?
Can't you just trim that down to just one user? That worked best for me.
Note:
One thing you probably want to avoid is to install RVM on your app server(s) manually and then install Ruby and Gems on the app server ... you don't want to keep tools like cc lying around on your production servers for security reasons! rsync'ing the .rvm directory is far safer! and the result is far more consistent!