2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2013-11-10 12:51:40 -05:00
|
|
|
##
|
2013-11-18 19:34:13 -05:00
|
|
|
# A GitSpecification represents a gem that is sourced from a git repository
|
|
|
|
# and is being loaded through a gem dependencies file through the +git:+
|
2013-11-10 12:51:40 -05:00
|
|
|
# option.
|
2013-10-17 21:57:00 -04:00
|
|
|
|
2013-11-18 19:34:13 -05:00
|
|
|
class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
|
2013-10-17 21:57:00 -04:00
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def ==(other) # :nodoc:
|
2013-10-17 21:57:00 -04:00
|
|
|
self.class === other and
|
|
|
|
@set == other.set and
|
2013-11-10 12:51:40 -05:00
|
|
|
@spec == other.spec and
|
|
|
|
@source == other.source
|
2013-10-17 21:57:00 -04:00
|
|
|
end
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def add_dependency(dependency) # :nodoc:
|
2014-09-13 23:30:02 -04:00
|
|
|
spec.dependencies << dependency
|
|
|
|
end
|
|
|
|
|
2013-11-25 14:14:49 -05:00
|
|
|
##
|
|
|
|
# Installing a git gem only involves building the extensions and generating
|
|
|
|
# the executables.
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def install(options = {})
|
2013-11-25 14:14:49 -05:00
|
|
|
require 'rubygems/installer'
|
|
|
|
|
2015-07-01 17:50:14 -04:00
|
|
|
installer = Gem::Installer.for_spec spec, options
|
2013-11-25 14:14:49 -05:00
|
|
|
|
|
|
|
yield installer if block_given?
|
|
|
|
|
|
|
|
installer.run_pre_install_hooks
|
|
|
|
installer.build_extensions
|
|
|
|
installer.run_post_build_hooks
|
|
|
|
installer.generate_bin
|
|
|
|
installer.run_post_install_hooks
|
|
|
|
end
|
|
|
|
|
2018-11-21 05:20:47 -05:00
|
|
|
def pretty_print(q) # :nodoc:
|
2014-09-13 23:30:02 -04:00
|
|
|
q.group 2, '[GitSpecification', ']' do
|
|
|
|
q.breakable
|
|
|
|
q.text "name: #{name}"
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "version: #{version}"
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text 'dependencies:'
|
|
|
|
q.breakable
|
|
|
|
q.pp dependencies
|
|
|
|
|
|
|
|
q.breakable
|
|
|
|
q.text "source:"
|
|
|
|
q.breakable
|
|
|
|
q.pp @source
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-17 21:57:00 -04:00
|
|
|
end
|