Foreman Installation on Raspberry fails due to missing capybara - ruby

We are attempting to install foreman on a raspberry as a demo for installation on larger machines such as the cubietruck. We have problems building the foreman-installer from source:
bundle install --without mysql2 pg test --path vendor
Your Gemfile lists the gem gettext_i18n_rails_js (>= 0.0.8) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem gettext (~> 2.0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem locale (<= 2.0.9) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem minitest (~> 4.7) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Fetching gem metadata from https://rubygems.org/........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...............................................
Could not find gem 'capybara (~> 2.0.0) ruby' in the gems available on this
machine.
We have already manually installed capybara using gem and can locally see it:
sudo gem list
*** LOCAL GEMS ***
bundler (1.6.2)
capybara (2.0.0)
childprocess (0.5.3)
ffi (1.9.3)
mime-types (2.3)
mini_portile (0.6.0)
multi_json (1.10.1)
nokogiri (1.6.2.1)
rack (1.5.2)
rack-test (0.6.2)
rubyzip (1.1.4)
selenium-webdriver (2.42.0)
websocket (1.0.7)
xpath (1.0.0)
Any ideas what we are missing?
Regards
Stefan

Related

Error loading watir-webdriver

Is there a way to install an earlier version of watir-webdriver including dependencies?
I've been running watir-webdriver for a while now, but just ran into problems today when installing on a new Windows environment.
The error is on the require "watir-webdriver". The first error line indicates that ruby is unable to load ffi
C:/Ruby21/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- ffi_c (LoadError)
It looks like the problem may be with the combination of gems, so am including the versions here:
bigdecimal (1.2.4)
childprocess (0.5.3)
ffi (1.9.5 x86-mingw32)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
multi_json (1.10.1)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rubyzip (1.1.6)
selenium-webdriver (2.43.0)
test-unit (2.1.3.0)
watir-webdriver (0.6.11, 0.6.10)
websocket (1.2.1)
If you know of a version that worked in the past, you can simple remove the current version and install an old one with the -v flag for gem install.
For example,
gem uninstall watir-webdriver
gem install watir-webdriver -v '= 0.4.0'
You can find the different available version on rubygems.org It will automatically install the proper dependencies.

Managing conflicting dependencies in Gemfile.lock

In my gemspec file:
I have a gem dependency called zconfig that explicitly requires net-ssh version 2.6.8
I'm also using net-sftp, which in turn requires net-ssh version >= 2.6.5
When I bundle install, bundler is smart enough to recognize the needs of both gems and correctly identifies 2.6.8 as the version of net-ssh to install.
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
...
net-ssh (2.6.8)
...
zconfig (0.2.7)
mysql (~> 2.9.1)
mysql2 (~> 0.3.13)
net-ssh (~> 2.6.8)
net-ssh-gateway (~> 1.2.0)
sequel (~> 4.1.0)
sqlite3 (~> 1.3.7)
So far, while testing on the remote server, I've been cloning the project and installing these gems with bundle install --deployment and then running the project with the locally instaled vendor gems using bundle exec ..
However, I'm now done with development and I've packaged the project as a gem and installed it on the remote server. The problem is that when executing the gem ruby doesn't adhere to my Gemfile.lock specification and uses net-ssh 2.7.0, which causes a conflict:
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1615:in `raise_if_conflicts': Unable to activate zconfig-0.2.7, because net-ssh-2.7.0 conflicts with net-ssh (~> 2.6.8) (Gem::LoadError)
Is there a way to do something like bundle exec my_gem so that it uses the Gemfile.lock specifications?
Just define the specific version of the gem to a required version by adding the following line in the gemfile:
gem 'net-ssh', '2.6.8'
or in the thinegem.gemspec:
spec.add_dependency 'net-ssh', '2.6.8'
And if you did add the gemfile.lock into the project, it shell be used during a deployment anyway.

Handling two independent gems that cause compatible version issue for Bundler

If I have a Gemfile that is
source 'https://rubygems.org'
gem "heckle", "~> 2.0.0.b1"
gem "reek", "~> 1.3.2"
Then I get the error message
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "ruby_parser":
In Gemfile:
reek (~> 1.3.2) ruby depends on
ruby_parser (~> 3.1.1) ruby
heckle (~> 2.0.0.b1) ruby depends on
ruby_parser (2.3.1)
Is it possible to tell Bundler that heckle and reek don't need to work with each other, and therefore it's ok to have two versions of ruby_parser?
For those unfamiliar with the two gems involved, heckle and reek are both gems that provide executables that analyse source code. They don't need to be required by code.

"The gem ... has been deleted. It was installed at" Error. Bundle install doesn't install gems. How to re-install gems?

I'm trying to build capybara-webkit on XP. I follow this instruction. I says:
8) Clone latest version of capybara-webkit from Github:
$ git clone git://github.com/thoughtbot/capybara-webkit.git
9) Bundle/Install capybara-webkit version:
$ cd ruby193\capybara-webkit
$ bundle install
I did so at the first time. It installed some gems. Then I followed the instruction steps but couldn't build capybara-webkit. So to begin one more time, I deleted all the gems that were installed manually. Now I follow all the same steps but bundle install doesn't work any more. I says that all the gems are present:
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems>cd capybara-webkit
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\capybara-webkit>bundle install
Resolving dependencies...
Using rake (0.9.2)
Using addressable (2.3.2)
Using bundler (1.3.5)
Using appraisal (0.4.0)
Using mime-types (1.22)
Using nokogiri (1.5.9)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using xpath (2.0.0)
Using capybara (2.1.0)
Using json (1.8.0)
Using capybara-webkit (1.0.0) from source at .
Using ffi (1.2.0)
Using childprocess (0.3.6)
Using diff-lcs (1.1.2)
Using websocket (1.0.6)
Using libwebsocket (0.1.7.1)
Using subexec (0.0.4)
Using mini_magick (3.2.1)
Using multi_json (1.5.0)
Using rack-protection (1.3.2)
Using rspec-core (2.6.4)
Using rspec-expectations (2.6.0)
Using rspec-mocks (2.6.0)
Using rspec (2.6.0)
Using rubyzip (0.9.9)
Using selenium-webdriver (2.27.2)
Using tilt (1.3.3)
Using sinatra (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
But now I check these gems with bundle show but it says they all were deleted:
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\capybara-webkit>bundle show sinatra
The gem sinatra has been deleted. It was installed at:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/sinatra-1.3.5
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\capybara-webkit>bundle show selenium-webdriver
The gem selenium-webdriver has been deleted. It was installed at:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.27.2
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems\capybara-webkit>bundle show mini_magick
The gem mini_magick has been deleted. It was installed at:
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mini_magick-3.2.1
How it can be that bundle install says they are present but bundle show says they are deleted? So bundle install doesn't work any more. How may I again use bundle install to install these gems again?
This solved it for me: "gem install" and "bundle install" do not install gem dependencies after manual gem deletion. How to inform Rubygems that gems were deleted manually?
(Delete the .gemspec files for the gems you have removed).

Why does Bundler think it needs a specific version to satisfy the dependency of a gem?

This is not the first time I've run into this, but here's a concrete example:
$ bundle update rails
Fetching source index for http://rubygems.org/
Bundler could not find compatible versions for gem "builder":
In Gemfile:
rails (~> 3.0.0) ruby depends on
builder (~> 2.1.2) ruby
hoptoad_notifier (>= 0) ruby depends on
builder (3.0.0)
So Bundler claims the hoptoad_notifier gem depends on the 3.0.0 version of builder. But that's not the case, it only requires builder >= 0.
$ gem dependency hoptoad_notifier
Gem hoptoad_notifier-2.4.11
actionpack (>= 0, development)
activerecord (>= 0, development)
activesupport (>= 0, runtime)
bourne (>= 0, development)
builder (>= 0, runtime)
nokogiri (>= 0, development)
shoulda (>= 0, development)
Why does Bundler think hoptoad_notifier depends on builder 3.0.0?
Selected bits from the Gemfile and Gemfile.lock:
source "http://rubygems.org"
gem 'rails', '~> 3.0.0'
gem 'hoptoad_notifier'
...a bunch of testing gems, custom gems, etc.
Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.14)
actionpack (= 2.3.14)
...
builder (3.0.0)
...
cucumber (1.2.0)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.10.0)
json (>= 1.4.6)
...
hoptoad_notifier (2.4.11)
activesupport
builder
... no other mentions of builder
I consider this more of a workaround than an answer to the question, so I'll leave the question open for a while to see if there's a better answer.
I found different ways to attack the problem (using bundle update on specific gems, modifying the Gemfile, running bundle install), but continued to run into some form of this error for various dependencies. It really seems like an issue with Bundler. (I'm using v1.0.22, upgrading made it worse.) Ultimately, what got me out of this mess was to delete the Gemfile.lock and run bundle install, letting Bundler resolve all the dependencies from scratch. Now of course, this is far from ideal, since the whole reason you have a lock file is to lock down your app's dependencies. But since I'm upgrading Rails to v3 anyway, it was acceptable in this case.

Resources