Skip to content

Commit

Permalink
for #438 can install native gems with cobbler and Shoes.setup {}
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecil committed Apr 25, 2019
1 parent 304c525 commit 2764631
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
28 changes: 6 additions & 22 deletions lib/shoes/cobbler.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
# Cobbler - various Shoes maintenance things
# CJC: the gem handling is kind of ugly. Someone should make it pretty.
# TODO: the gem handling is kind of ugly. Someone should make it pretty, if possible.
require 'rubygems'
require 'rubygems/dependency_installer'
require 'rubygems/uninstaller'
require 'rubygems/package'

module Gem
if Shoes::RELEASE_TYPE =~ /TIGHT/
@ruby = (File.join(RbConfig::CONFIG['bindir'], 'shoes') + RbConfig::CONFIG['EXEEXT']).
sub(/.*\s.*/m, '"\&"') + " --ruby"
end
end
class << Gem::Ext::ExtConfBuilder
alias_method :make__, :make
def make(dest_path, results)
raise unless File.exist?('Makefile')
mf = File.read('Makefile')
mf = mf.gsub(/^INSTALL\s*=\s*.*$/, "INSTALL = $(RUBY) -run -e install -- -vp")
mf = mf.gsub(/^INSTALL_PROG\s*=\s*.*$/, "INSTALL_PROG = $(INSTALL) -m 0755")
mf = mf.gsub(/^INSTALL_DATA\s*=\s*.*$/, "INSTALL_DATA = $(INSTALL) -m 0644")
File.open('Makefile', 'wb') {|f| f.print mf}
make__(dest_path, results)
end
end
require 'shoes/setup'

class Gem::CobblerFace
class DownloadReporter #ProgressReporter
Expand Down Expand Up @@ -451,7 +433,7 @@ def gem_install_one spec
# setup Gem download ui
ui = Gem::DefaultUserInteraction.ui = Gem::CobblerFace.new(@progbar, @status)
ui.title "Installing #{spec.name} #{spec.version}"
installer = Gem::DependencyInstaller.new({:nodoc => true, :install_dir => GEM_DIR})
installer = Gem::DependencyInstaller.new({:document => [], :install_dir => GEM_DIR})
begin
#$stderr.puts "gem build setup: #{installer.options}"
installer.install(spec.name, spec.version)
Expand All @@ -478,7 +460,9 @@ def gemremove spec
if confirm "Really delete gem #{spec.name}"
begin
Gem::DefaultUserInteraction.ui = Gem::CobblerDelFace.new()
del = Gem::Uninstaller.new(spec)
# TODO new(gem, options) not new(spec)
del = Gem::Uninstaller.new(spec.name)
#del.uninstall() # deep remove -
del.remove(spec)
rescue Exception => e
alert e
Expand Down
2 changes: 1 addition & 1 deletion lib/shoes/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def start(app)
name, version = arg.split(/\s+/, 2)
count += 1
# need to handle multiple matching gemspecs
installer = Gem::DependencyInstaller.new
installer = Gem::DependencyInstaller.new(:document => [])
poss_gems = installer.find_spec_by_name_and_version(name, version)
#poss_gems.each_spec { |g| puts "#{g.name} #{g.version}"}
this_one = nil
Expand Down

0 comments on commit 2764631

Please sign in to comment.