简体   繁体   English

为什么Rails Composer在构建应用程序时会更新Rails?

[英]Why does the Rails Composer update Rails when it builds an app?

# I run these commands:
$ rvm current
ruby-2.3.3@rails500
$ gem list | grep '^rails '
rails (5.0.1, 5.0.0)
$ gem uninstall rails -v 5.0.1
Successfully uninstalled rails-5.0.1
$ gem uninstall railties -v 5.0.1
Successfully uninstalled railties-5.0.1
$ gem list | grep railties
railties (5.0.0)
$ rails -v
Rails 5.0.0
$ rails new . -m \
https://raw.github.com/RailsApps/rails-composer/master/composer.rb
# After I answer all the prompts, a Gemfile is created, which requires
# rails '~> 5.0.1'. After running to completion, Rails Composer leaves
# me with Rails 5.0.1:
$ rails -v
Rails 5.0.1

I didn't explicitly ask for Rails 5.0.1. 我没有明确要求Rails 5.0.1。 Then why am I getting it? 那我为什么要得到它? It appears to interfere with Rails Composer. 它似乎会干扰Rails Composer。 See https://github.com/RailsApps/rails-composer/issues/261 and https://github.com/RailsApps/rails-composer/issues/260 参见https://github.com/RailsApps/rails-composer/issues/261https://github.com/RailsApps/rails-composer/issues/260

You've observed a behavior of the Rails new command. 您已经观察到Rails new命令的行为。 Rails Composer is a Rails application template and piggybacks on the Rails new generator. Rails Composer是一个Rails应用程序模板,并在Rails new成器上搭载。 The Rails new command generates a simple default Rails application and then Rails Composer modifies it. Rails new命令生成一个简单的默认Rails应用程序,然后Rails Composer对其进行修改。 The Gemfile generated by the Rails new command contains gem 'rails', '~> 5.0.0' . Rails new命令生成的Gemfile包含gem'rails gem 'rails', '~> 5.0.0' Note the "pessimistic versioning" specified by ~> 5.0.0 . 注意~> 5.0.0指定的“悲观版本控制”。 It means use any version greater than 5.0.0 and less than 5.1 (any patch version can be used). 这意味着使用大于5.0.0且小于5.1的任何版本(可以使用任何补丁程序版本)。 When the Rails new generator runs, it updates the gems, including the Rails gem, using the Gemfile provided by the simple default Rails application. Rails new成器运行时,它将使用简单的默认Rails应用程序提供的Gemfile更新gem,包括Rails gem。 Thus, the Rails 5.0.1 gem is installed before Rails Composer runs. 因此,在Rails Composer运行之前,已安装Rails 5.0.1 gem。

You can observe this behavior by running the Rails new command without the Rails Composer application template. 您可以通过在没有Rails Composer应用程序模板的情况下运行Rails new命令来观察此行为。

myapp/2.4.0@rails500 $ rvm current ruby-2.4.0@rails500 myapp/2.4.0@rails500 $ gem list | grep '^rails ' rails (5.0.0) myapp/2.4.0@rails500 $ rails -v Rails 5.0.0 myapp/2.4.0@rails500 $ rails new . . . . run bundle install . . . Installing rails 5.0.1 . . . myapp/2.4.0@rails500 $ rails -v Rails 5.0.1

In summary, your issue is with the Rails new command, not with Rails Composer. 总之,您遇到的问题是Rails new命令,而不是Rails Composer。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么Rails作曲家只能创建没有功能的基本应用程序? 'open_http':找不到404(OpenURI :: HTTPError) - Why is Rails composer only creating a basic app without features? `open_http': 404 Not Found (OpenURI::HTTPError) Rails Brick或Rails Composer是否被广泛使用? - Are Rails Brick or Rails Composer widely used? Rails 应用程序下载文档而不是显示 - rails app downloading documents instead of displaying 手动将flexslider添加到Rails 4应用中-类型错误flexslider不是功能 - Adding flexslider manually into Rails 4 app - Type Error flexslider is not a function Rails忽略了Gemfile - rails ignores Gemfile 在Rails 3.2中访问参数 - Accessing Params in Rails 3.2 railsapps(rails-devise-pundit)应用程序是否包含多个角色支持? - Does railsapps (rails-devise-pundit) apps have multiple role support baked in? Foundation,modal和Rails:不推荐使用event.returnValue - Foundation, modal and Rails: event.returnValue is deprecated 使用Bootstrap或Foundation在Rails 4.1下的Flash消息的颜色错误 - Wrong color for flash messages under Rails 4.1 with Bootstrap or Foundation Rails 5:如何使用Google Analytics(分析)? - Rails 5: How can I get Google Analytics to work?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM