简化gem安装

阅读更多
Ruby on Rails项目往往用到大量第三方的gems,在项目有新成员加入,或配置新的开发系统时,一个个的安装是件很繁琐的事情。

我用的办法就是写一个自己的gem,让它依赖于项目里用到的其他gems。这样的话,安装这个gem的时候,就会顺带把其他gems安装了。

代码非常简单:

>cat install-gems.gemspec
#
#Usage:
#gem build install-gems.gemspec
#gem install install-gems.0.0.1.gem
#gem uninstall install-gems (optional, remove this useless gem)
#
spec = Gem::Specification.new do |s|
  s.name = "install-gems"
  s.version = "0.0.1"
  s.author = "yawl"
  s.email = "[email protected]"
  s.homepage = "http://xruby.iteye.com"
  s.platform = Gem::Platform::RUBY
  s.summary = "This gem has no content in itself, it helps to install all the gems we depend on"
  s.add_dependency('actionmailer', '>=2.0.2')
  s.add_dependency('actionpack', '>=2.0.2')
  s.add_dependency('activerecord', '>=2.0.2')
  s.add_dependency('activeresource', '>=2.0.2')
  s.add_dependency('activesupport', '>=2.0.2')
  s.add_dependency('acts_as_ferret', '>=0.4.3')
  s.add_dependency('capistrano', '>=2.1.0')
  s.add_dependency('mysql', '>=2.7')
  s.add_dependency('rails', '>=2.0.2')
  s.add_dependency('rake', '>=0.8.1')
  # add more here
end

你可能感兴趣的:(Rails,capistrano,Ruby,ActiveRecord,MySQL)