How do I install forked gems on heroku? - ruby-on-rails

I'm trying to get Heroku working with European buckets on amazon s3 webserivces using the aws-s3 gem. It seems I need to install a forked version of the gem to get around the issue. However, with heroku I can only use the .gems file to install gems.
Can I use this .gems file to install forked-gems somehow?

Unpack the gem in your local repository, then add it to your git repository. This will copy the gem to your vendor/gems directory. Also remember to remove the gem from your .gems list to prevent Heroku from using the unwanted version.
#Unpacks all gems
rake gems:unpack
#Unpack a specific gem
rake gems:unpack GEM=xxxxx

Heroku already supports Bundler even for not-Rails 3 application.
http://blog.heroku.com/archives/2010/2/17/gem_bundler_on_heroku/
You can switch to Bundler and use its syntax to have Bundler downloading the Gem from the fork.

Related

How to reset some Ruby Gem files without git?

I have made some modifications to some gem files that's not tracked by git. How do I reset the gem files to it's used version in console (with bundler?) ?
I'm also using Ruby on Rails.
You can uninstall the gem
gem uninstall gem-name
And then do a
bundle install
should be the easiest solution

Remove gem installed via Bundler from Git/Github

In my Rails app, I have installed the gem sdoc from Github by specifying gem 'sdoc', github: 'voloko/sdoc' in my Gemfile. All was well until I recently updated Bundler to v1.6.0.rc.
Now I get the following error message when Bundler tries to load the gem:
There was a LoadError while loading sdoc.gemspec:
cannot infer basepath from
/Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/sdoc-1a0e80c2d629/sdoc.gemspec:2:in `require_relative'
Does it try to require a relative path? That's been removed in Ruby 1.9.
I've already fixed the issue and submitted a pull request, but I cannot get rid of the "broken" gem!
This is what I tried:
removing the gem from the Gemfile or setting it to a different version
removing Gemfile.lock
deleting the gem folder /Users/manuel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/sdoc-1a0e80c2d629
gem uninstall sdoc (It doesn't even appear in gem list)
Nothing helped, every time I do bundle install or bundle update afterwards, I get the same error.
Any hints?
First-off: Clarifying a few things
From the Bundler documentation:
Because Rubygems lacks the ability to handle gems from git, any gems installed from a git repository will not show up in gem list. They will, however, be available after running Bundler.setup
Also, after deleting the gem inside the . . . /bundler/gems/ directory, you also should run rbenv rehash. This should get rid of the gem for you.
Answer:
Go to the root directory of your project (where the Gemfile resides) and run bundle clean. You have to pass either --path or --force switches. This should remove gems installed via git (usually if you have those gems installed and listed by gem list).
If you have issues. Delete the directories manually as you already tried and run rbenv rehash.
If I were you I would downgrade Bundler (ie. uninstall the RC release and install the latest stable).

Rails: purpose of downloading gems locally

Generally, if I need a gem, I put it in the Gemfile and bundle install. However, I don't understand if there is a benefit to downloading the gems locally first with gem install _____. Is there any benefit to this? Does bundle install no longer have to connect to the net in that situation?
Bundler installs the gems located in your Gemfile locally the same as if you ran gem install for each of those gems.
Gem install needed for gems that can be used outside of bundler applications. For example request-log-analyzer need to be installed outside of any apps for be available in command line.
I myself use gem install _______ then i use bundle install --local which doesn't require internet connection if the gem is found locally but will return an error if the gem was not found locally...
I find this method faster in downloading and installing gems, plus if the gems are found locally then i have also the benefit of altering the gemfile and install the gems without having internet connection.

How to use the master version of bundler

I am curious about how bundler (https://github.com/carlhuda/bundler) works. So I cloned the repository. However I am not able to figure out what I need to do so that when I do bundle install ruby should use the bundler which I have cloned and not the gem already installed.
I guess I need to add my repo path somewhere so that when ruby is looking for bundler it picks up cloned bundler and not the gem bundler.
I tried a few things. but nothing worked. I use rvm.
just do
gem build bundler.gemspec
which generates a .gem file and install this with rubygems
gem install bundler-1.1.0.gem
than you are using your own fork of bundler

Ruby on Rails 2 with Heroku: how do I install plugins?

I did: heroku plugins:install git://github.com/galetahub/rails-ckeditor.git
And got
Could not initialize rails-ckeditor: uninitialized constant ActiveSupport
Are you attempting to install a Rails plugin? If so, use the following:
Rails 2.x:
script/plugin install git://github.com/galetahub/rails-ckeditor.git
Rails 3.x:
rails plugin install git://github.com/galetahub/rails-ckeditor.git
my gemfile:
source :rubygems
gem 'rails', '2.3.8'
gem 'authlogic', '2.1.6'
gem 'addresslogic', '1.2.1'
gem 'searchlogic', '2.4.19'
gem 'subdomain-fu', '0.5.4'
gem 'ckeditor', '3.4.3'
So what happened when you ran script/plugin install git://github.com/galetahub/rails-ckeditor.git?
The idea of a plugin is that it will end up in the vendor directory in your Rails project, not as a stand-alone install on the server (those are gems).
DerNalia,
If I'm understanding you correctly I think you are misinterpreting what the heroku plugin install function is for. It's not for installing Rails plugins, it's for install plugins for the heroku command, like the heroku_colorize_console plugin. To install a plugin for your Rails application for Rails 2 you would use
script/plugin install git://github.com/galetahub/rails-ckeditor.git
This would install plugin into your vendor/plugins directory in your application and be initialized based on it's init.rb file (which is executed automated when the site loads). Your heroku app would have it accessible once you commit the changes and deploy back up to heroku.
See http://devcenter.heroku.com/articles/using-cli-plugins for more details about the Heroku command and the plugins function.

Resources