Cucumber on Travis CI container - docker

I am trying to get Cucumber to run tests on my builds on Travis CI with following minimal .travis.yml:
language: ruby
sudo: required
services: docker
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq cucumber
script:
- cucumber --version
But the build fails with
/usr/local/rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- cucumber/rspec/disable_option_parser (LoadError)
from /usr/local/rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/cucumber:10:in `<main>'
Do I need to install other packages than cucumber?

It seems all the packages are being installed, the problem here I think is that sudo apt-get install -qq cucumber installed ruby 1.9.3 and then cucumber (check the log), calling cucumber tries to execute using ruby 2.2 (travis default)
Maybe you should stick to using bundler or rake to install the cuke.

Related

Yarn packages won't update for dependency issue

On a development server, for an application barely deployed, rails commands won't execute because of lack of integrity file.
error Couldn't find an integrity file
error Found 1 errors.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
Both
yarn install --check-files
yarn install
lead to the same error
compression-webpack-plugin#4.0.1: The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "8.17.0"
Found incompatible module
Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The 'visit' prompt is unfortunately of no use, as it does not deal with the node engine.
Being barely deployed, there is no node-modules directory yet, which is expected. However on development machine there is the directory and no issues whatseoever in precompiling assets.
Server context:
node -v
> v8.17.0
How can this situation be unblocked?
you need to update the node to a version higher than the one mentioned >= 10.13.0 then re-install yarn and re-run the check:
if you're on Mac OS:
brew install node#14 && brew link --force node#14
brew install yarn
if you're on Linux:
cd ~
curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
then check if you have a compatible version
node -v
=> v14.2.0
``
if so re-run any of your commands:
```bash
yarn install --check-files
yarn install

Linuxbrew on Travis CI

I'm trying to install linuxbrew on Travis CI, and it fails for a reason I don't understand. Travis CI claims:
default ruby version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
but when my .travis.yml file does a:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
It fails at:
HEAD is now at 851177a29 docs: update gems. (#569)
/usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': can't modify frozen String (RuntimeError)
from /usr/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize'
from -e:1:in `new'
from -e:1:in `<main>'
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! You're running 1.9.3. (RuntimeError)
Failed during: /home/linuxbrew/.linuxbrew/bin/brew update --force
I think this used to work (last year), but all of a sudden its failing. How do I install Linuxbrew on Travis CI on "trusty"?
Edit
Here's my .travis.yml
language: cpp
sudo: required
dist: trusty
before_install:
- sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
End Edit
Thanks.
It appears as though Linuxbrew on Travis CI has a problem identifying which version of Ruby is installed. To fix use the alternative install method of:
git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew
export HOMEBREW_FORCE_VENDOR_RUBY=1
in the before_install section

Install capyabara-webkit gem on Amazon Linux AMI

I am trying to install the capybara-webkit gem on Amazon Linux AMI release 2017.09.
I tried following the install instructions for CentOS (maybe the wrong approach):
sudo yum install -y epel-release
sudo yum install -y qt5-qtwebkit-devel
The first package installed fine, but qt5-qtwebkit-devel gave the following error:
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgdk-x11-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgdk_pixbuf-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libatk-1.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgtk-x11-2.0.so.0()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I am unable to resolve the libgdk_pixbuf-2.0.so.0 dependency in Amazon Linux. I tried installing libX11-devel but that did not resolve the issue.
Of course gem install capybara-webkit -v '1.10.1' fails because qt5 is not installed.
I found a blog with instructions for installing capybara with qt-4.8, I would rather use the latest version and would prefer to use a package manager instead of compiling the package manually.
My question is, how can I install capybara-webkit on Amazon Linux AMI using the package managers?
Amazon AMI doesn’t have a yum repo for the libgtk-x11-2.0.so.0. So you need to install other distro packages. In this case, did used CentOS.
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/hicolor-icon-theme-0.11-1.1.el6.noarch.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/atk-1.30.0-1.el6.x86_64.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gdk-pixbuf2-2.24.1-6.el6_7.x86_64.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gtk2-2.24.23-9.el6.x86_64.rpm
Once the packages are install the setup should work for you
PS: Source https://ubunifu.co/python/installing-libgtk-x11-2-0-so-0-in-amazon-linux-ami-2017-03-1
I'm using chef but this is where I got the necessary dependencies.
just add this repo to yum repos, and then do the install
yum_repository 'centos-base' do
url 'http://mirror.centos.org/centos/6/os/x86_64/'
gpgkey 'http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6'
action :add
end
package 'qt5-qtwebkit-devel'

GitLab Hosted Ruby Version Issue

I'm testing out a simple Rails project with hosted GitLab. My repository has Ruby version 2.3.0 and Rails version 5.0.1. I created the basic gitlab-ci.yml file with the below code for CI. When GitLab goes to run this file through the pipeline to add it I get the error:
activesupport-5.0.1 requires ruby version >= 2.2.2, which is incompatible with
the current version, ruby 2.1.10p492
I'm not sure how to change the version of Ruby that GitLab is using. Any suggestions on how to resolve this issue?
gitlab-ci.yml
before_script:
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
- ruby -v
- which ruby
- gem install bundler --no-ri --no-rdoc
- bundle install --jobs $(nproc) "${FLAGS[#]}"
rspec:
script:
- bundle exec rspec
rubocop:
script:
- bundle exec rubocop
You define the environment in which the code is run by using a Docker image.
Try adding
image: ruby:2.3.0
to the top of your .gitlab-ci.yml file

Can I install gems with apt-get on Ubuntu?

I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
Ubuntu now have rubygems as a package
For Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
sudo apt-get install rubygems-integration
On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:
sudo apt-get install ruby-dev
If on Ubuntu 14.04 try below
sudo apt-get install rubygems-integration
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
ruby setup.rb
That's it :)
If you install the full ruby application set with
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
For me in Ubuntu 20.04 I did 3 things to create a new Ruby and Rails app.
Install Ruby development version
sudo apt install ruby-dev
Install rails from gem
sudo gem install rails
Create new application
rails new blog
I got error while installing rails(sudo apt install rails) only, So I installed devlopment version. I got permission related error while not using Sudo as well while installing gems and rails.
For Ubuntu
First install ruby:
sudo apt install ruby
Note that : sudo snap install ruby will throw this error :
error: This revision of snap "ruby" was published using classic
confinement and
thus may perform arbitrary system changes outside of the security
sandbox that snaps are usually confined to, which may put your system at
risk.
If you understand and want to proceed repeat the command including
--classic.
Finally, download latest tar version of ruby gems here:
https://rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
sudo ruby setup.rb

Resources