gemfile

Rails gemfile editing

孤街醉人 提交于 2019-12-23 22:17:02
问题 I'm starting a Rails tutorial that tells me to edit the gemfile when creating a new demo app: source 'https://rubygems.org' gem 'rails', '3.2.3' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem :development do gem 'sqlite3', '1.3.5' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.4' gem 'coffee-rails', '3.2.2' # See https://github.com/sstephenson/execjs#readme for more

Gemfile - separating Production gems from Development gems

南楼画角 提交于 2019-12-22 09:07:32
问题 So I know that in a Gemfile I can do something like this: group :development, :test do gem 'gem1' gem 'gem2' end What I am looking to accomplish is something like this: group :production do gem 'gem1' gem 'gem2' end group :development, :test do gem 'gem1', :path => '/Documents/Code/gem1/' gem 'gem2', :path => '/Documents/Code/gem2/' end So our application uses 2 gems that we also develop locally. In order to improve time while developing on our local machines, we want to be able to point our

Why is 'jQuery-Rails' often outside of the asset group

假如想象 提交于 2019-12-22 02:03:14
问题 Why is it that I often see gem 'jquery-rails outside of the :assets group? group :assets do gem 'sass-rails', " ~> 3.1.0" gem 'coffee-rails', " ~> 3.1.0" gem 'uglifier' end gem 'jquery-rails' Will there be buggy behavior if I put it inside? Thanks! 回答1: The jquery-rails gem provides some test helpers also. So perhaps for that reason people prefer to put it outside the :assets group. However, the :assets group is included in development and testing environment, so you should be perfectly safe

How to find unused gems and cleanup gemfile

老子叫甜甜 提交于 2019-12-21 04:15:15
问题 I'm looking for simple, but good way to cleanup gemfile and make rails startup faster. How can I get a list of all required gems vs all loaded gems. 回答1: I think it is impossible. When your APP starts it loads gems from Gemfile.lock but it does not know if they (gems) are needed in your code or not. The APP inform you by raising an exception When something calls a class or method that is undefined if some needed gem is missed (if you remove it from Gemfile), but this can happen at any moment

How to find unused gems and cleanup gemfile

痴心易碎 提交于 2019-12-21 04:15:08
问题 I'm looking for simple, but good way to cleanup gemfile and make rails startup faster. How can I get a list of all required gems vs all loaded gems. 回答1: I think it is impossible. When your APP starts it loads gems from Gemfile.lock but it does not know if they (gems) are needed in your code or not. The APP inform you by raising an exception When something calls a class or method that is undefined if some needed gem is missed (if you remove it from Gemfile), but this can happen at any moment

I can't run “bundle update” because of “mysql2” gem

此生再无相见时 提交于 2019-12-21 03:56:09
问题 I have this in the Gemfile: gem 'mysql2' But when I run bundle update , I get this error message: An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling. I've tried to move this into the production section, like this: group :production do gem 'mysql2' end But after running bundle update , the result is the same. This section is processed only in the production mode, or not? How to get rid of

Gemfile.lock Use in Rails?

纵饮孤独 提交于 2019-12-20 11:14:03
问题 What is the purpose of "Gemfile.lock" in Rails? I have been searching around for but could not find a satisfactory answer. 回答1: You should read all the documentation from the bundler gem: http://gembundler.com/ THE GEMFILE.LOCK When you run bundle install, Bundler will persist the full names and versions of all gems that you used (including dependencies of the gems specified in the Gemfile(5)) into a file called Gemfile.lock. Bundler uses this file in all subsequent calls to bundle install,

Understanding Gemfile.lock: Is it okay to delete Gemfile.lock then run bundle install again?

☆樱花仙子☆ 提交于 2019-12-20 11:09:19
问题 We would test this, but don't want to risk ruining our dev environment if this isn't supposed to happen. Is it okay to delete Gemfile.lock? We're on Rails 3.0.6. 回答1: You're probably not going to ruin your dev environment. However, you might end up with newer versions of gems than you had before. It depends on how you have defined them in Gemfile . If you're using entries like: gem "rails" Then you'll get the latest rails gem, whatever that might be. If you're using entries like: gem "rails",

Why does the Gemfile semantic versioning operator (~>) produce inconsistent results with one number?

China☆狼群 提交于 2019-12-19 18:16:12
问题 The gemspec semantic versioning operator ~> (aka twiddle-wakka, aka pessimistic operator) allows a gem version to be constrained yet allow some upgrades. I have often seen that it can be read as: "~> 3.1" => "Any version 3.x, but at least 3.1" "~> 3.1.1" => "Any version 3.1.x, but at least 3.1.1" But with one number, this rule breaks down: "~> 3" => "Any version x, but at least 3" *NOT TRUE!* "~> 3" => "Any version 3.x" *True. But why?* If I wanted "Any version 3.x", I could just use "~> 3.0"

Is it possible to override gemfile for local development?

强颜欢笑 提交于 2019-12-19 07:35:47
问题 We have a Gemfile currently in our git repository. However, there's a gem I use only locally in my environment (my team doesn't use it). In order to use it, I have to add it to our Gemfile , but every time I check out to our master/dev main branch, I have to remove it because of conflicts with the tracked gemfile. What I would like is something like a Gemfile.local which would inherit the gems imported from the Gemfile but to also allow new gems to be imported there to use on my machine only.