So I'm following a book and installed GIT, CURL, rvm, RubyGems, and ruby.
When I run gem env, the variables incorrect... my home is "/home/wegener" NOT "/home/wegejos" ... I have no clue where or how it got the incorrect home world... I used rvm to install RubyGems and Ruby.
[~]$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.24
- RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/wegejos/ruby/gems
- RUBY EXECUTABLE: /home/wegener/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
- EXECUTABLE DIRECTORY: /home/wegejos/ruby/gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/wegejos/ruby/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--remote --gen-rdoc --run-tests"
- "gemhome" => "/home/wegejos/ruby/gems"
- "gempath" => []
- "rdoc" => "--inline-source --line-numbers"
- REMOTE SOURCES:
- http://rubygems.org/
.
[~]$ env
reinstall_flag=1
rvm_bin_path=/home/wegener/.rvm/bin
HOSTNAME=ren.renegew.com
GEM_HOME=/home/wegener/.rvm/gems/ruby-1.9.3-p194
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
IRBRC=/home/wegener/.rvm/rubies/ruby-1.9.3-p194/.irbrc
SSH_CLIENT=24.8.185.82 51882 22
PERL5LIB=/home/wegener/perl5/lib/perl5/x86_64-linux:/home/wegener/perl5/lib/perl5
MY_RUBY_HOME=/home/wegener/.rvm/rubies/ruby-1.9.3-p194
PERL_MB_OPT=--install_base /home/wegener/perl5
SSH_TTY=/dev/pts/1
USER=wegener
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.flac=01;35:*.mp3=01;35:*.mpc=01;35:*.ogg=01;35:*.wav=01;35:
__array_start=0
rvm_path=/home/wegener/.rvm
escape_flag=1
rvm_prefix=/home/wegener
MAIL=/var/spool/mail/wegener
PATH=/home/wegener/.rvm/gems/ruby-1.9.3-p194/bin:/home/wegener/.rvm/gems/ruby-1.9.3-p194#global/bin:/home/wegener/.rvm/rubies/ruby-1.9.3-p194/bin:/home/wegener/.rvm/bin:/usr/local/jdk/bin:/home/wegener/perl5/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/wegener/bin
INPUTRC=/etc/inputrc
PWD=/home/wegener
JAVA_HOME=/usr/local/jdk
uninstall_flag=1
EDITOR=pico
LANG=en_US.UTF-8
_second=1
rvm_version=1.13.6 (stable)
SHLVL=1
HOME=/home/wegener
LS_OPTIONS=--color=tty -F -a -b -T 0
PERL_LOCAL_LIB_ROOT=/home/wegener/perl5
_first=0
LOGNAME=wegener
VISUAL=pico
CVS_RSH=ssh
GEM_PATH=/home/wegener/.rvm/gems/ruby-1.9.3-p194:/home/wegener/.rvm/gems/ruby-1.9.3-p194#global
CLASSPATH=.:/usr/local/jdk/lib/classes.zip
SSH_CONNECTION=24.8.185.82 51882 96.125.160.242 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
PROMPT_COMMAND=echo -ne "\033]0;${PWD/#$HOME/~}\007"
install_flag=1
RUBY_VERSION=ruby-1.9.3-p194
PERL_MM_OPT=INSTALL_BASE=/home/wegener/perl5
G_BROKEN_FILENAMES=1
_=/bin/env
I found it! It was hidden in some file at /home/wegener/.gemrc ... I have no clue why it was set to wegejos or where that even came from.. there is not even a /home/wegejos/ I changed it to /home/wegener/ and now it's working.
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 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've installed ruby, rubygems and rails through Cygwin setup.
Then I've installed a gem:
gem install capistrano --verbose
No problem here. But when I try to run cap command, Cygwin tells me:cap: command not found
When I execute in ./bin/cap it works:
$ ./bin/cap
Stage not set, please call something such as 'cap production deploy', where production is a stage you have defined.
Here is my gem environment:
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.1
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [i386-cygwin]
- INSTALLATION DIRECTORY: /home/Moretti/.gem/ruby
- RUBY EXECUTABLE: /usr/bin/ruby.exe
- EXECUTABLE DIRECTORY: /home/Moretti/bin
- SPEC CACHE DIRECTORY: /home/Moretti/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86-cygwin
- GEM PATHS:
- /home/Moretti/.gem/ruby
- /usr/share/gems
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /cygdrive/c/Program Files (x86)/Intel/iCLS Client
- /cygdrive/c/Program Files/Intel/iCLS Client
- /cygdrive/c/WINDOWS/system32
- /cygdrive/c/WINDOWS
- /cygdrive/c/WINDOWS/System32/Wbem
- /cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0
- /cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL
- /cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT
- /cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Componen ts/DAL
- /cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Componen ts/IPT
- /usr/bin
The EXECUTABLE DIRECTORY is correct, but the binaries aren't working outside the ~/bin/.
What can I do?
I created a cap file in /usr/local/bin/ and made it executable.
$ cat /usr/local/bin/cap
#!/bin/bash
ruby ~/.gem/ruby/gems/capistrano-3.3.5/bin/cap "$#"
Location of capistrano gem files can be found using gem which capistrano.
I personally do not know if this is the best way of doing it, but I've just set it up yesterday and have managed to get it working for my usecase
I'm trying to run a single unit test in my Rails app, I'm using the following command to run the test (say my model is users)
rake test TEST=test/unit/user_test.rb
It runs with out a problem, but for some reason it runs three times; can anyone explain me why is that and if I'm doing something wrong above? Following is my gem env, and I'm using Rails 2.3.2.
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.10
- RUBY VERSION: 1.8.7 (2011-12-28 patchlevel 357) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/sameera/.rvm/gems/ruby-1.8.7-p357
- RUBY EXECUTABLE: /home/sameera/.rvm/rubies/ruby-1.8.7-p357/bin/ruby
- EXECUTABLE DIRECTORY: /home/sameera/.rvm/gems/ruby-1.8.7-p357/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/sameera/.rvm/gems/ruby-1.8.7-p357
- /home/sameera/.rvm/gems/ruby-1.8.7-p357#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
In a rails app rake test runs 3 subtasks, test:units, test:functionals, test:integration.
Each of those tasks just runs all the tests from the corresponding folder, but your environment variable overrides that search process and so the same file is found each time.
You could either do
rake test:units TEST=...
or
ruby -I test test/unit/user_test.rb
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.