RubyMine + Vagrant : Error Copying Gems - ruby-on-rails

I'm currently evaluating RubyMine 7.0.4 on Mac OS X 10.8.5, and I'm trying to get my Ruby on Rails project up and running in the editor but after I try to bundle, I get "Error Copying Gems". Locally I use rbenv but this project uses Vagrant with Ruby 2.1.
I've gone into RubyMine Preferences -> Languages and Frameworks -> Ruby SDK and Gems and set up a "Remote Interpreter" which looks like it is correctly pulling in my Vagrant / SSH information.
After I click OK, it looks like it correctly pulls down the gems, and copies them to the vendor/bundle folder, but then the IDE pops up an error message saying :
"Error Copying Gems - Unknown message with code 'Could not determine the type of file sftp://127.0.0.0.1:2222/......'"
or sometimes I'll get a more detailed error:
"Error Copying Gems - Could not copy sftp://127.0.0.1:2222/usr/bin/sudoedit to file://Users/my.username/Library/Caches/RubyMine70/ruby_stubs/....."
It feels like it is trying to copy them to a local cache folder on my Mac but failing for some reason.

I was facing a similar albeit different problem, maybe you are making the same mistake:
When setting up RubyMine to work with Vagrant, I am assuming you are adding a remote interpreter using the Vagrant dialogue. There it asks you to input the path to ruby executible. This is misleading, what you need is the path to where the gems are installed.
I'm also assuming you using RVM on your VM, as you indicate that you are not using rbenv on your VM.

I solved this by following the symlink steps found http://randycoulman.com/blog/2013/11/05/rubymine-and-vagrant/
Basically, RubyMine isn't trying to save things on your host machine. Its trying to save things to that particular path on your guest OS. I worked around this issue by creating the /Users/user_name/... directory on my guest OS, and then symlinking the directory that has the projects to /vagrant (Again, on the guest OS)

Related

What needs to be changed to run a Rails app created on Windows in Linux?

An intern made a Rails app on his Windows computer several months ago.
I transitioned his files to a RHEL server and installed Ruby, rubygems, Rails, and Ruby Version Manager.
I believe that to run his app on Windows I could just do
bin/rails server
However, when I try this on the server it says
/usr/bin/env: ruby.exe No such file or directory
So, apparently it's still expecting a Windows (.exe) version of Ruby. What do I need to do to transition this Windows app to Linux?
Check in the bin/rails file on your proyect path, probably there's a call to ruby.exe there, it's probably in the first line, change it to this
#!/usr/bin/env ruby
Probably this errors is in other files in the bin folder, check it and change it.
Also, migrating an app from windows to linux can leverage into a lot of issues, so you would need to debug it with pacience. Good luck!

Ruby on Rails - Windows 7 installation, non-english characters in user name

