method
git_gem
v2_1_10 -
Show latest stable
- Class:
Gem::TestCase
git_gem(name = 'a', version = 1)public
A git_gem is used with a gem dependencies file. The gem created here has no files, just a gem specification for the given name and version.
Yields the specification to the block, if given
# File lib/rubygems/test_case.rb, line 411
def git_gem name = 'a', version = 1
have_git?
directory = File.join 'git', name
directory = File.expand_path directory
git_spec = Gem::Specification.new name, version do |specification|
yield specification if block_given?
end
FileUtils.mkdir_p directory
gemspec = "#{name}.gemspec"
open File.join(directory, gemspec), 'w' do |io|
io.write git_spec.to_ruby
end
head = nil
Dir.chdir directory do
unless File.exist? '.git' then
system @git, 'init', '--quiet'
system @git, 'config', 'user.name', 'RubyGems Tests'
system @git, 'config', 'user.email', 'rubygems@example'
end
system @git, 'add', gemspec
system @git, 'commit', '-a', '-m', 'a non-empty commit message', '--quiet'
head = Gem::Util.popen('git', 'rev-parse', 'master').strip
end
return name, git_spec.version, directory, head
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_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?