我正在开发Rails 3.1,并使用默认的uglifier资产gem.那个gem依赖于execjs,这需要一个JavaScript运行时.我在Mac OSX上开发,所以我从未遇到过麻烦.另一个开发人员使用Linux,默认情况下没有JavaScript运行时.所以使用therubyracer,一个嵌入在Ruby中的JavaScript运行时工作得非常好,但我希望Bundler只在系统是Linux的情况下安装它.我可以在Gemfile中指定它,所以它只能安装在Linux而不是Mac吗?
所以我知道在Gemfile中我可以这样做:
group :development, :test do
gem 'gem1'
gem 'gem2'
end
Run Code Online (Sandbox Code Playgroud)
我想要完成的是这样的事情:
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
Run Code Online (Sandbox Code Playgroud)
所以我们的应用程序使用了我们也在本地开发的2个宝石.为了在我们的本地机器上进行开发时缩短时间,我们希望能够将我们的开发环境指向宝石的本地副本 - 这样它就可以获取所有更改而无需重新启动rails服务器.否则我们将不得不重建gem,重新安装gem,并在gem中的每次开发更改时重新启动rails.
但是,这样做会给我带来以下错误:
You cannot specify the same gem twice coming from different sources. You specified that gem1 (>= 0) should come from an unspecfied source and source at /Documents/Code/gem1
Run Code Online (Sandbox Code Playgroud)
我试过甚至运行类似的东西bundle install --without production,我得到同样的错误.
有谁知道我是否有可能做我想做的事情?
谢谢!
好的,目前我可以使用Growl或Terminal Notifier与Guard合作.无论哪一个,我把我Gemfile和运行bundle与当时的作品.
我需要有一些其他的地方Gemfile来选择使用哪一个.我正在与多个开发人员合作开发一个项目,而且大多数都使用Growl.我更喜欢终端通知器.
我不想Gemfile在版本控制中进行更改.
我无法找到一种方法将其移入Guardfile.下一个最好的事情就是在Gemfile中直接包含并将它们分开,每个开发人员可以编辑他们的.extra-gems文件或其他什么?这看起来很混乱.
使用之间的确切区别是什么:
1- gem install [gemname]
和
2-为GemFile添加gem名称和版本并运行bundle install
?
我使用的是RubyMine(v6.0.2),但是我的队友不是,所以他们需要gemfile中的"debugger"gem.我可以在运行RubyMine时有条件地不需要Gemfile(因此Gemfile可以共享并且相同),但由于未包含'debugger'gem,Gemfile.lock文件会根据项目上次使用RubyMine运行还是更改不.这会在冗余的Gemfile.lock更改中产生很多噪音.
我尝试过使用'debugger-xml'gem; 这并没有解决问题.
那么 - 我怎样才能运行RubyMine 6.0.2,使用Gemfile中的'debugger'gem,而不更改Gemfile.lock?
版本的Bundler文档1.5说我应该指定patchlevel如下:
ruby '1.9.3', :patchlevel => 448
Run Code Online (Sandbox Code Playgroud)
当我按照指示运行时bundle install,我得到:
The Ruby patchlevel in your Gemfile must be a string
Run Code Online (Sandbox Code Playgroud)
如果我做
ruby '2.0.0', :patchlevel => '353'
Run Code Online (Sandbox Code Playgroud)
Bundler 说:
ruby-2.0.0,:patchlevel=>353 is not installed.
To install do: 'rvm install ruby-2.0.0,:patchlevel=>353'
Run Code Online (Sandbox Code Playgroud)
甚至可以用patchlevel指定ruby版本Gemfile吗?
在我的电脑上一切正常,但我无法推送到Heroku.
我正在做一个名为"Ruby on Rails Tutorial(3rd Ed.)"的流行RoR教程,他们希望我在Gemfile中拥有一行
gem 'sass-rails', '5.0.1'
Run Code Online (Sandbox Code Playgroud)
没有那条线我推动时没有问题,但如果添加这条线我得到:
->git push heroku master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 321 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.1
remote: -----> Installing dependencies using 1.7.12
remote: Ruby …Run Code Online (Sandbox Code Playgroud) 我正在使用Elastic Beanstalk,并且在我的日志中收到此错误-
您已经激活了机架1.6.0,但是您的Gemfile需要机架1.6.4。前置
bundle exec命令可以解决此问题。(Gem :: LoadError)
我已经看过所有相关问题(Related Question),但是对我没有任何帮助。当我做gem list | grep rack我的Get-
机架(1.6.4)
机架测试(0.6.3)
这表示我没有安装机架(1.6.0),这在我gem uninstall rack -v 1.6.0给我的时候可以确认-
错误:执行gem ...(Gem :: InstallError)时未安装gem“ rack”
我该怎么办?我应该卸载机架1.6.4吗?(这警告我将没有任何机架版本)
rack ruby-on-rails gemfile gemfile.lock amazon-elastic-beanstalk
当我rails s在控制台中运行
时,命令失败并得到以下响应:
Could not find nokogiri-1.6.8.1 in any of the sources
Run bundle install to install missing gems.
这里的第一个问题是 nokogiri 不在我的 Gemfile 中,因为我没有使用 nokogiri,那么为什么当 nokogiri 甚至不是我运行 bundle install 的项目的一部分时,它是一个问题?
然后我根据初始提示运行 bundle install :
bundle install
我收到一个错误。最后的错误信息:
An error occurred while installing byebug (9.0.6), and Bundler cannot continue.
Make sure that gem install byebug -v '9.0.6' succeeds before bundling.
我注意到,在整个过程中,我收到了其他错误消息:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
那么,这是我项目中 Gemfile 的问题还是更深层次的问题?意思是 Gems 安装在我的电脑上的方式?
这是我的 Gemfile:
source "https://rubygems.org"
ruby …Run Code Online (Sandbox Code Playgroud) 启动 rails 服务器时收到以下错误消息:
您的包被锁定为 rake (12.0.0),但是在您的 Gemfile 中列出的任何源中都找不到该版本。如果您没有更改源代码,则意味着 rake (12.0.0) 的作者已将其删除。您需要将您的捆绑包更新到尚未删除的其他版本的 rake (12.0.0) 才能安装。
我gem 'rake', '12.0.0'在 gemfile 中指定,但这并没有解决它。我试过bundle update rake,删除Gemfile.lock并用bundle exec bundle install. 我还在我的命令前加上了 `bundle exec1,它什么都不做。
我的 Gemfile.lock 已经指定了 rake 版本 12.0.0,没有安装其他版本。
查看我的 gemfile:http ://pastebin.com/L4tVFWz9
和 rakefile:http ://pastebin.com/K7p2ajsE
我尝试了已经激活的 rake 版本中建议的解决方案,与 Gemfile 需要的不同,以防止 rake 命令