I'm trying to install Ruby on Rails on Windows 7 but I have a problem immediately at the beginning of the configuration. This is the first time I'm trying RoR.
I downloaded RailsInsaller from http://railsinstaller.org/ and installed it successfully. Immediately after the installation when I need to configure environment, I receive an error in cmd:
# Rails Environment Configuration.
open C:\\Users\\\246ero/.ssh/id_rsa failed: No such file or directory.
The system cannot find the path specified.
D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `initialize': No such file o
r directory - C:\Users\|ero/.ssh/id_rsa.pub (Errno::ENOENT)
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `open'
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `<main>'
What is the solution to this problem? Or is there any other way to install RoR on Windows 7? Thank you for your help.
I know it's an old post, but I had the same issue, and I think I've found the solution.
The path that ssh is trying to access contains that character "|" that Ruby doesn't like, that's because your username is "|ero".
To resolve this issue, you should either change your windows username (this should prevent you from a lot of troubles in your future setup), or change your HOME environment variable so that it points to a folder that doesn't contain any accent, space or strange character in its path ! And then re-install Ruby :)
Hope it helps!
I have installed Ruby on Rails in Windows 7. To install ruby on rails on Windows7 follow the steps:
1) install ruby on windows 7. Download from: http://rubyinstaller.org/
2) check ruby is installed correctly by this command ruby -v if this gives command not found error, then set RUBY_HOME="path/to/ruby/bin" in environment variables.
3) install rails by command gem install rails.
and you are done. Enjoy Ruby On Rails on Windows7.
I faced exactly the same problem and found its solution - under Windows XP Pro SP3. You should manually generate the ssh keys pair. Run ssh-keygen from a bash
shell so it generated both id_rsa and id_rsa.pub.
That's easy as 3 mouseclicks:
Start - Programs - Rails Installer - Git Bash
type there "ssh-keygen". Press Enter 2 or 3 times. You're done! The problem is gone now.

Installing RubyMine on Windows 7 persistent error: "Could not find "README" in any of your source paths."

I installed ruby 1.9.3 w/ rubyinstaller-1.9.3-p194.exe, and then installed RubyMine right after, as per directions:
http://www.jetbrains.com/ruby/quickstart/index.html
and
http://rubyinstaller.org/
I have git hub for windows already installed which I don't know if that could cause the problem.
I have also installed ruby and rails several times but I looked through the PATH environment variable for any no longer existing installations and removed them (after having already had this error) which didn't help.
Here are the settings I select in RubyMine.
The error message:
"C:\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:\Ruby193\bin/rails 3.2.6 new "D:/Program Files (x86)/Git/Rails App/asfasf" --skip-test-unit --javascript=jquery --skip --database=postgresql
exist D:/Program Files (x86)/Git/Rails App/asfasf
Could not find "README" in any of your source paths. Your current source paths are:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.6/lib/rails/generators/rails/app/templates
Process finished with exit code 1"
I apologize if I come across as angry / frustrated (I edited this several times to remove it) as I have been trying to get RubyMine to work on Windows 7 or Ubuntu 12.04 and neither have been successful.
Any advice would be greatly appreciated!
I continued searching through the web for information and remembered somewhere installing rails on windows previously that for some reasons files couldn't have spaces in them.
Long story short: make sure your path doesn't have spaces in the name because it breaks rubymine or rails or something along the way.
Changing my project folder to a destination with no spaces solved the problem.

virtual ruby development environment

I mainly do ruby on rails development on my machine but from time to time I end up using other laptops for RoR development. It would be nice if there was something (maybe shell?) which basically bring all the gems installed on my machine to some other machine without leaving any footprints. It's basically a really light VM without the OS stuff.
If it matters, I'm using a mac. Ideally I would like to keep that virtual environment in my dropbox and basically when I use some other machine, I would just get it from my dropbox and start coding and not have to worry about setting up the environment.
Similar to Jacob's answer, I'd recommend using RVM, but I'll expand on it. Here's some brainstorming ideas:
RVM stores its sandbox in your home directory at ~/.rvm. All Ruby instances, plus the associated gems will be stored there. It's a simple addition to the ~/.bashrc file in your Mac to initialize RVM so it's known by the shell when you log into the account. It's also a simple rm -rf ~/.rvm from the commandline to remove the RVM sandbox from the account, followed by removing the line from the ~/.bashrc.
So, basically, by setting up RVM correctly and installing your Ruby installation on one machine, you're 90% of the way to having it available for multiple machines.
I'm pretty sure Ruby will install without any dependencies on a current Mac OS using RVM, but there's a couple libraries that can improve the experience. After installing RVM, but before installing any Rubies, run rvm notes. That will show you what else to install. You'll need the current XCode to compile a Ruby, but only on the machine you do the compiling on. Once it's installed you should be able to move a RVM controlled Ruby around to other Macs by copying the ~/.rvm directory. So, not only would you have the gems, you could have a particular version, or versions, of Ruby, plus the associated gems, so your regression tests could work too.
If you use MacVim you could install it in ~/bin and have the GUI version. I haven't tried running it from there, but it seems like it'd work. You might need to create an alias from /Applications to the one in ~/bin for double-clicking.
MacVim comes with a shell script called mvim to launch it from the command-line. I have a bunch of softlinks to mine letting me call it from the command-line in various ways: gvim, and the gvim varients like gvimdiff and gview. You could do the same by adding ~/bin to your PATH and making the links locally in that dir to MacVim's mvim.
You could build a tarball of the vim config, vim installation and RVM sandbox, copy that to another Mac, expand it, add ~/bin to your PATH and append the needed RVM initialization line in ~/.bashrc, open a new command-line, and have your editor plus Ruby sandboxes.
It's a minor variation on how my Mac and Linux boxes are set up. I haven't tried bundling everything together, but, on Macs that are the same OS version, it should work.
Consider using rvm to manage different gem configurations. If you want you can store your rvm configurations in your dropbox (rather than in ~/.rvm, where they go by default) so that your gemsets are synced across machines.

Ruby on Rails -- new install on windows 7 but cant run ruby commands, problem with path?

I just installed ruby on rails on my new computer ( I was using instantrails before) and I'm trying to get everything setup.
Im running Windows 7. So I followed the instructions from this tutorial.
http://blogupstairs.com/ruby-on-rails/installing-ruby-on-rails-on-windows-7/
The problem i'm guessing is step 3
"Add the newly installed bin directory to your path in your windows system : Open windows explorer-> right click the icon computer-> choose Properties -> in the contol panel Home, Click Advanced system settings and then click Envitonment Variables button->in the system variables click new and add new system variables like this : Variable name : RUBY_HOME , Variable Value : C:\Ruby, after that add it in to the path and add the bin after a semicolon to the “Path” variable like this : C:\Program Files\Common Files\Adobe\AGL;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%RUBY_HOME%\bin"
I set created the system variables but when I try to run script/generate in the main directory of my app I get the error
"Ruby: no such file or directory --script/generate"
I checked the apps directory and the script folder is in there. How can I run the "ruby script/generate" commands from the control panel?
I was guessing it was something with the path but I dont know any ways to check to find out whats going wrong.
Are you using Rails 3.0+? In this version of rails and up, the script/* folder has been deprecated in favor of rails generate, rails server, etc. See here.
In 99.99999% of all cases, if a computer tells you that it cannot find a file at a specific location, it is because that file is not at that specific location.
So, is there actually a file named generate in a directory named script in the current directory?
I have recently installed RoR on my "clean" Win7 as well.
What IDE are you using?
I suggest trying JRuby with NetBeans/RubyMine:
JRuby installer does all the work (even adds the proper variables to your path in system environment settings...,
IDEs take care of gems, setting up servers etc.
As for the commands, as Nuclearsandwitch mentioned, there is no script/generate or script/server in Rails 3. Just make sure you in the directory with your Rails app and then try running rails server. It should work :-)

Resources