'bundle install' error for gems using git path Rails 3 - ruby-on-rails

Every time I deploy to my production server I get the following error for gems that use a git path:
git://github.com/odorcicd/example.git (at rails3) is not checked out. Please run `bundle install` (Bundler::PathError)
I've found that if I run "bundle install --deployment" it solves this problem. But it installs all my gems again and I have to do it after each deployment. Has anyone found a better solution than this?
This is an example of the using a git path in my Gemfile:
gem 'efax', :git => 'https://github.com/TTDaVeTT/efax.git'

Same issue here: I've got this gem that requires a git origin.
gem "machinist_mongo", :git => "https://github.com/nmerouze/machinist_mongo.git", :require => "machinist/mongoid", :branch => "machinist2"
From what I've found; bundle installs the gem, but not in your gemset - so you have to get rails to include the gems specifically somehow... need help on that part.

Related

Unable to install Doorkeeper-MongoDB

I have a fresh installation of rails 4 with MongoMapper. Now i'm trying to install doorkeeper on my rails instance.
I added the "gem 'doorkeeper-mongodb'" line in my Gemfile. Then I ran 'bundle install'. And I got the following error :
Could not find gem 'doorkeeper-mongodb (>= 0) ruby' in any of the gem sources listed in your Gemfile or available on this machine.
Also, I tried to install it using the gem install command but it doesn't work either.
I'm on Mac OS X.
The line to put in the Gemfile is
gem 'doorkeeper-mongodb', github: 'doorkeeper-gem/doorkeeper-mongodb'
I tried checking the gems in https://rubygems.org and could not find doorkeeper-mongodb.
And then googled out, and found that if you want to install gems from github source, then the right way seems like this following:
gem 'doorkeeper-mongodb', :git => 'git://github.com/doorkeeper-gem/doorkeeper-mongodb.git'
Or you can also download the source from github, and install it from local.

Bundler throws No Such file or directory for gem install

