I have a git submodule of git://github.com/rails/rails in vendor/rails of my Rails 3 app. This is where an unpacked/vendorized Rails would go prior to 3.0.
How do I instruct my Gemfile that vendor/rails is the correct location, and not my system-wide rails install?
So, some people have noted that you can do simply:
gem 'rails', :path => "vendor/rails"
You can also include a version number, e.g.,
gem 'rails', '3.0.3', :path => "vendor/rails"
Both of these depend on what you actually have in vendor/rails. For example, if I do git checkout v3.0.3 in vendor/rails, both of these will work fine on their own (3.0.3 is the current).
But if I use a beta instead, I seem to need to add some additional dependencies:
gem 'rails', :path => "vendor/rails"
gem 'arel', :git => 'git://github.com/rails/arel.git'
gem 'rack', :git => 'git://github.com/rack/rack.git'
I could also extract these into vendor as git submodules, I suppose, and again use :path.
Do be aware that rack comes from rack/rack on github, not rails/rack. The latter is a fork and hasn't been updated since 2009. I made this mistake and spent hours fixing it.
If you've got older versions of rails installed on your machine, you may also need to take care to use script/rails instead of the rails command.
Isn't it just gem 'rails', '3.0.3', :path => "vendor/rails" in your Gemfile?
Use this line in your Gemfile:
gem 'rails', :path => "vendor/rails"
Related
I'm applying a patch to my fork of 2.3.15 rails for a workaround for one of the latest security issues.
Previously in my gem file I had -
gem 'rails', '2.3.15'
And everything worked as expected. But for my fork I have
gem 'rails', '2.3.15', :git => 'git#github.com:myrepo/rails.git', :branch => 'CVE-2013-0155-fix'
After doing a bundle install and then running my app with bundle exec ruby script/server as per usual, I'm getting this error -
| ./script/../config/boot.rb:64:in `require': no such file to load -- initializer (LoadError)
I thought that maybe I had just messed something up with my fork but when I point my gemfile to the rails git repo I get the same issue.
gem 'rails', '2.3.15', :git => 'git#github.com:rails/rails.git', :tag => 'v2.3.15'
Can anyone explain to me what's up?
Found an excellent blogpost on the issue here - http://robanderson123.wordpress.com/2013/01/05/applying-backported-security-patches-to-rails-2-3/
The big problem being that rails/2-3-stable doesn't have any gemspecs in the repo. Long story short, did a bundle install with rails set to 2.3.15. Copied the rails gemspecs for activerecord etc out of the specifications directory bundle show rails gives into each of the corresponding directories in my fork of rails. With the exception of the rails gemspec which I copied into the railties directory.
After this gem 'rails', '2.3.15', :git => 'git#github.com:myrepo/rails.git', :branch => 'my-2-3-branch' works as expected.
I'm using 'rails3-jquery-autocomplete' gem, but it doesn't have multi column search, but there is a fork that does it ( more details at: https://github.com/crowdint/rails3-jquery-autocomplete/pull/95).
Now I need to deploy to Heroku but it will install the official gem. How can I edit it? Or if it's not possible, how can I import a gem to the application?
Thanks.
you can use the fork by specifying the :git path in your Gemfile declaration
something like
gem "_GEM_NAME_", :git => "git://git/repository.git"
your other option would be to just vendor the gem inside your into a directory like vendor/gems/_gem_name and then you could use the :path option as well
gem "_GEM_NAME_", :path => "vendor/gems/_gem_name"
I've been trying (in vain) to get the latest version of the Sunspot gem (currently 2.0.0.pre.111215, incorporating Solr 3.5) working with Solr Cell.
Currently I am using the older version of Sunspot in combination with Solr Cell provided by the following plugin - https://github.com/chebyte/sunspot_cell.
My Gemfile for this configuration is as follows;
gem 'sunspot', '1.2.1'
gem 'sunspot_rails'
Unfortunately this older combination of Solr/Solr cell does not work with many newer PDF files. The recommended solution by Apache is to upgrade to the latest version of both.
The Sunspot Solr Cell bolt-on doesn't seem to be very well supported. The most recently updated version has been switched from a Plugin to a Gem, but I still can't get it to work with the latest version of the Sunspot Gem. https://github.com/zheileman/sunspot_cell
Does anyone know the correct Gemfile configuration to get the elements to play nicely together? The closest I have is this.
gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git'
gem 'sunspot', :git => "git://github.com/sunspot/sunspot.git"
gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git", :require => "sunspot_rails"
group :development, :test do
gem 'sunspot_solr', :git => "git://github.com/sunspot/sunspot.git"
end
When I run any rake task I get the following error.
uninitialized constant Sunspot::RSolr
If I comment the sunspot_cell gem out temporarily, I can get Rake tasks to run but actual searching fails.
I've tried manually using the Solr jar files in this gem instead of the ones bundled in sunspot_solr but also without success.
After a bit of trial and error, the answer to this turned out to be easier than I had hoped. The gems were apparently specified in the wrong order. I didn't realise it made any difference. I changed the order so that sunspot_cell was last and it burst into like. Magic! (almost).
gem 'sunspot', :git => "git://github.com/sunspot/sunspot.git"
gem 'sunspot_rails', :git => "git://github.com/sunspot/sunspot.git", :require => "sunspot_rails"
gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git'
Glad to know you already fixed it.
This is my current setup. A pretty big mess of gems, I know =)
gem 'rsolr', :git => 'git://github.com/mwmitchell/rsolr', :branch => "38b5b69a0d63cdf85560806c06f3187ea4339f5a" # 1.0.6 plus the timeout patch
gem 'sunspot'
gem 'sunspot_solr'
gem 'sunspot_rails'
gem 'sunspot_index_queue'
gem 'sunspot_cell', :git => 'git://github.com/zheileman/sunspot_cell.git', :branch => "bc8ac18de1410b3e29af89c4d028acc6deba1e1c"
I am working on a rails gem that has dependency on the following
gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
How can I add this in the gem spec as a dependency? Specifically I need to specifiy the path and branch in the dependency.
You definitely want to use Bundler then. You would put exactly what you have into the Gemfile file. Go checkout the link to Bundler I left below.
-- older info --
For jeweler you would add something like this:
gem.add_dependency 'authlogic', '> 1.0', '<= 2.0'
But you might be better off using Bundler. It's not just for rails: http://gembundler.com/
You need generate the gem. Publish it and after use this gem deploy.
I am developing a gem to use in my rails app.
The gem is located at /home/me/my_gem.
If I use gem 'my_gem', :git => '/home/me/my_gem' bundler takes it and installs it into ~/.bundler/... but I want the gem to be used directly from /home/me/my_gem so I don't have to run bundle install every time I do a change to the gem.
You need use the :path options
gem 'my_gem', :path => '/home/me/my_gem'
After that you even not need run a bundle install. Each time is your directory code used.