From 06537e0ab1efe4bf5b711ca985bc793247d11d23 Mon Sep 17 00:00:00 2001 From: Brandon Turner Date: Tue, 8 Jan 2013 22:57:46 -0600 Subject: [PATCH] Remove the gemcache loader and tools --- lib/msf/env/gemcache.rb | 58 ------------------------------------- tools/dev/clean_gemcache.rb | 16 ---------- 2 files changed, 74 deletions(-) delete mode 100644 lib/msf/env/gemcache.rb delete mode 100755 tools/dev/clean_gemcache.rb diff --git a/lib/msf/env/gemcache.rb b/lib/msf/env/gemcache.rb deleted file mode 100644 index dfb60b7135..0000000000 --- a/lib/msf/env/gemcache.rb +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: binary -*- -# -# This handles gem requirements for bundled installer environments -# - -module Msf -module Env -class Gemcache - - @@msfbase = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', '..')) - @@gembase = ::File.join(@@msfbase, "lib/gemcache") - @@gemarch = ( RUBY_PLATFORM =~ /mingw/ ? 'win32' : ( RUBY_PLATFORM =~ /x86_64.*linux/ ? 'linux64' : (RUBY_PLATFORM =~ /i\d86.*linux/ ? 'linux32' : 'unknown') ) ) - @@rubvers = '1.9.1' - @@gempath = "#{@@gembase}/ruby/#{@@rubvers}" - - def self.configure - return if not ::File.exist?(@@gembase) - - # The gemcache directory is a modified version of the output created by - # $ bundle install --path=lib/gemcache from within the Pro environment - - ENV['GEM_PATH'] = ENV['GEM_PATH'] ? "#{ENV['GEM_PATH']}:#{@@gempath}" : "#{@@gempath}" - ::Dir["#{@@gempath}/gems/*/lib"].each { |lib| $:.unshift(lib) } - - if ENV['MSF_BUNDLE_BINARY_GEMS'].to_s.downcase =~ /^[yt1]/ - ::Dir["#{@@gempath}/arch/#{@@gemarch}/*/lib"].each { |lib| $:.unshift(lib) } - end - - # Handle a specific corner case where SVN was used to update, but the installer is generation-1 - # This will provide updated binary gems for older installation environments, which is required - # for framework-trunk to continue working after the ActiveRecord 3 upgrade. - - if ::File.exists?( File.join( File.dirname(__FILE__), "..", "..", "..", "..", "properties.ini") ) and # Installer - ::File.directory?( File.join( File.dirname(__FILE__), "..", "..", "..", "..", "apps", "pro") ) and # Confirmed - ::File.exists?( File.join( File.dirname(__FILE__), "..", "..", "..", "..", "apps", "pro", "ui", "script", "console") ) # Rails2 artifact - # Load the arch-old gem directories before the system paths to get an updated pg gem - ::Dir["#{@@gempath}/arch-old/#{@@gemarch}/*/lib"].each { |lib| $:.unshift(lib) } - - # Patch up the gem command to always return true for certain gems - ::Object.class_eval %q| - def gem(*args) - - return true if [ - 'pg' # Bypass a gem() version call in ActiveRecord - ].include?(args[0]) - - super(*args) - end - | - end - end - -end -end -end - - -Msf::Env::Gemcache.configure diff --git a/tools/dev/clean_gemcache.rb b/tools/dev/clean_gemcache.rb deleted file mode 100755 index 52a2c02d28..0000000000 --- a/tools/dev/clean_gemcache.rb +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env ruby - -require 'fileutils' - -base = ::File.expand_path(::File.join(::File.dirname(__FILE__), "..", "..", "lib", "gemcache")) -Dir.glob("#{base}/**/cache/*.gem").each do |gem| - ::FileUtils.rm_rf(gem) -end - -Dir.glob("#{base}/**/*.o").each do |obj| - ::FileUtils.rm_rf(obj) -end - -Dir.glob("#{base}/**/ext/*.so").each do |obj| - ::FileUtils.rm_rf(obj) -end