install.rb文件的细分,请帮我理解一下

时间:2010-10-01 02:16:57

标签: ruby-on-rails ruby

我正在查看RoR开源项目的install.rb文件:

version = ARGV.pop

%w( core api auth dash promotions sample ).each do |framework|
  puts "Installing #{framework}..."
  `cd #{framework} && gem build spree_#{framework}.gemspec && gem install spree_#{framework}-#{version}.gem --no-ri --no-rdoc && rm spree_#{framework}-#{version}.gem`
end

puts "Installing Spree..."
`gem build spree.gemspec`
`gem install spree-#{version}.gem --no-ri --no-rdoc `
`rm spree-#{version}.gem

我现在感兴趣的是:

gem build spree_core.gemspec&& gem install spree_core-xxxx.gem

core.gemspec看起来像:

version = File.read(File.expand_path("../../SPREE_VERSION", __FILE__)).strip

Gem::Specification.new do |s|
  s.platform    = Gem::Platform::RUBY
  s.name        = 'spree_core'
  s.version     = version
  s.summary     = 'Core e-commerce functionality for the Spree project.'
  s.description = 'Required dependancy for Spree'

  s.required_ruby_version = '>= 1.8.7'
  s.author      = 'Sean Schofield'
  s.email       = 'sean@railsdog.com'
  s.homepage    = 'http://spreecommerce.com'
  s.rubyforge_project = 'spree_core'

  s.files        = Dir['LICENSE', 'README.md', 'app/**/*', 'config/**/*', 'lib/**/*']
  s.require_path = 'lib'
  s.requirements << 'none'

  s.add_dependency('acts_as_list', '>= 0.1.2')
  s.add_dependency('rd_awesome_nested_set', '>= 1.4.4')
  s.add_dependency('rd_unobtrusive_date_picker', '>= 0.1.0')

  s.add_dependency('highline', '>= 1.5.1')
  #s.add_dependency('less', '>= 1.2.20')
  s.add_dependency('stringex', '>= 1.0.3')
  s.add_dependency('state_machine', '>= 0.9.4')
  s.add_dependency('faker', '>= 0.3.1')
  s.add_dependency('paperclip', '>= 2.3.1.1')
  s.add_dependency('rd_resource_controller')
  s.add_dependency('rd_searchlogic', '>= 3.0.0.rc3')
  s.add_dependency('activemerchant', '>= 1.7.1')
  s.add_dependency('will_paginate', '>= 3.0.pre')
end

这是做什么的? 它似乎生成一个文件b / c有一个调用rm。

2 个答案:

答案 0 :(得分:1)

使用

安装gem后
gem install 

命令您不再需要.gem文件。这只是一个遗留问题,因为包的所有内容都已放在文件系统中。没有必要保留它,以便删除.gem文件;它完成了它的工作,在一个文件包中获取所有文件

答案 1 :(得分:0)

它会生成一个gem文件,安装它并在之后将其删除吗?