I am trying to upgrade to CocoaPods 1.2.1 but cannot uninstall CocoaPods 0.39.0.
I have reviewed numerous posts about this issue. Evidently 0.39.0 caused a lot of problems. I do not have enough reputation points to attach all the links I have reviewed but there are several StackOverFlow questions and GitHub Issues on the topic as v.0.39.0 evidently had some problems. Here are two of the many posts I reviewed:
STACKOVERFLOW QUESTIONS:
Cocoa Pods need to completely re-install
COCOAPODS BLOG POST ABOUT SHARDING and v.0.39.0:
http://blog.cocoapods.org/Sharding/
Here is my 'gem env' output:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.12
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY:
/Users/johndoe/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/johndoe/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/johndoe/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/johndoe/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/johndoe/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY:
/Users/johndoe/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/johndoe/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- /Users/johndoe/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/johndoe/.rbenv/versions/2.3.1/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- /usr/local/bin
- /usr/local/sbin
- /Users/johndoe/.rbenv/shims
- /Users/johndoe/.rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Applications/Postgres.app/Contents/Versions/latest/bin
- /Users/johndoe/.rbenv/versions/2.3.1/bin
And here is my 'gem list --local | grep cocoapods' output:
cocoapods (1.2.1)
cocoapods-core (1.2.1, 1.2.0, 0.39.0)
cocoapods-deintegrate (1.0.1)
cocoapods-downloader (1.1.3, 0.9.3)
cocoapods-plugins (1.0.0, 0.4.2)
cocoapods-search (1.0.0, 0.1.0)
cocoapods-stats (1.0.0, 0.6.2)
cocoapods-trunk (1.2.0, 0.6.4)
cocoapods-try (1.1.0, 0.5.1)
I have tried the following solutions:
1) "sudo gem uninstall cocoapods" then "sudo gem install cocoapods" and closed and reopened the terminal after each step
2) I modified my .bash_profile to make sure my echo $PATH includes the - EXECUTABLE DIRECTORY: from my gem env
3) Tried "gem pristine --all"
4) Made sure my home brew was up to date
5) Reinstalled rbenv
6) Tried various combinations of:
$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/
$ sudo rm -fr Pods/
and then uninstalled and reinstalled cocoapods…
7) Manually applied “sudo gem uninstall” to each element in the output of my “gem list --local | grep cocoapods” and then …
rm -rf ~/.cocoapods/repos/master
sudo gem install cocoapods
8) Tried
$ sudo gem update cocoapods
9) I tried:
sudo gem install cocoapods:1.2.1
but when I try
pod _1.2.1_ version
or
pod —version
it says 0.39.0
10) The output of “which pod” is:
/usr/local/bin/pod
11) I cannot recall if the first time I tried “sudo gem uninstall cocoapods” it gave me the option of specifically uninstalling 0.39.0. I chose “All Versions” nevertheless
12) I tried “sudo chown -R "$(whoami)" /usr/local/Cellar/rbenv" to make sure it wasn’t a permissions issue
13) I am using Mac OS Sierra 10.12.5
Any help would be GREATLY appreciated! Help!?!
The solution to my problem was:
sudo gem install -n /usr/local/bin cocoapods
This was the only way I could get rid of 0.39.0 and install the latest version of CocoaPods...
I found this solution and an explanation for why this was a problem at the following link:
https://github.com/CocoaPods/CocoaPods/issues/3736
Hooray!
Related
This is the situation: I am running mac OS Mojave 10.14.3 - It seems system is running ruby v2.3.0 and installed homebrew ruby 2.6.x when I try to run sass I get the following error:
> Sass is watching for changes. Press Ctrl-C to stop.
Gem::MissingSpecError: Could not find 'ffi' (>= 0.5.0, < 2) among 20 total gem(s)
Checked in 'GEM_PATH=/Users/samuellarcher/.gem/ruby/2.3.0:/Library/Ruby/Gems/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0', execute `gem env` for more information
Running gem env returns:
> RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.2 (2019-03-13 patchlevel 47) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/samuellarcher/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/samuellarcher/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.2/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/samuellarcher/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.2/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:
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
Now, when i do a:
whereis ruby
it returns:
/usr/bin/ruby
and
echo $PATH
returns
/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
on top of that, the path priority under /private/etc/paths is set to:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
which seems correct to me. The .bash_profile file contains:
export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
Checking gem directories:
ls /usr/local/lib/ruby/gems/2.6.0/gems/
returns
ffi-1.10.0 rb-fsevent-0.10.3 rb-inotify-0.10.0 sass-3.7.3 sass-listen-4.0.0 test-unit-3.3.0
with the missing ffi gem we are after.
ls .gem/ruby/2.3.0/cache/
returns
CFPropertyList-3.0.0.gem faraday-cookie_jar-0.0.6.gem mini_magick-4.5.1.gem simctl-1.6.5.gem
addressable-2.6.0.gem faraday_middleware-0.13.1.gem multi_json-1.13.1.gem slack-notifier-2.3.2.gem
atomos-0.1.3.gem fastimage-2.1.5.gem multi_xml-0.6.0.gem terminal-notifier-1.8.0.gem
babosa-1.0.2.gem fastlane-2.117.1.gem multipart-post-2.0.0.gem terminal-table-1.8.0.gem
bundler-2.0.1.gem gh_inspector-1.1.3.gem nanaimo-0.2.6.gem tty-cursor-0.6.1.gem
claide-1.0.2.gem google-api-client-0.23.9.gem naturally-2.2.0.gem tty-screen-0.6.5.gem
colored-1.2.gem google-cloud-core-1.3.0.gem os-1.0.0.gem tty-spinner-0.9.0.gem
colored2-3.1.2.gem google-cloud-env-1.0.5.gem plist-3.5.0.gem uber-0.1.0.gem
commander-fastlane-4.4.6.gem google-cloud-storage-1.16.0.gem public_suffix-2.0.5.gem unf-0.1.4.gem
declarative-0.0.10.gem googleauth-0.6.7.gem representable-3.0.4.gem unf_ext-0.0.7.5.gem
declarative-option-0.1.0.gem highline-1.7.10.gem retriable-3.1.2.gem unicode-display_width-1.5.0.gem
digest-crc-0.4.1.gem http-cookie-1.0.3.gem rouge-2.0.7.gem word_wrap-1.0.0.gem
domain_name-0.5.20180417.gem httpclient-2.8.3.gem rubygems-update-3.0.2.gem xcode-install-2.3.0.gem
dotenv-2.7.1.gem jwt-2.1.0.gem rubygems-update-3.0.3.gem xcodeproj-1.8.1.gem
emoji_regex-1.0.1.gem memoist-0.16.0.gem rubyzip-1.2.2.gem xcpretty-0.3.0.gem
excon-0.62.0.gem mime-types-3.2.2.gem security-0.1.3.gem xcpretty-travis-formatter-1.0.0.gem
faraday-0.15.4.gem mime-types-data-3.2018.0812.gem signet-0.11.0.gem
without the missing ffi gem
I might miss something fundemental but ideally I would like the homebrew ruby version 2.6.x running when I run sass - so where from here?
As per M. Zinovski's suggestion I uninstalled homebrew ruby and installed rbenv via homebrew. I followed instructions added
eval "$(rbenv init -)"
to .bash_profile - check installation seems fine.
SamuelserBook15:~ samuellarcher$ curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Checking for `rbenv' in PATH: /usr/local/bin/rbenv
Checking for rbenv shims in PATH: OK
Checking `rbenv install' support: /usr/local/bin/rbenv-install (ruby-build 20190314)
Counting installed Ruby versions: 2 versions
Checking RubyGems settings: OK
Auditing installed plugins: OK
Local and global version set to newly installed rbenv 2.6.2
samuellarcher$ rbenv version
2.6.2 (set by /Users/samuellarcher/.ruby-version)
samuellarcher$ ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
However - when I ran sass - same old error - still referencing to 2.3.0 and ffi gem missing. So... absolutely min-bobbeling .. 2.6.2 is running why is it still pointing to 2.3.0 gem files???
I want to install Colorls. I am completely new to Ruby. To install Colorls I executed:
gem install colorls --user-install
After I while (maybe after I installed Anaconda) Colorls is not working anymore.
zsh: command not found: colorls
Here's some info:
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.2
- RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/matteo/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/matteo/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/matteo/.gem/ruby/2.6.0
- /usr/local/Cellar/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:
- /usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
- /Users/matteo/.gem/ruby/2.6.0
- /usr/local/lib/ruby/gems/2.6.0
- /usr/local/lib/ruby/gems/2.6.0
- /usr/local/opt/ruby/bin
- /Users/matteo/bin
- /usr/local/bin
- /sbin
- /usr/sbin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Library/TeX/texbin
I always forget how to install colorls when I reformat my Mac.
I have:
macOS Catalina Version 10.15.7 (don't miss with the preinstalled ruby)
I follow these steps:
Step -1-
Install ruby using homebrew
brew install ruby
Step -2-
Go to the directory
cd /usr/local/Celler/ruby/<x.x.x>/bin
# Or for ARM Mac I use here 3.1.1 that comes with brew install ruby
cd /opt/homebrew/Cellar/ruby/3.1.1/bin
# Then
./gem install colorls
my version is (3.0.1)
Step -3-
Now you are ready to link this library to the default one you installed before (following the GitHub repo steps of the colorls)
ln -s /usr/local/lib/ruby/gems/x.x.x/bin/colorls /usr/local/bin/colorls
# or for ARM Mac I use here gem 3.1.0
ln -s /opt/homebrew/lib/ruby/gems/3.1.0/bin/colorls /usr/local/bin/colorls
Hint: if you find any other colorls in the directory prior to executing the link command just remove it.
now check:
Is it possible your ruby version doesn't match gem version? Seems like minor version in
/usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
Make sure you still have the gem installed:
which colorls
#should output something like: /Users/yourusername/.rvm/gems/ruby-2.6.0/bin/colorls
See if the gem is indeed installed
gem list colorls
Then maybe try reinstall see https://github.com/athityakumar/colorls#install
You might wanna use a version manager, I recommend RVM see https://rvm.io/rvm/install
I have a blog of mine in jekyll and I want to publish it on github-pages.
Taking reference from here:
https://help.github.com/articles/using-jekyll-with-pages.
but I am getting this error while running bundle install
Gem::InstallError: public_suffix requires Ruby version >= 2.0.
An error occurred while installing public_suffix (1.5.1), and Bundler cannot continue.
Make sure that `gem install public_suffix -v '1.5.1'` succeeds before bundling.
below is the details of my gem env
gem env :
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.3
- RUBY VERSION: 2.1.6 (2015-04-13 patchlevel 336) [x86_64-linux-gnu]
- INSTALLATION DIRECTORY: /var/lib/gems/2.1.0
- RUBY EXECUTABLE: /usr/bin/ruby2.1
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /home/ashwin/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/2.1.0
- /home/ashwin/.gem/ruby/2.1.0
- /usr/share/rubygems-integration/2.1.0
- /usr/share/rubygems-integration/2.1
- /usr/share/rubygems-integration/all
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/heroku/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/games
Just like you my ruby version was correct, but the fix for me was reinstalling bundler.
sudo gem install bundler
Try installing without sudo.
I've had the same issue after upgrading Ruby to 2.2.3 with rbenv (which is installed without admin rights).
After having upgraded, I ran sudo gem install github-pages, which resulted in the above error. Running gem install github-pages worked just fine.
Then, trying to have Jekyll serve my page, I ran bundle exec jekyll serve, which told that there were some bundles missing. bundle install fixed that too, and bundle exec jekyll serve worked fine.
Make sure that gem install public_suffix -v '1.5.1' succeeds before bundling.
I had the same issue and this command solves it.
sudo gem install github-pages -v 33
Then run jekyll.
bundle exec jekyll serve
See here
In the past i've also had issues with installing github pages or Jekyll dependencies because there is a space somewhere in the full path to your project folder and apparrently some of the dependencies cant handle spaces in filenames.
Most recently this seems to have been happening to me with public_suffix version 4.0.5 where a space in my username causes it to break
This has also happened with http_parser
I have Ruby v2 installed:
$ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin11.0]
but I get this error on multiple gems when I run:
$ sudo gem update
What's the problem and how do I fix it?
EDIT 1:
$ gem update
Updating installed gems
Updating actionmailer
Fetching: activesupport-4.1.8.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/1.8 directory.
EDIT 2:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin11.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/user/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
$ rvm info
-bash: rvm: command not found
The gem env was using an old version of ruby. I completely removed the gems via
gem list | cut -d" " -f1 | sudo xargs gem uninstall -aIx
(keep this terminal tab open so you know which gems you had and you can reinstall them) then opened a new terminal tab and then removed gem by doing
$ which gem
/usr/bin/gem
$ cd /usr/bin && sudo ln -s ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem gem1.8.7 && sudo rm gem
I symlinked gem to gem1.8.7 if I want to use it later on.
Then I followed directions here https://rubygems.org/pages/download to reinstall gem with the latest ruby version, in my case Ruby 2.1.2p95.
I am trying to install Bundler on my VPS using Ansible.
I already have rbenv set up and the global ruby is 2.1.0.
If I SSH as root into the server and run gem install bundler, it installs perfectly.
I have tried the following three ways of using Ansible to install the Bundler gem and all three produce no errors, but when I SSH in and run gem list, Bundler is nowhere to be seen.
Attempt 1:
---
- name: Install Bundler
shell: gem install bundler
Attempt 2:
---
- name: Install Bundler
shell: gem install bundler
Attempt 3:
---
- name: Install Bundler
gem: name=bundler
state=latest
I have also tried the last attempt with user_install=yes and also with user_install=no and neither make any difference.
Any ideas how I can get it to install Bundler correctly via Ansible?
I've been working on this for a little while now and I have 1 ruby version installed: 2.1.0 and ahve found that the shims directory for rbenv does not contain a shim for bundle.
Should a shim for bundle be in there? I'm just getting confused as to why capistrano cannot find the bundle command as it's listed when I run sudo gem list but NOT when I run gem list?
root#weepingangel:/usr/local/rbenv/shims# echo $PATH
/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
root#weepingangel:/usr/local/rbenv/shims# gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/rbenv/versions/2.1.0/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rbenv/versions/2.1.0/bin
- SPEC CACHE DIRECTORY: /root/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rbenv/versions/2.1.0/lib/ruby/gems/2.1.0
- /root/.gem/ruby/2.1.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org", "http://gems.github.com"]
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://gems.rubyforge.org
- http://gems.github.com
- SHELL PATH:
- /usr/local/rbenv/versions/2.1.0/bin
- /usr/local/rbenv/libexec
- /usr/local/rbenv/shims
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
Any ideas?
So, I think the two main problems I have:
Why is bundler only visible when I run sudo gem list?
My deploy is saying:
INFO [18d5838c] Running /usr/bin/env bundle install --binstubs
/var/rails_apps/neiltonge/shared/bin --path
/var/rails_apps/neiltonge/shared/bundle --without development test
--deployment --quiet on 188.226.159.96 DEBUG [18d5838c] Command: cd /var/rails_apps/neiltonge/releases/20140301205432 && ( PATH=$PATH
/usr/bin/env bundle install --binstubs
/var/rails_apps/neiltonge/shared/bin --path
/var/rails_apps/neiltonge/shared/bundle --without development test
--deployment --quiet ) DEBUG [18d5838c] /usr/bin/env: bundle: No such file or directory
and this is my $PATH:
/usr/local/rbenv/shims:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Why can't bundle be located?
The problem is that, when running gem install bundler via ansible, you're not initializing rbenv properly, since rbenv init is run in .bashrc or .bash_profile. So the gem command used is the system one, not the one installed as a rbenv shim. So whenever you install a gem, it is installed system-wide, not in your rbenv environment.
To have rbenv initialized properly, you must execute bash itself and explicitely state that it's a login shell, so it reads it's initialization files :
ansible your_host -m command -a 'bash -lc "gem install bundler"' -u your_rbenv_user
Leave the -u your_rbenv_user part if you really want to do this as root.
If the above command works, you can easily turn it into a playbook action :
- name: Install Bundler
become_user: your_rbenv_user
command: bash -lc "gem install bundler"
It's cumbersome, but it's the only way I found so far.
Since Ansible 1.3 following native solution is possible:
- name: requirements for installing gems
apt:
name: {{ item }}
with_items:
- ruby
- ruby-dev
- make
- name: install gem with proper $PATH
gem:
name: xyz
user_install: no
Mention the user_install parameter! Additionally some dependecies installed by the bundler could need following further package dependencies:
zlib1g-dev
I've met the similar environment issue when I tried to run commands as another user. As mentioned in this feature request you have two options to execute your command in login shell (that will load user environment). For example i'ld like to install bundler as rails user:
- name: Install Bundler
shell: gem install bundler
sudo_user: rails -i
or
- name: Install Bundler
command: sudo -iu rails gem install bundler
This Worked for me:
- name: rubygems | install bundler
shell: gem install bundler
- name: rbenv | rehash
shell: RBENV_ROOT={{ rbenv_root }} rbenv rehash
Sometimes after installing bundler, with rbenv on the system, you need to update your $PATH by runing rbenv rehash. I just tried the same thing with ansible, and it worked. Bundler is available in my $PATH after rehash.
The cleanest and quickest way to install bundler using Ansible is this:
Simply install rbenv by using the role https://github.com/zzet/ansible-rbenv-role and by configuring its plugins like so (obviously, there are more parameters to configure than just the plugins):
rbenv_plugins:
- { name: 'ruby-build',
repo: 'https://github.com/rbenv/ruby-build.git',
version: master }
- { name: 'rbenv-default-gems',
repo: 'https://github.com/rbenv/rbenv-default-gems.git',
version: master }
The included plugin rbenv-default-gems will add bundler by default and into the right directory during the installation process of the version of ruby you will have spcecified.
Then make sure bundler is in PATH.
That's it.
I got it working like this:
- name: Install jekyll and bundler
become_user: bob
gem:
name: "{{ item }}"
environment:
GEM_HOME: /home/bob/gems
PATH: $PATH:/bin/:/usr/bin/:/home/bob/gems/bin
with_items:
- jekyll
- bundler
Replace bob with your local user.
And then use the same principle with the bundler module
- name: Install Gems
become_user: bob
bundler:
gemfile: /home/bob/Gemfile
state: present
environment:
GEM_HOME: /home/bob/gems
PATH: $PATH:/bin/:/usr/bin/:/home/bob/gems/bin