In our production environment, we are forbidden from having compilers installed (don't ask). Back in the Ruby 1.8.7 days, we would use gem-compile to compile binary gems on a dev workstation and put the binary gem out in our repository. Is anybody aware of any similar methods that work with Ruby 2.0? I know RVM is capable of building custom packages of rubies that can be deployed, but I can't find any way to make it work with gems.
I'd like to come up with something a little less brittle than building everything on a dev box and rsync'ing the entire rvm directory over to the server.
Thanks!
check this part of rvm offline installation - http://rvm.io/rvm/offline#installing-gems :
Online
Create a (fake) project directory: mkdir gems; cd gems
Install bundler: gem install bundler
Create Gemfile: bundle init
Add rails to it: echo "gem 'rails'" >> Gemfile
Install all gems: bundle install
Get gem files: bundle package
Package project: tar czf gems.tgz .
Download bundler from https://rubygems.org/gems/bundler the Download link
Offline
Create a (fake) project directory: mkdir gems; cd gems
Unpack gems: tar xzf gems.tgz
Install bundler: gem install bundler-1.2.1.gem
Install gems: bundle install --local
Nevermind, I found the answer. There is a newer gem called gem-compiler from https://github.com/luislavena/gem-compiler that works with Ruby 2. I didn't think it was working because I inadvertently still had an old copy of gem-compile installed and that was getting executed when I ran 'gem compile'. Anyways, this generates platform specific gems for me that I can install in our production environment.
Cheers and Thanks,
Jason
Related
I have just started working with Ruby. I am trying to install a gem with local file system as source.
$gem source
*** CURRENT SOURCES ***
file:///home/fox/shared/
when i try to install 'bundler' gem it actually installs 'bundler-unload' gem as below.
$gem install bundler --bindir /usr/bin --no-ri --no-rdoc
Successfully installed bundler-unload-1.0.2
1 gem installed
the directory contains both the gems by the way.
bundler-unload-1.0.2.gem
bundler-1.10.6.gem
Is there anything that I am missing here. Why would it install the wrong gem?
I debugged the gem installer code and found the following.
First, the gem installer looks at the current directory to find the gems. It looks for *. It finds two gems (since i was running from the gems source directory) but sorts and reverse orders it and chooses the first one which is not the right gem. It does not do version check also when looking at the local directory. To workaround this i gave 'gem install bundler-1.10.6' which is working. By the way if i run 'gem install' from some other directory it is not able to find any gems from the 'file:' source.
I have limited privileges on a shared machine I'm using, so I can't install gems the way I'm used to. For example:
$ gem install request-log-analyzer
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.
Is it possible to install a gem locally? (if it matters, I'm trying to install this gem.)
I saw a number of posts on Stack Overflow that talked about using Bundler or gemfiles but I'm not installing this gem for a Ruby on Rails project - I just want to use it in isolation.
I'm running Linux, not sure which flavor though.
You can try:
gem install --user-install gem_name
Add the --local flag to your install:
gem install --local request-log-analyzer
If that causes any problems, try downloading the gem manually and pointing gem directly to it using:
gem install --local path/to/gem/filename.gem
If you want to install it to your user home, as per rubygems:
When you use the --user-install option, RubyGems will install the gems
to a directory inside your home directory, something like
~/.gem/ruby/1.9.1. The commands provided by the gems you installed
will end up in ~/.gem/ruby/1.9.1/bin. For the programs installed there
to be available for you, you need to add ~/.gem/ruby/1.9.1/bin to your
PATH environment variable.
The command for this would just be
gem install --user-install request-log-analyzer
You could just use RVM: Ruby Version Manager. It is a complete version manager, along the lines of node version manager (nvm) and others, in that it allows you to have different versions of ruby and different collections of gems for each project. It does the job of keeping gems isolated from each other as well as from the system ruby, but at the expense of learning a complete version manager.
When run without root, it installs locally in ~/.rvm and doesn't affect other users.
I installed redmine on my server.
Redmine is installed in /usr/share/redmine.
I try to install redmine backlogs using the installation guide)
As mentionned in the guide, I execute the following commands:
cd /usr/share/redmine
bundle exec rake redmine:backlogs:install
It fails with the message: Could not locate Gemfile
It looks like the bundle command is waiting for a gemfile in the directory but this file is missing.
Do you have any idea how to solve this problem?
EDIT: Note that I installed Redmine using the Wheezy backports. Maybe we cannot install plugins when Redmine has been installed from the Debian package....
Thank you
That url is for sale now, your best bet is to build it from source from the most currently updated fork from that project which is: https://github.com/ahelten/redmine_backlogs
Try this:
cd ~/redmine/plugins
git clone https://github.com/ahelten/redmine_backlogs.git
git checkout feature/v1.0.6_inherit_fields
Install libs and gems needed by backlogs
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri -v '1.5.11'
bundle install
Test Your Work
bundle exec rails server webrick -e production
NOTE: this assumes that you have git and whatever other development tools and gems you need installed. If you fail to install a gem, scroll up and read the output, chances are you need to add a package mentioned in the output first (sudo apt-get install foo). If you fail to find a gem you are either building in a directory without a Gemfile or the gem the gem file wants doesn't exist ... search rubygems.org if that happens)
MacBook-Air:~ bdeely$ gem install bundler
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...
MacBook-Air:~ bdeely$ rbenv rehash
MacBook-Air:~ bdeely$ bundle install
Bundler::GemfileNotFound
I keep getting this error "Bundler::GemfileNotFound" even after I have successfully installed bundler.
Does anyone have any idea what might be going on?
For reference, I am following the directions here:
http://octopress.org/docs/setup/
Create Gemfile in your directory.
Bundler is a gem manager. You should point somewhere which gems you need. The place is Gemfile.
Article
The instructions that come with Octopress aren't clear, but the part where you bundle install has to be performed from within the Octopress directory.
You can't skip the first 3 step of cloning octopress:
git clone git://github.com/imathis/octopress.git octopress
cd octopress # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version # Should report Ruby 1.9.3
After that, your should in octopress folder and there is a Gemfile in it, now you can move on with bundle install
I'm working in kali-linux (a linux distro witch is the continuation of Back-Track, based in Ubuntu, just that now is based on Debian wheezy) for some penetration testing. Everything was working just fine, until I decided to update my systems tools. Now whenever I try to run a tool based on ruby, it trows me:
Could not find gem 'ruby-progressbar (>= 1.1.0) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.
I proceed to run bundle install but then it comes with Bundler::GemfileNotFound error.
Kali use by default ruby, for using gems. The software don't 'require' any other package but ruby seems not-fully-configured/installed for the problem at hand.
$ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [i486-linux]
$ rvm
bash: rvm: command not found
$ rbenv
bash: rbenv: command not found
I faced the same problem when I was trying to bundle install without realizing that I was not in the project directory. Make sure you're in the current project directory.
to avoid this error you should be at the root of your application and create GemFile and specify all gems needed in there, and run bundle install
The problem was that for some weird motive Ruby didn't detected that bundler was installed, although the package manager says so.
$ apt-cache policy bundler
bundler:
Installed: 1.3.5-2
Candidate: 1.3.5-2
$ bundle --version
Bundler::GemfileNotFound
I simply run gem install bundler then bundler install as root in the tool root path and everything works as charm.
Do you use rvm or rbenv? If so, make sure you are using a particular ruby version.
For rvm, rvm list and look for an indication next to your ruby version. If the correct one is not listed, run rvm install x.y.z. If the correct one is not selected, run rvm use x.y.z
If you want to segregate your gems for a given project, create a gemset. Otherwise, you should be good to go.
Run gem install bundler. You should not have to do this as sudo. This will install bundler in either the Default rvm gemset, or the selected gemset.
Bundler should now be available and can be run using bundle. This is the same as bundle install.
Try this:
sudo ln -s /var/lib/gems/1.8/bin/bundle /bin/bundle
sudo ln -s /var/lib/gems/1.8/bin/bundler /bin/bundler
Worked for me in debian.