最近我创建了一个新的Rails 5应用程序,没有git存储库.自动生成的Gemfile包含一个我之前没见过的新块:
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
Run Code Online (Sandbox Code Playgroud)
它的含义是什么?每个新应用都必须使用它吗?
在Rails 2.X中,我可以简单地将gems复制到vendor/gems/gem_name或使用rake命令rake gems:unpack.由于Rails3使用了bundler,它似乎不再起作用了.我找到了命令bundle package,但它的工作方式不同.
所以,只是详细说明一下:
该轨道2的工作方式,我可以很容易地用grep找东西在vendor/gems.如果它们捆绑在.gem文件中,那是不可能的.此外,在开发gem /插件时,将它放在rails应用程序中以在上下文中测试它是非常有帮助的.我怎么用bundler/rails3做这些事情?我的工作流程本质上是以某种方式破坏的吗?
我正在尝试构建一个rails项目,因为我正在处理的主机无法访问Internet上的git://协议(端口9418)我得到的错误就像
Fetching git://github.com/pivotal/jasmine.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.130]: errno=Connection refused
Run Code Online (Sandbox Code Playgroud)
跑步的时候bundle install.
GemFile中的相关行没有指定git://作为协议,它只是指向GitHub作为gem的源代码
gem 'jasmine', :github => 'pivotal/jasmine-gem'
Run Code Online (Sandbox Code Playgroud)
我需要做些什么来使捆绑器使用https://而不是git://从GitHub中提取宝石?
编辑:
除了编辑GemFile中的每个受影响的行之外,还有其他方法吗?如果项目的GemFile更新,我宁愿避免任何合并问题.
Rails 3.0.0,乘客2.2.15:
gem 'paperclip', :git => 'git://github.com/lmumar/paperclip.git', :branch => 'rails3'
到您的Gemfilebundle installrails/script server&access 开始也有效未检出git://github.com/lmumar/paperclip.git(在rails3).请运行bundle install(Bundler :: GitError)
我曾尝试bundler pack(不利于)和设置BUNDER_HOME到〜/ .bundler(回纹针的git得到由安装有bundler install在.htaccess和不同的地方)在配置/*.RB,但没有成功,太.
〜/ .bundler是由相同的用户Rails项目(客运此用户下运行)所拥有,所以它不可能是一个权限问题.sudo已安装并调用bundle install.
任何提示?
我正在努力将我们的一个Rails 2.3.8应用程序升级到Rails 3,并且遇到了捆绑和部署的恼人问题.我在Windows机器上开发应用程序,但生产环境正在运行Ubuntu Linux.现在,我的问题是Bundler忽略了mysql生产环境中的gem,并且Passenger吐出:"!!!错过了mysql gem.将它添加到你的Gemfile:gem'mysql','2.8.1'"
这是我的Gemfile:
# Edit this Gemfile to bundle your application's dependencies.
# This preamble is the current preamble for Rails 3 apps; edit as needed.
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'net-ldap', :require => 'net/ldap'
gem 'highline', :require => 'highline/import'
gem 'mysql', '2.8.1'
gem 'net-ssh', :require => 'net/ssh'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake …Run Code Online (Sandbox Code Playgroud) 我试图在Sublime Text中打开一个gem,但没有成功.我安装了Bundler.这是正在发生的事情.
在命令行中:
$bundle open Devise
To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR
Run Code Online (Sandbox Code Playgroud)
当我去Bundler网站时,它说,
打开给定捆绑gem的源目录:
$ bundle打开GEM
这将在编辑器中打开提供的GEM的源目录.为此,必须设置
EDITOR或BUNDLER_EDITOR环境变量.
我是所有这一切的新手.设置我的环境变量或环境变量的具体步骤是什么?我在Mac上,使用Sublime Text.EDITORBUNDLER_EDITOR
谢谢.
ruby command-line ruby-on-rails environment-variables bundler
使用节点包管理器时,您可以指定npm install --save mynodemodule自动弹出模块的位置package.json
我想知道是否有一个Bundler命令允许你从命令行添加gem和版本到gemfile?
例如 bundle install --save nokogiri
bundle update并且bundle install很棒.但是,有什么好方法undo bundle install,bundle update如果出现问题?
我一直在做这里发现的Rails教程,并且已经成功到必须使用$ rails db:migrate迁移 Comments 迁移.在此之前,我已经能够生成文章模型并迁移文章创建迁移而没有任何问题.在这两次迁移之间,我的Gemfile中没有任何变化,所以我不确定Bundler有什么问题.
以下是错误,然后是完整的命令行输出,以及我的Gemfile和schema.rb:
Gem::LoadError: can't activate pg (~> 0.18), already activated pg-1.0.0.
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
Run Code Online (Sandbox Code Playgroud)
完整的命令行输出
xxx:gangelo: ~/dev/rails/test/blog (master*) ? rbenv exec rails db:migrate
rails aborted!
Gem::LoadError: Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile (and …Run Code Online (Sandbox Code Playgroud) 如何删除bundle install在特定RoR项目中使用的所有安装的gem .我不想卸载其他项目使用的gem.
bundler ×10
ruby ×4
command-line ×1
gem ×1
gemfile ×1
github ×1
passenger ×1
postgresql ×1
rvm ×1