method
util_spec
v2_2_9 -
Show latest stable
- Class:
Gem::TestCase
util_spec(name, version = 2, deps = nil)public
Creates a spec with name, version. deps can specify the dependency or a block can be given for full customization of the specification.
# File lib/rubygems/test_case.rb, line 772
def util_spec name, version = 2, deps = nil # :yields: specification
raise "deps or block, not both" if deps and block_given?
spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = name
s.version = version
s.author = 'A User'
s.email = '[email protected]'
s.homepage = 'http://example.com'
s.summary = "this is a summary"
s.description = "This is a test description"
yield s if block_given?
end
if deps then
# Since Hash#each is unordered in 1.8, sort the keys and iterate that
# way so the tests are deterministic on all implementations.
deps.keys.sort.each do |n|
spec.add_dependency n, (deps[n] || '>= 0')
end
end
spec.loaded_from = spec.spec_file
Gem::Specification.add_spec spec
return spec
end Related methods
- Instance methods
- add_to_fetcher
- all_spec_names
- assert_activate
- assert_contains_make_command
- assert_path_exists
- build_rake_in
- common_installer_setup
- common_installer_teardown
- create_tmpdir
- dep
- dependency_request
- enable_shared
- git_gem
- have_git?
- in_path?
- install_default_gems
- install_default_specs
- install_gem
- install_gem_user
- install_specs
- loaded_spec_names
- make_command
- mu_pp
- new_default_spec
- new_spec
- nmake_found?
- parse_make_command_line
- process_based_port
- quick_gem
- quick_spec
- read_binary
- read_cache
- refute_path_exists
- req
- save_loaded_features
- scan_make_command_lines
- setup
- spec
- spec_fetcher
- teardown
- uninstall_gem
- unresolved_names
- util_build_gem
- util_clear_gems
- util_gem
- util_gzip
- util_make_gems
- util_remove_gem
- util_restore_RUBY_VERSION
- util_set_RUBY_VERSION
- util_set_arch
- util_setup_fake_fetcher
- util_setup_spec_fetcher
- util_spec
- util_zip
- v
- vc_windows?
- vendor_gem
- wait_for_child_process_to_exit
- win_platform?
- write_file
- Class methods
- cert_path
- key_path
- load_cert
- load_key
- make_command
- process_based_port
- rubybin
- vc_windows?
- win_platform?