我目前有以下依赖项
i18n (~> 0.6, >= 0.6.4)
Run Code Online (Sandbox Code Playgroud)
我一直在阅读Ruby Gems - 声明依赖项指南
我发现“~> 0.6”部分表示 0.6 到 1.0 之间的任何值 - 如果这是错误的,请纠正我。
但我仍然很困惑,这对于第二个逗号分隔值实际上意味着什么?
一位同事认为这意味着
>= 0.6.4, <= 0.7
Run Code Online (Sandbox Code Playgroud)
但我不太确定。
什么时候执行下面的命令?另外,你能解释一下它给我们带来了什么吗?
$ bundle install --binstubs
Run Code Online (Sandbox Code Playgroud) 为什么我的 spring gem 会加载到错误的(或所有)环境中?
我的 Gemfile 中有这个,并且 spring gem 没有在文件中的其他位置列出:
group :development do
gem 'listen', '~> 3.1.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
Run Code Online (Sandbox Code Playgroud)
当我运行bundle exec rails console test(对于test环境)时,spring 进程启动并且Listen模块被加载到 Rails 控制台中。我确保事先停止所有弹簧进程。
为了进行健全性检查,我删除了上面的整个开发组并进行了捆绑。正如我所料,Spring 和 Listen gem 不再加载。
我在尝试发布我的 gh 页面时不断收到构建和部署错误,它在本地工作,有人可以帮助我吗?
我的网页使用的是 Jekyll al-folio。我在尝试发布 gh 页面时遇到的错误是:
github-pages can't satisfy your Gemfile's dependencies.
如果您需要更多信息,请告诉我。
我做了我能找到的一切,我自己几乎一年前也遇到了同样的问题,我发布了解决方案,但这对我来说不再有用了。我bundle update根据一种解决方案使用了更新的 gemfile.lock 但它也不起作用。
根据一条评论,由于我没有任何 gh-pages 分支,所以我创建了一个,并将页面设置中的分支从 main 更改为 gh-pages,我仍然收到相同的错误消息,并且构建和部署失败。
我正在将一个大型应用程序拆分成多个较小的应用程序.在这样做的时候,我意识到通过Gemfile.global在我的主应用程序和子应用程序中创建并包含它,我可以清理我Gemfile的所有内容.例如,我的所有部署宝石都在主要部分Gemfile,而我的导轨进入了Gemfile.global.
它几乎适用于我的所有宝石,除了一个:Squeel.
我Gemfile在根应用程序中开始:
gemfiles = [
File.join('Gemfile.global'),
]
Dir.glob(File.join(File.dirname(__FILE__), gemfiles)) do |gemfile|
eval(IO.read(gemfile), binding)
end
# gem 'squeel' # Let's try putting this in Gemfile.global
Run Code Online (Sandbox Code Playgroud)
我Gemfile.global看起来像:
source 'https://rubygems.org'
# rails and dependencies
gem 'squeel'
Run Code Online (Sandbox Code Playgroud)
bundle installrails sSqueel在主要方面表现出色,以及几乎所有东西,你期望的方式Gemfile.Gemfile.global但是,在使用默认的Squeel初始值设定项时,将其置于初始化过程中:
Squeel.configure do |config|
end
Run Code Online (Sandbox Code Playgroud)
rails suninitialized constant Squeel (NameError)即使bundle install报道,也会抛出一个Using squeel (1.0.13).为什么这个组合我Gemfile的陷阱运行时常量的方法?
我正在尝试安装新的rails应用程序.我已经在我的机器上安装了几个rails应用程序,一切正常.
$ rails new app
Could not locate Gemfile
Run Code Online (Sandbox Code Playgroud)
然后,我想我会运行跟踪来找出发生了什么事情,因为你不会期望有一个Gemfile在这一点上,无论如何,因为通常上面的命令将在名为目录中创建一个全新的Rails应用app与Gemfile载在该目录中.
$ rails new app --trace
Could not locate Gemfile
Run Code Online (Sandbox Code Playgroud)
因此,我尝试通过此详细指南重新安装计算机上的所有内容:
http://railsapps.github.com/installing-rails.html#gems
在前20个步骤之后,我得到了这个命令:
$ rake -v
Could not locate Gemfile
Run Code Online (Sandbox Code Playgroud)
我假设某些地方的设置已关闭,但我看不到任何关闭.
这是我的rvm设置:
$ rvm version
rvm 1.18.10 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ rvm list
rvm rubies
jruby-1.6.7 [ x86_64 ]
ruby-1.9.1-p431 [ i386 ]
ruby-1.9.3-p194 [ x86_64 ]
ruby-1.9.3-p286 [ x86_64 ]
ruby-1.9.3-p327 [ x86_64 ]
=* ruby-1.9.3-p385 [ …Run Code Online (Sandbox Code Playgroud) 我想在Heroku上运行我的应用程序时使用特定版本的ruby.
正如解释在这里,你只需要添加一行ruby "2.0.0"在你的Gemfile.
但是,当我在本地使用RVM时,我已经指定了ruby版本,以便在.ruby-version仅包含该行的项目的根目录中的文件中使用ruby-2.0.0-p0.
为了避免代码重复,我希望只在一个地方指定版本,以便我确信在开发和Heroku中总是使用相同的版本.
有没有办法做到这一点 ?
我一直在寻找解决这个问题的方方面面.我已经在我的gemfile中将jquery-rails gem降级为2.3.0.但是当我在application.js中包含jquery-ui时,我仍然会收到Sprokets :: FileNotFound错误.
couldn't find file 'jquery-ui'
(in /home/richard/projects/pickaxe/mini-projects/depot-app/app/assets/javascripts/application.js:14)
Run Code Online (Sandbox Code Playgroud)
这是我的application.js文件:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled …Run Code Online (Sandbox Code Playgroud) 所以我有一个在服务器上运行的ruby sinatra程序,我有一个Gem文件,以确保安装所有的依赖项.然而,它调用一个python脚本,它有自己的python模块依赖项.因此,当它部署到服务器时,所有红宝石宝石的依赖性都很好但不是它们的python依赖性.
有一个python等效的Gem文件?或者有没有办法通过Gem文件安装python模块?
我已经向我建议过buildr,但这似乎是基于java的程序.
任何帮助将非常感激.
RVM不会让我跑,bundle因为它认为我的Ruby版本与我的Gemfile所说的不同,但它不是:
$ rvm list
rvm rubies
=> ruby-1.9.3-p194 [ x86_64 ]
ruby-1.9.3-p429 [ x86_64 ]
* ruby-2.0.0-p195 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin13.0.0]
Run Code Online (Sandbox Code Playgroud)
的Gemfile:
ruby '1.9.3-p194'
Run Code Online (Sandbox Code Playgroud)
但是之后:
$ bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 1.9.3-p194
$
Run Code Online (Sandbox Code Playgroud)
这似乎是一件非常奇怪的事情.有任何想法吗?有很多人有这个问题,但他们的Gemfiles明显不同于正在运行的版本.我甚至完成了rvm use 1.9.3-p194,然后立即完成,bundle install但我得到了同样的错误.bundle update产生相同的错误.
如果我从Gemfile中删除ruby版本,它将默认为2.0.0,但切换rvm use到正确的版本(以符合远程服务器ruby版本)实际上是有效的.跑bundle install …