本文簡要介紹ruby語言中 Gem::Specification類
的用法。
Specification
類包含 gems 的信息。通常在 .gemspec 文件或 Rakefile 中定義,如下所示:
Gem::Specification.new do |s|
s.name = 'example'
s.version = '0.1.0'
s.licenses = ['MIT']
s.summary = "This is an example!"
s.description = "Much longer explanation of the example!"
s.authors = ["Ruby Coder"]
s.email = 'rubycoder@example.com'
s.files = ["lib/example.rb"]
s.homepage = 'https://rubygems.org/gems/example'
s.metadata = { "source_code_uri" => "https://github.com/example/example" }
end
從RubyGems 2.0 開始, Specification
可以保存任意元數據。有關可以添加到規範中的元數據項的格式和大小限製,請參閱 metadata
。
相關用法
- Ruby SpecificationProvider.requirement_satisfied_by?用法及代碼示例
- Ruby Specification.file_name用法及代碼示例
- Ruby Specification.extra_rdoc_files用法及代碼示例
- Ruby Specification.platform=用法及代碼示例
- Ruby Specification.license=用法及代碼示例
- Ruby Specification.extensions用法及代碼示例
- Ruby Specification.name用法及代碼示例
- Ruby Specification.homepage用法及代碼示例
- Ruby SpecificationProvider.dependencies_equal?用法及代碼示例
- Ruby Specification.requirements用法及代碼示例
- Ruby Specification.executables用法及代碼示例
- Ruby Specification.dependent_gems用法及代碼示例
- Ruby Specification.authors=用法及代碼示例
- Ruby SpecificationProvider.name_for_explicit_dependency_source用法及代碼示例
- Ruby Specification.description用法及代碼示例
- Ruby Specification.rdoc_options用法及代碼示例
- Ruby Specification.add_development_dependency用法及代碼示例
- Ruby Specification.required_ruby_version用法及代碼示例
- Ruby Specification.authors用法及代碼示例
- Ruby Specification.author=用法及代碼示例
- Ruby Specification.email用法及代碼示例
- Ruby Specification.metadata用法及代碼示例
- Ruby Specification.spec_name用法及代碼示例
- Ruby Specification.require_paths=用法及代碼示例
- Ruby Specification.licenses=用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Specification類。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。