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"
Related
I have a rails project with twitter-bootstrap-rails gem and twitter bootstrap 2. Now I need to migrate to twitter bootstrap 3. But I don't know how to do this, because I update my gemfile like this:
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
then
bundle install
and everything works perfect, so I guess nothing is updated. How I can update my gem and work with twitter bootstrap 3.
Thanks in advance for your help.
According the documentation you need to switch to the bootstrap3 branch, so add a branch option to your Gemfile.
gem 'twitter-bootstrap-rails', :github => 'seyhunak/twitter-bootstrap-rails', :branch => 'bootstrap3'
Please read the documentation of the gem here: https://github.com/seyhunak/twitter-bootstrap-rails/tree/bootstrap3
Try generating the assets using the described procedure based on whether you are using less or static css.
For some Rails applications, I'd like to have a safe-guard when I deploy to check if I have some gems configured to be looked up at a local path.
A little bit of context may help to understand.
When I'm in development mode, I want to have a gem in "local mode". In my Gemfile it is configured like this : gem 'my_gem', '~> 0.9', :path => './path/to/my_gem'.
In production, I want to be like this : gem 'my_gem', '~> 0.9', :git => 'git#git.example.com:my_gem.git'.
I've tried to make a shell script (or function) to read the Gemfile.lock and exit with an error if the gem is in "local mode".
My deployment scripts could use this to abort if I've forgotten to switch back to the proper mode.
Any help will be appreciated.
Thanks
Use
group :development do
gem 'my_gem_for_development', '~> 0.9', :require => './path/to/my_gem/lib/my_gem.rb' , :path => './path/to/my_gem/lib'
end
group :production do
gem 'my_gem', '~> 0.9', :git => 'git#git.example.com:my_gem.git'
end
Is this a gem that you're developing? Why not just write the gem to look at the rails env and change settings based on that. Then you can one canonical version of the gem and you won't have to worry about checking to see which gem version you're using. Otherwise, bor1s' solution will work just fine.
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"
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.