如何快速初始化ruby项目开发环境? [英] How to quickly initialize ruby project development environment?
本文介绍了如何快速初始化ruby项目开发环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以仅安装了ruby,rake和rubygems的用户的方式指定gem依赖项,可以发出单个rake命令来安装所需的所有依赖项?当使用GemBuildTask构建gem时,是否可以使用相同的依赖关系规范?
How to specify gem dependencies in a way that user with only ruby, rake and rubygems installed could issue a single rake command to install all the dependencies required? Is it possible to use the same dependency specification when building gem with GemBuildTask?
推荐答案
设置rake任务实际上非常简单安装了一堆宝石:
It's actually pretty easy to set up a rake task that installs a bunch of gems:
task :install_gems do
require "rubygems"
require "rubygems/dependency_installer"
installer = Gem::DependencyInstaller.new
[["rack"], ["merb-core", "1.0.12"]].each do |args|
installer.install(*args)
end
end
当然,你可以将它提取到一个方法中,并写一个更漂亮的方式来指定你的依赖关系,但这应该很好。
Of course, you could extract this into a method and write a prettier way to specify your dependencies, but this should work great.
这篇关于如何快速初始化ruby项目开发环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文