Tag: bundler

Gemfile中的环境变量

我在Gemfile中使用环境变量时遇到问题。 我正在尝试使用API​​密钥从私有Github存储库加载gem: auth = ENV[‘SECRET_GIT’] gem ‘foobar’, git: “https://#{auth}:x-oauth-basic@github.com/Foo/Bar.git” 但是如果我puts我的ENV[‘SECRET_GIT’]变量放在其中,那么它就没有了。 我可以这样做因为这些(特别是第一个): – https://devcenter.heroku.com/articles/bundler-configuration#gem-source-username-and-password – https://stackoverflow.com/a/7338154/5353193 – 使用Gemfile中的环境变量部署到Heroku Bundler版本1.14.6 ruby2.4.0p0 谢谢你的帮助 编辑 我想在我的本地环境中这样做,我想在heroku上做这个没有问题。

如何安装json gem – 无法构建gem原生扩展

我正在尝试将rails应用程序部署到我的ubuntu linux服务器上。 我正在使用capistrano和bundler,当它安装gem时,它失败并出现此错误: Installing json (1.7.7) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /opt/ruby-enterprise-1.8.7-2012.02/bin/ruby extconf.rb creating Makefile make /usr/bin/gcc -I. -I/opt/local/include -I/opt/ruby-enterprise-1.8.7- 2012.02/lib/ruby/1.8/i686-linux -I/opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux -I. -D_FILE_OFFSET_BITS=64 -fPIC -g -O3 -Wall -c parser.c In file included from /usr/include/i386-linux-gnu/bits/posix1_lim.h:157:0, from /usr/include/limits.h:145, from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:169, from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/syslimits.h:7, from /usr/lib/gcc/i686-linux-gnu/4.6/include-fixed/limits.h:34, from /opt/ruby-enterprise-1.8.7-2012.02/lib/ruby/1.8/i686-linux/ruby.h:95, from ../fbuffer/fbuffer.h:6, from parser.rl:1: […]

从rvm切换到rbenv,现在无法使用rails s。 无法激活bundler-1.12.5,已经激活了bundler-1.13.0.rc.1(Gem :: LoadError)

第一个错误: `check_version_conflict’: can’t activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError) 陷入这个错误: /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require’: dlopen(/Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle, 9): Library not loaded: /Users/phillipjones/.rvm/rubies/ruby-2.3.1/lib/libruby.2.3.0.dylib (LoadError) Referenced from: /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle Reason: image not found – /Users/phillipjones/workspace/messengerApp/vendor/bundle/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.bundle 以下是导致此问题的情况以及我尝试解决的步骤: 从rvm切换到rbenv后,我遇到了使用rvm创建的应用程序的问题。 我无法运行rails s。 首先我得到了这个错误: Phillip-Joness-MacBook:messengerApp phillipjones$ rails s /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2274:in `check_version_conflict’: can’t activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError) from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1403:in `activate’ from /Users/phillipjones/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:68:in `block in gem’ from […]

在RubyMine中运行规范时出现rake版本错误; 我可以手动编辑Gemfile.lock

我开始收到此错误,并想要一种方法来解决它: You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may solve this. 我在RubyMine中运行它。 我可以在我的Gemfile.lock中看到它指定10.1.0。 我可以手动将我的Gemfile.lock更新到10.1.1吗? 如果我做: $gem list …. rake (10.1.1, 10.1.0, 10.0.4, 0.9.2.2) 所以我不确定为什么它不仅仅适用于10.1.0? 这是RubyMine的完整输出: /Users/jt/.rvm/rubies/ruby-1.9.3-p448/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/jt/.rvm/gems/ruby-1.9.3-p448/bin/rake spec Testing started at 3:15 PM … rake aborted! You have already activated rake 10.1.1, but your Gemfile […]

无法在测试环境中加载gem

