Openshift and net-ssh incompatibility? (2.9.3-beta1 vs 2.9.2) - ruby

by searching to access my Postgres DB on Openshift, i'm currently facing problem using net-ssh.
At this step - note that the installed Ruby version is 2.2.0 and net-ssh is 2.9.3-beta1
To be able to access the DB from my local DB IDE, i need to execute:
rhc port-forward myappname
But the execution returns this error: Checking available ports ... Could not parse PKey: no start line
As you can see in this post (an other ones e.g. this one), the fix is to back to a stable version of net-ssh. the 2.9.2.
What i've succesfully done.
But now, running rhc port-forward myappname is giving me the following error: .../2.2.0/rubygems/core_ext/kernel_require.rb:54:in 'require': cannot load such file
And the fix is to upgrade net-ssh to the 2.9.3-Beta1 version (see this post).
This is really weird! Seems that "the snake is biting its own tail" (don't know if that french expression got english translation).
Note that i've tried to make a clean setup with new ssh key gen (automatically and manually).
My system is runnin' Win 7 64bits.
I made uninstall/install of last version of Ruby.
Reinstall of rhc.
Last version running on rhc-1.36.4. The problem goes on.
Can you help?
Should i install an older version of ssh-net and/or Ruby (i'm not allowed to use ssh-net 2.5.2 due to new version of rhc)?
(sorry for my bad english)

rhc/Gemfile & rhc/rhc.gemspec required gem "net-ssh", "<= 2.9.2"
net-ssh version 2.9.2 use require dl/import atleast on pageant.rb
dl/import is removed from ruby see https://github.com/ruby/ruby/blob/v2_2_0/NEWS#L148-L149
instead fiddle is recommended
net-ssh 3.* seems to fix this(uses fiddle/{import,{ for ruby >= 2.1)
net-ssh version 3. seems to have drop in compatibility(still working on mine) for rhc
So a simple hack is to modify rhc/Gemfile & rhc/rhc.gemspec and install the gem
A guy already have done it.
A Solution(Untested)
gem 'rhc', :git => 'git://github.com/thrasher-redhat/rhc.git'
from https://stackoverflow.com/a/7421712/2382629
Alternative Solution(Tested even on windows 7 32bit :p)
git clone https://github.com/openshift/rhc
cd rhc
modify rhc/Gemfile & rhc/rhc.gemspec like https://github.com/openshift/rhc/pull/748/files then
gem build rhc.gemspec
it should output like
blah! blah! blah! warnings and msgs......
Successfully built RubyGem
Name: rhc
Version: 1.38.4
File: rhc-1.38.4.gem
then run
gem install rhc-1.38.4.gem

You need to use an older version of Ruby, try 1.9.3 or 2.0, or maybe even 2.1.

Related

Gemfile issues and Ruby install issues

I am working on a Windows 7 64-bit machine. I had Ruby version 2.1.5 installed on my machine and everything was working great. I went and installed a gem that would set up a project for you with most of the basics already completed, but it required Ruby 2.2.2. I went and researched how to upgrade my Ruby version and the best solution I found was to install the Pik gem for windows and install 2.2.2 separately, and switch between the two versions.
I followed a tutorial on YouTube for how to set up Pik. I normally use Git Bash but the tutorial required me to use the cmd.exe prompt to set up Pik, and then it included a way to use Pik with Git Bash at the end of the tutorial. I also had to add a file to my PATH in the system settings.
I was able to set up Pik and everything worked great with Pik on both the cmd.exe and Git Bash consoles. However, from there if I went to run any other commands such as bundle install, I would get an error:
Could not locate gemfile.
I have also experienced the same error, but it would say something along the lines of an issue with the .bundle/directory. I tried switching to a project that I had already created in the past and tried running the command again. It still had the same error. (I did this to see if the gemfile in the project would fix anything.) If I try running gem install rails, I have had it work once or twice - but I still have the 'no gemfile' issue after the fact.
The times the command doesn't work I often get:
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B:
certificate verify failed
(https://api.rubygems.org/latest_specs.4.8.gz).
I tried running the pik gem and pik gemsync commands to see if that would fix my issues but it did not.
I tried uninstalling Pik by doing the pik implode command and deleting the files it created. The issue still persisted. I tried uninstalling the 2.2.2 version of Ruby using the uninstall executable in the file, and deleting any left over file(s). The issue still persisted. I tried to uninstall and reinstall Ruby completely from my machine, the 2.1.5 version that is doing the same method as the 2.2.2 version. Yet the issue still persists no matter what I do. I have tried many times uninstalling and reinstalling both Ruby versions, from the executable and from the control panel. I would like to find a way to completely uninstall and reinstall all of Ruby if possible, preferably reinstall Ruby 2.2.2. Or if anyone else has any other ideas for how to fix this issue?
from there if I went to run any other commands such as bundle install I would get an error Could not locate Gemfile.
As you've guessed, you need a file named gemfile in the same location you are running bundle install from
If I try running gem install rails I have had it work once or twice but I still have the no gemfile issue after the fact.
Running gem install <package> doesn't create a gemfile for you. You need to do this yourself. It's essentially a file where you manually specify which packages you would like your project to use. See here on how to create.
The times the command doesn't work I often get: "ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect retur ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ( https://api.rubygems.org/latest_specs.4.8.gz)."
This sometimes happens on Windows machine. You can do a quick search on how to fix the gem command with SSL, or in your Gemfile you can temporarily specify http://rubygems.org/ instead of https://rubygems.org/

Apache/Ruby/Passenger misconfigured after Ubuntu 12.04 to 14.04 update

Well, I have to admit, that I'm down today. I've updated my Ubuntu and that rendered Redmine 2.1.2 completely dead. Any suggestions as of to what should I update or reconfigure? I'm trying not to use Ruby/Rails/Passenger blindly but it's tough as it's not my expertise. I'd like to USE Redmine instead.
Top of the Passenger error log is below, but feel free to check whole page at http://redmine.teacloud.net:
It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:
bundle install
If that didn't work, then the problem is probably caused by your application being run under a different environment than it's supposed to. Please check the following:
Is this app supposed to be run as the nobody user?
Is this app being run on the correct Ruby interpreter? Below you will see which Ruby interpreter Phusion Passenger attempted to use.
-------- The exception is as follows: -------
Could not find rake-10.3.2 in any of the sources (Bundler::GemNotFound)
/var/lib/gems/1.8/gems/bundler-1.3.4/lib/bundler/spec_set.rb:92:in `block in materialize'
• I have no idea, what user should this app supposed to be run as. Everything else uses www-data by default, however the redmine application folder in filesystem is owner by root.
• Everything was working for two years on ruby 1.8 that is not on my system now. I've managed to install lowest version 1.8.7, latest 2.1.2... and I have no idea where does the 1.9.1 get from.
• I don't understand how 'bundle install' and 'bundle update' is related to current ruby version switched to using rvm.
• I am not sure, at what point will my Redmine MySQL database be migrated or destroyed if I'll need to upgrade Redmine (so I have backup).
• bundle install didn't help, Apache runs ruby 1.9.1
Solution was simply as follows (whole failure path is documented here http://www.redmine.orgenter code here/boards/2/topics/43500?r=43514):
• Everything happens in the Redmine's installation folder:
• Went to GitHub (https://github.com/redmine/redmine/blob/master/Gemfile) and copied fresh database section to Redmine's Gemfile (ignoring the fact that I have Redmine 2.1.2 and Gemfile is far newer)
$ rvm use system
$ bundle install

Changing Ruby version during deploy

I have a box with 3 Rails apps on it. I wan't to upgrade one of the apps so that it uses Ruby 2.0.0, while leaving the others running on 1.9.3-p394. I have both those Rubies installed via Rvm.
I'm trying to control the Ruby version that each app uses via it's Gemfile.
# Gemfile
ruby '2.0.0'
So, I changed the version number in the Gemfile locally, made sure it all worked, committed and now I'm trying to deploy the change to the server.
However, the cap deploy fails at this point
bundle install --gemfile [path to release Gemfile] --path [path to app bundle] --deployment --quiet --without development test
because
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
This is correct technically, my Gemfile does specify 2.0.0 and the app is currently running on 1.9.3. I'm trying to make it change versions before bundling though. How do I do that?
Your PATH is not set up correctly. You probably don't have bin: as the first entry in your path. That would lead to this error.
Even if you're not using Heroku it's worth reading this page on troubleshooting that issue: https://devcenter.heroku.com/articles/ruby-versions
Here is a link to an answer which will explain how to change your PATH on the server: Capistrano: Can I set an environment variable for the whole cap session?
If you have rvm maybe you can try to do
rvm use 2.0.0
before your bundler call.
If you're using rvm set the default to ruby 2.0.0 on your server
rvm --default use 2.0.0
Resolved the problem for me deploying to an AWS server from my mac - but I guess if I need to update my older sites I'll have to set the default back to 1.9.3 before deploying.

Can I control the version of rubygems that IntelliJ uses?

I'm trying to start a rails application in IntelliJ with the Ruby plugin.
I've imported the application and set up the run configuration as best I can. When I try to run it I get the error:
NoMethodError: undefined method `version_requirements' for #<Gem::Dependency:0x7de21f45>
When looking for an answer I found this page saying that I should do this:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Since it's IntelliJ's ruby plugin that is managing the gems, I assume that I have to change the version of rubygems-update that the plugin is using.
Is this the right approach to take? And if so, can anyone tell me how to go about it?
I tried listing the gems but that gem is not shows so I must not be listing the gems in the right place, but I don't know where to look.
Many thanks :)
IntelliJ IDEA cannot handle it, you will need to install the appropriate rubygems version from the command line.
Note that your current rubygems-update version may be different, verify it with gem list and use the reported version when uninstalling.

Rails server command generates error report

When I used rails server command, found following errors in terminal. It shows that "could not find a JavaScript runtime". I am newbie in ROR and don't know to configure different files. I Google and found solutions of this problem 1 2 3. Still I am not getting the things. Please suggest some solutions.
Ruby and Rail versions on my system
Ruby version:- ruby 1.8.7 , Rails version:- Rails 3.2.6
I suppose you lack executable on your system/
Haven't you try to run gem install execjs or bundle install(from your project directory) in console?
UPDATE
Also visit execjs homepage and try instaling any of JS runtimes supported.
UPDATE 2
I was able to reproduce your error (with ruby 1.9.2). Just add gem 'therubyracer' to your Gemfile and run bundle install. For some weird reason ROR is not working out of the box on Ubuntu. See this and search for runtime word for more info.
PS
Please put your Gemfile here. This might help.
The error message also tells your to
See https://github.com/sstephenson/execjs for a list of available runtimes.
You have to install one of the JavaScript runtimes listed there:
therubyracer
therubyrhino
Node.js
Microsoft Windows Script Host
For Rails 3.2.6 I suggest to use Ruby 1.9.3. for better performance.

Resources