In Gemfile,
gem "backup", :git => "git://github.com/tenmiles/backup.git", :ref => "develop"
n local and in staging, bundle install did finish successfully. In production, when bundle install --deployment happens, bundler throws this error
Using backup (3.0.19) from git://github.com/tenmiles/backup.git (at develop)
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:365:in `initialize': No such file or directory - /home/anand/public_html/myapp/releases/20111113170352/vendor/bundle/ruby/1.9.1/bundler/gems/gems/backup-3.0.19/bin/backup (Errno::ENOENT)
I checked in /home/anand/public_html/myapp/releases/20111113170352/vendor/bundle/ruby/1.9.1/bundler/gems/gems/ and backup-150fb5168ebe is there! Its a gem installed via git. why is bundler looking for backup-3.0.19. How can I refresh backup gem and ask bundler to re install the gem from scratch.
Please help
Try this http://raflabs.com/blogs/silence-is-foo/2010/07/19/installing-a-gem-fork-from-github-source/ U can install the gem into your gem set by the method mentioned in there
I had this issue with 1.0.10, but when I updated the servers to bundler 1.0.21 the problem went away.
i have the some problem with current spork. If you specify a version it should work
gem "backup", '1.0', :git => "git://github.com/tenmiles/backup.git"
it fixed it for me

Bundler and Github Gems

I'm confused ;-) I use Bundler which works fine for all my projects. In the recent project i need some Gems from Github so I've added
gem "dm-is-localizable", :git => "git://github.com/snusnu/dm-is-localizable.git"
to my Gemfile.
Bundle pushes the dm-is-localizable stuff into my project dir directly (same dir where app/, db/, lib/ etc. resist, so there's dm-is-localizable/ now). Whats going wrong there? Shouldn't Bundle put the stuff into vendor/?
There's a bug with Bundle such that gems from :git don't get installed the same way as the rest. You can do bundle install --system to force all gems into be install into your system directory, or add these lines to your .bundle/config inside your project:
BUNDLE_PATH: "vendor"
then run 'bundle install' once more.
I'm hoping Bundle will support :git more seamlessly in the future.

error in installing authlogic in rails 3.1

hello
i want to use authlogic with rails 3.1
i have pasted following code in the gem file
"gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3' #http://techoctave.com/c7/posts/37-authlogic-and-rails-3-0-solution"
and then trying to do bundle install.
but getting the error like this
"Fetching git://github.com/odorcicd/authlogic.git
An error has occurred in git when running git clone "git://github.com/odorcicd/
authlogic.git" "c:/jruby-1.6.0.RC2/lib/ruby/gems/1.8/cache/bundler/git/authlogic
-6baa44cd7023e0828fc87e150aa82c0caeeb7c3d" --bare --no-hardlinks. Cannot comple
te bundling."
i have tried the command "gem install authlogic" and its successfully installed the gem
but then also facing the same error in bundle install
can anyone help me?
thanks.
gem 'authlogic' in your Gemfile will be enough

How can I specify a local gem in my Gemfile?

I'd like Bundler to load a local gem. Is there an option for that? Or do I have to move the gem folder into the .bundle directory?
I believe you can do this:
gem "foo", path: "/path/to/foo"
In addition to specifying the path (as Jimmy mentioned) you can also force Bundler to use a local gem for your environment only by using the following configuration option:
$ bundle config set local.GEM_NAME /path/to/local/git/repository
This is extremely helpful if you're developing two gems or a gem and a rails app side-by-side.
Note though, that this only works when you're already using git for your dependency, for example:
# In Gemfile
gem 'rack', :github => 'rack/rack', :branch => 'master'
# In your terminal
$ bundle config set local.rack ~/Work/git/rack
As seen on the docs.
You can also reference a local gem with git if you happen to be working on it.
gem 'foo',
:git => '/Path/to/local/git/repo',
:branch => 'my-feature-branch'
Then, if it changes I run
bundle exec gem uninstall foo
bundle update foo
But I am not sure everyone needs to run these two steps.
In order to use local gem repository in a Rails project, follow the steps below:
Check if your gem folder is a git repository (the command is executed in the gem folder)
git rev-parse --is-inside-work-tree
Getting repository path (the command is executed in the gem folder)
git rev-parse --show-toplevel
Setting up a local override for the rails application
bundle config local.GEM_NAME /path/to/local/git/repository
where GEM_NAME is the name of your gem and /path/to/local/git/repository is the output of the command in point 2
In your application Gemfile add the following line:
gem 'GEM_NAME', :github => 'GEM_NAME/GEM_NAME', :branch => 'master'
Running bundle install should give something like this:
Using GEM_NAME (0.0.1) from git://github.com/GEM_NAME/GEM_NAME.git (at /path/to/local/git/repository)
where GEM_NAME is the name of your gem and /path/to/local/git/repository from point 2
Finally, run bundle list, not gem list and you should see something like this:
GEM_NAME (0.0.1 5a68b88)
where GEM_NAME is the name of your gem
A few important cases I am observing using:
Rails 4.0.2
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Ubuntu 13.10
RubyMine 6.0.3
It seems RubyMine is not showing local gems as an external library. More information about the bug can be found here and here
When I am changing something in the local gem, in order to be loaded in the rails application I should stop/start the rails server
If I am changing the version of the gem, stopping/starting the Rails server gives me an error. In order to fix it, I am specifying the gem version in the rails application Gemfile like this:
gem 'GEM_NAME', '0.0.2', :github => 'GEM_NAME/GEM_NAME', :branch => 'master'
You can reference gems with source:
source: 'https://source.com', git repository (:github => 'git/url')
and with local path
:path => '.../path/gem_name'.
You can learn more about [Gemfiles and how to use them]
(https://kolosek.com/rails-bundle-install-and-gemfile) in this article.
If you want the branch too:
gem 'foo', path: "point/to/your/path", branch: "branch-name"

Resources