我的应用有效。 之前我能够进行测试,现在由于某种原因,我不能。 从现在到现在发生的事情是我提供了activesupport (但我已经撤消了这些更改,事实上我在一个完全独立/无关的分支)。 我在activesupport工作期间运行的两个我不熟悉的命令是bundle –deployment和bundle –no-deployment 。 同样,我相信我解除了与这些更改相关的所有事情( 至少就git status而言 – 我总是运行git status ,并且知道所有代码库更改)。 我知道其他人有类似的问题,但不是这个问题: https : //stackoverflow.com/search?q = require + can not+load+such+ file+LoadError 我正在玩这样的供应商 activesupport : 如何供应修改后的active_support版本,以便在我的Rails应用程序中使用它? 当我尝试将供应商的activesupport分支推送到staging时,我遇到了麻烦: “run` bundle install`在其他地方的’其他地方’哪里”? 无论如何,重点是我的应用程序工作 (即显然安装了所有gem, Gemfile和Gemfile.lock完好无损), 但我无法运行测试 : /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `require’: cannot load such file — minitest/rails (LoadError) from /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:229:in `block in require’ from /Users/bsimpson/.rvm/gems/ruby-2.0.0-p481@books/gems/activesupport-4.0.5/lib/active_support/dependencies.rb:214:in `load_dependency’ […]

不知道如何在Ubuntu natty上构建rake db:migrate?

我不知道如何使用Capistrano部署应用程序,但我想我至少尝试在部署服务器上加载我需要的所有文件,所以我在Github上做了一个git pull并使用bundle install安装了所有依赖项。 我使用Rails 3.0.9在Ruby 1.9.2p180中运行RVM 1.6.32,当我运行rake db:migrate时,我得到了 rake aborted! Don’t know how to build task ‘db:migrate’ 我没有其他SO用户提到的双重分号问题,所以我真的很困惑。 我安装了0.9.2和0.8.7,以及捆绑器1.0.17。 我的rvm实例显示rake (0.8.7 ruby) 出了什么问题? – 编辑 – rake –tasks的输出 rake sunspot:reindex[batch_size,models] # Reindex all solr models that are… rake sunspot:solr:run # Run the Solr instance in the for… rake sunspot:solr:start # Start the Solr instance rake […]

安装gem时停止询问密码

每当我捆绑我的rails 3.2 gems时,它会询问我的密码: 输入您的密码以将捆绑的RubyGems安装到您的系统 这真的很烦人,尤其是在一个项目中捆绑多次时。 但是,当我将gem目录设置为全局可读时,它总是在执行任何(!)rails命令时给出警告。 当然,这更令人讨厌。 我该怎么办呢?

捆绑exec与heroku – 是否有必要?

我最近在Heroku上设置了一个Cedar(Rails 3.1)应用程序,并且运行,例如,迁移,你会做 heroku run rake db:migrate 我了解到在任何rake命令之前使用“bundle exec”是一个好习惯(正如Katz所说http://yehudakatz.com/ )。 所以,我想也许以下实际上是更好的做法: heroku run bundle exec rake db:migrate 但是为了减少冗长,是否可以使用前一个命令,或者是bundle exec批判的那个?

Capistrano是否需要在Gemfile的开发组中?

在一个rails Gemfile中,gem’capistrano gem ‘capistrano’是否需要位于:development组中,或者将它放在任意组中是否有任何优势,例如:tools ?

Bundler似乎无法通过Rbenv找到正确的Ruby

多年来我一直使用RVM作为我的Ruby版本管理器,但我想切换到rbenv以简化它。 但是我发现部署有些奇怪的问题。 这里似乎出错了: # env RBENV_ROOT=\”/home/deploy/.rbenv\” PATH=\”/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH\” /home/deploy/.rbenv/bin/rbenv exec bundle install –gemfile /domains/myapp.com/releases/20140119013611/Gemfile –path /domains/myapp.com/shared/bundle –deployment –without development test > rbenv: bundle: command not found > The `bundle’ command exists in these Ruby versions: > 2.0.0-p353 好的,所以我指定了我想要的rbenv版本 – # env RBENV_ROOT=\”/home/deploy/.rbenv\” PATH=\”/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH\” RBENV_VERSION=\”2.0.0-p353\” /home/deploy/.rbenv/bin/rbenv exec bundle install –gemfile /domains/myapp.com/releases/20140119013611/Gemfile –path /domains/myapp.com/shared/bundle –deployment –without development test […]