gemfile

What is the difference between ~> and >= when specifying rubygem in Gemfile?

回眸只為那壹抹淺笑 提交于 2019-11-28 03:03:01
I often see the following notation(~>) in Gemfile. gem "cucumber", "~>0.8.5" gem "rspec", "~>1.3.0" I know the sign (>=) is just greater or equal to, but what does the (~>) notation mean? Are they both same or has any significant difference? That's a pessimistic version constraint . RubyGems will increment the last digit in the version provided and use that until it reaches a maximum version. So ~>0.8.5 is semantically equivalent to: gem "cucumber", ">=0.8.5", "<0.9.0" The easy way to think about it is that you're okay with the last digit incrementing to some arbitrary value, but the ones

How can Bundler/Gemfile be configured to use different gem sources during development?

≯℡__Kan透↙ 提交于 2019-11-27 23:29:03
问题 I have a Sinatra application that requires another gem I'm developing locally. I'm having trouble configuring Bundler to use my local gem code during development but my vendored gem code in production. Ideally I could do something like this, but Bundler doesn't allow you to specify the same gem twice: # Doesn't work: group :development do gem 'awesome', :path => "~/code/awesome" end group :production do gem 'awesome', :path => "vendor/gems/awesome-0.0.1" end In the meantime I've resorted to

Ruby Bundler multiple sources in Gemfile

≡放荡痞女 提交于 2019-11-27 14:24:39
问题 I need to ensure some of my gems are installed from our own gem repository rather than rubygems, while the rest are installed from rubygems. Can I set this up in the Gemfile without worrying about a naming conflict with a identically named gem in Rubygems? How Can I determine where the gem is downloaded from? eg Gemfile: source :rubygems gem 'gemfromrubygems1' gem 'gemfromrubygems2' source "http://our.own.gem.repo.com/the/path/to/it" gem 'gemfromourrepo' 回答1: Bundler 1.7 has a new feature

Gem::LoadError for mysql2 gem, but it's already in Gemfile

喜夏-厌秋 提交于 2019-11-27 10:46:09
Gem::LoadError Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile This error occurred while loading the following files: active_record/base This is the error I get on running rails server. The mysql2 gem has been added to the Gemfile as well. I've done bundle install , and tried restarting the server but still get the error. Hassan Azimi If you have this error when upgrading to rails 4.2.4 (also with rails 4.1.5) try using this version of mysql2: gem 'mysql2', '~> 0.3.18' Apparently mysql2 isn't still compatible with newer version of rails

What is the difference between Gemfile and Gemfile.lock in Ruby on Rails

余生颓废 提交于 2019-11-27 10:07:37
I am a beginner to Ruby on Rails and I am using Rails 3.0.9. What is the difference between Gemfile and Gemfile.lock in Rails? Dylan Markow The Gemfile is where you specify which gems you want to use, and lets you specify which versions. The Gemfile.lock file is where Bundler records the exact versions that were installed. This way, when the same library/project is loaded on another machine, running bundle install will look at the Gemfile.lock and install the exact same versions, rather than just using the Gemfile and installing the most recent versions. (Running different versions on

bundle install returns “Could not locate Gemfile”

不羁岁月 提交于 2019-11-27 09:27:29
问题 I'm new to Rails and am currently working through a guide. The guide states: Use a text editor to update the Gemfile needed by Bundler with the contents of Listing 2.1. source 'https://rubygems.org' gem 'rails', '3.2.3' group :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' gem 'uglifier', '1.2.3' end gem 'jquery-rails', '2.0.0' group

What is the difference between ~> and >= when specifying rubygem in Gemfile?

China☆狼群 提交于 2019-11-27 05:02:01
问题 I often see the following notation(~>) in Gemfile. gem "cucumber", "~>0.8.5" gem "rspec", "~>1.3.0" I know the sign (>=) is just greater or equal to, but what does the (~>) notation mean? Are they both same or has any significant difference? 回答1: That's a pessimistic version constraint. RubyGems will increment the last digit in the version provided and use that until it reaches a maximum version. So ~>0.8.5 is semantically equivalent to: gem "cucumber", ">=0.8.5", "<0.9.0" The easy way to

What is the use of Gemfile in rails?

早过忘川 提交于 2019-11-27 03:16:42
What is the use of Gemfile in rails? How to use Gemfile ? During your development in Rails, there will be times where you will want to provide some functionality which is required by you, but either you don't know how to do or you don't want to implement it on your own since a lot of work has been put into its development by talented developers. These developments which you might need (user authentication, message system, asset handlers, geolocation, pagination system, linking to exterior services such as Amazon AWS, and last but not least Rails itself) are called Ruby Gems. These are ruby

Why doesn't “rails s” work from the app directory?

ε祈祈猫儿з 提交于 2019-11-27 02:09:50
问题 I'm in my app folder, but the command rails s is not working. I read through quite a few posts on Stack Overflow, and most of them seem to be from users who are not in their app directory. In addition, I built a few other apps. I checked those, and the Rails server works for all of those apps. This is the only one where I can't get it to launch. Output of which rails : /Users/jmcrist/.rvm/gems/ruby-2.0.0-p247/bin/rails Output of rails s : MacBook-Pro:first_app jmcrist$ rails s Usage: rails

Rails app: using a gem vs. including source with Twitter Bootstrap

↘锁芯ラ 提交于 2019-11-27 00:39:24
问题 I've gone through my app and am having trouble finding where exactly the Twitter Bootstrap source goes when I include it through a gem. If I wanted to view the Bootstrap .css for example, how do I find it? The alternative, as I understand, to including it as a gem would be do download and include the source directly, correct? Is one approach better than the other. Finally, if I wanted to modify the Bootstrap css what is the best way to do it? If I had the source in my app I imagine I could