With Travis CI I can allow failures for languages like Ruby 1.8.7:
matrix:
allow_failures:
- rvm: 1.8.7
And I can allow failures for certain environment variables
matrix:
allow_failures:
- env: "RAILS_VERSION=master"
What I want to do is allow failures for an intersection of environment variable and Ruby version. Like
matrix:
allow_failures:
- env: "RAILS_VERSION=master" && rvm: 1.8.7
Is it possible to do this with travis?
I believe this is what you want:
matrix:
allow_failures:
- env: "RAILS_VERSION=master"
rvm: 1.8.7
Related
I lose my patience to rails on ubuntu. So far I have used the ready environment on c9, but it is slowly closing. I'm learning how to deal with rails and I have a problem with Ubuntu.
I use tutorials (many) to install it. Finally, I did it, and I created a small project. One page + one model + one controller. Commit, exit, turn off a notebook.
Today when I want to back to programming I opened a terminal and go to project dir /Desktop/Projc/test. And after typed rails s I got the message:
Command 'rails' not found, but can be installed with:
sudo apt install ruby-railties
And what is weird, If I open a terminal in home dir rails are ok. I can create a new project etc. But in the existing project rails "are not installed".
I spent a few hours to look for a solution, reads many posts (so: 10918685, 7788946, 16884034) but nothing help.
I'm afraid that I just did a bigger mess.
Can someone try to help me with my case?
My configs:
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.1
- RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/iso/.rvm/gems/ruby-2.6.1
- USER INSTALLATION DIRECTORY: /home/iso/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /home/iso/.rvm/rubies/ruby-2.6.1/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /home/iso/.rvm/gems/ruby-2.6.1/bin
- SPEC CACHE DIRECTORY: /home/iso/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /home/iso/.rvm/rubies/ruby-2.6.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/iso/.rvm/gems/ruby-2.6.1
- /home/iso/.rvm/rubies/ruby-2.6.1/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/iso/.rvm/gems/ruby-2.6.1/bin
- /home/iso/.rvm/gems/ruby-2.6.1#global/bin
- /home/iso/.rvm/rubies/ruby-2.6.1/bin
- /home/iso/.rvm/bin
- /home/iso/.rbenv/plugins/ruby-build/bin
- /home/iso/.rbenv/shims
- /home/iso/.rbenv/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
- /snap/bin
echo $PATH:
/home/iso/.rvm/gems/ruby-2.6.1/bin:/home/iso/.rvm/gems/ruby-2.6.1#global/bin:/home/iso/.rvm/rubies/ruby-2.6.1/bin:/home/iso/.rvm/bin:/home/iso/.rbenv/plugins/ruby-build/bin:/home/iso/.rbenv/shims:/home/iso/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
rails -v: 5.2.3
ruby -v: 2.6.0p0
Can someone see a solution? And in the terminal, I have a checked a "run as start shell".
I installed rvm using rv1-ansible role:
- hosts: all
remote_user: deploy
roles:
- { role: rvm_io.ruby,
tags: ruby,
rvm1_rubies: ['ruby-2.4.0'],
rvm1_user: 'deploy'
}
Now I would like to run bundle install inside application directory:
- hosts: all
remote_user: deploy
tasks:
- name: Clone git repository
git:
dest: /home/deploy/public_html/app_name
repo: git#github.com:user/app_name.git
- name: Bundle install
bundler:
state: present
chdir: /home/deploy/public_html/app_name
executable: ~/.rvm/gems/ruby-2.4.0/bin/bundle
But get error:
"/usr/bin/env: 'ruby_executable_hooks': No such file or directory"
Any idea how to do this?
You need to do a root install - installing as a specific user does not work. Little bit of info why here - Ansible is not logging in to run commands so doesn't pick up user-specific RVM stuff. By installing globally, rvm and bundler and all the other crap I don't know about which you need on the path is available on the path.
Example config installing ruby system wide ripped right from the rvm1-ansible docs:
- name: Configure servers with ruby support system wide
hosts: all
roles:
- { role: rvm_io.ruby,
tags: ruby,
become: yes,
rvm1_rubies: ['ruby-2.2.5','ruby-2.3.1'],
rvm1_install_flags: '--auto-dotfiles', # Remove --user-install from defaults
rvm1_install_path: /usr/local/rvm, # Set to system location
rvm1_user: root # Need root account to access system location
}
I have Jenkins automation server that connects to my machine through ssh with user snaggs.
My machine has 2 versions of ruby:
default version comes from OS /System/Library/Frameworks/ ..... /usr/bin/ruby
ruby v2.3.3 installed with RVM
On machine the automation runs some Perl script with some commands. whoami from jenkins gives snaggs
When Perl script runs command gem env the output is:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14.1
- RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Library/Ruby/Gems/2.0.0
- /Users/snaggs/.gem/ruby/2.0.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org"]
- REMOTE SOURCES:
- http://rubygems.org
However when I enter to the same machine with ssh to the same user snaggs I have ruby version installed with rvm:
When I run $ gem env I get output:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.8
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/snaggs/.rvm/gems/ruby-2.3.3
- USER INSTALLATION DIRECTORY: /Users/snaggs/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/snaggs/.rvm/rubies/ruby-2.3.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/snaggs/.rvm/gems/ruby-2.3.3/bin
- SPEC CACHE DIRECTORY: /Users/snaggs/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/snaggs/.rvm/rubies/ruby-2.3.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/snaggs/.rvm/gems/ruby-2.3.3
- /Users/snaggs/.rvm/gems/ruby-2.3.3#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://rubygems.org"]
- REMOTE SOURCES:
- http://rubygems.org
- SHELL PATH:
- /Users/snaggs/.rvm/gems/ruby-2.3.3/bin
- /Users/snaggs/.rvm/gems/ruby-2.3.3#global/bin
- /Users/snaggs/.rvm/rubies/ruby-2.3.3/bin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/snaggs/.rvm/bin
How to tell to Jenkins to use other version located under /Users/snaggs/.rvm/gems/ruby-2.3.3?
[EDIT]
I don't run script as super user
I had a similar problem when tried to configure Java version.
Take a look at Jenkins wiki:
When the SSH slaves plugin connects to a slave, it does not run an
interactive shell. Instead, it does the equivalent of your running "ssh
slavehost command..."
So suppose when you will run gem env from ssh, you should get the same result like Jenkins gets: ssh snaggs#1.1.1.1 "gem env"
On machine the automation runs some Perl script with some commands.
You can try to create some custom .bash_profile_CUSTOM that equals to your original .bash_profile You need to call .bash_profile_CUSTOM because Jenkins uses own .bash_profile by default .Run your perl script like:
ssh snaggs#1.1.1.1 "source ~/.bash_profile_CUSTOM && perl some_perl_script.pl"
Just remember that you need to bind bash_profile_CUSTOM file each time Jenkins connects to your build machine. So from Jenkins the command executable should be something like:
source ~/.bash_profile_CUSTOM && perl some_perl_script.pl
let me know if it works or give you different output
Edit: (25/12/2016)
If you don't want to install plugins for Jenkins (like EnvInject Plugin for Prefix Start Slave Command) you can wrap Perl script with bash script, like:
#!/bin/bash
source ~/. bash_profile_CUSTOM;
perl some_perl_script.pl;
So Perl script will start with profile you defined with .bash_profile_CUSTOM.
I have an ubuntu machine and I am trying to install rubygems using RVM by following this guide:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
When I run the command rvm rubygems current or even the command rvm rubygems latest I get the following error:
fl4m3ph03n1x: ~ $ rvm rubygems current
system - #downloading rubygems-2.4.8
system - #extracting rubygems-2.4.8.....
system - #removing old rubygems.........
$LANG was empty, setting up LANG=en_US.utf8, if it fails again try setting LANG to something sane and try again.
system - #installing rubygems-2.4.8.
Error running 'env GEM_HOME=/home/fl4m3ph03n1x/.rvm/gems/system#global GEM_PATH= /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby -d /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8/setup.rb --no-document',
showing last 15 lines of /home/fl4m3ph03n1x/.rvm/log/1437602750_system/rubygems.install.log
[2015-07-22 22:05:50] /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby
current path: /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/fl4m3ph03n1x/.rvm/bin
command(7): env GEM_HOME=/home/fl4m3ph03n1x/.rvm/gems/system#global GEM_PATH= /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby -d /home/fl4m3ph03n1x/.rvm/src/rubygems-2.4.8/setup.rb --no-document
env: /home/fl4m3ph03n1x/.rvm/rubies/system/bin/ruby: No such file or directory
At first I thought the error was due to the --no-document flag, but after reading and trying this discussion on github, nothing changed.
I also checked this stackoverflow discussion but it doesn't seem to be applicable to my case because I have a fresh installation (no manually installed packages nor anything).
Over all I tried using commands like rvm get head and rvm stable but nothing seems to work.
What am I missing? Could this be a permission's problem somehow?
EDIT:
This is the result of rvm list:
rvm rubies
ruby-2.2.1 [ x86_64 ]
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
# * - default
I had ruby installed, but turns out it was not set in rvm.
To fix this first I tried using rvm use ruby --default, but I got the infamous "rvm is not a function" error.
To fix this, first run bash --login and then then rvm use ruby --default.
Once these steps are complete you can proceed with rubygems installation.
Using heroku for deployment while learning Rails with the Ruby On Rails tutorial by Michael Hartl, on Ubuntu 11.04 Natty Narwhal. I installed it using
sudo gem install heroku
and the commands seemed to run fine for that session in the terminal. The next time I went to work, I tried the command "heroku open" and I was told "heroku: command not found". Looking at some of the answers to similar problems here, it seemed the answer was to run
gem enviroment
which returned the following:
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/richard/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
I then ran
$ export PATH=$PATH:/var/lib/gems/1.8/bin
which seemed to fix the problem. However, the next time I tried to run heroku in the terminal, I was told "command not found" again! Running the "export PATH=$PATH" command seems to fix the problem every time, but I would rather I didn't have to run this command everytime I want to use heroku. Is there any permanent solution to the problem?
If you're using bash as your shell, then add that export line to .bash_profile in your home directory. The equivalent for zsh is .zshrc, and other shells have their own files to automatically load for every shell session.