在 Gemfile 裡看到版本寫法有好幾款,各是代表什麼意思?
隨便打開一個 Rails 專案底下的 Gemfile
檔案,大概會長得像這樣(以 Rails 5.0.0 beta 4 為例):
source 'https://rubygems.org'
gem 'rails', '>= 5.0.0.beta4', '< 5.1'
gem 'sqlite3'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks', '~> 5.x'
gem 'jbuilder', '~> 2.0'
group :development, :test do
gem 'byebug', platform: :mri
end
group :development do
gem 'web-console'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
移除部份註解節省點空間。在這個例子裡,有些 gem 的後面有加註版本號碼,有的沒有,這些分別是代表什麼意思呢?