Skip to content
Browse files

Pluginize repair

  • Loading branch information...
1 parent cb22316 commit 9cbe235a60f463d140dfd336901a00d47a801462 @josh josh committed
Showing with 0 additions and 120 deletions.
  1. +0 −1 bin/rip-package
  2. +0 −119 bin/rip-package-repair
View
1 bin/rip-package
@@ -24,7 +24,6 @@ commands.grep(/^package-handle-/).each do |handler|
out.split("\n").each do |package_path|
package_path = rip(:'package-repair-permissions', package_path)
package_path = rip(:'package-build', package_path)
- package_path = rip(:'package-repair', package_path)
puts package_path
end
View
119 bin/rip-package-repair
@@ -1,119 +0,0 @@
-#!/usr/bin/env ruby
-# usage: rip-package-repair PACKAGE_PATH
-#
-# Patch package to work around RPS incompatibly
-
-require 'rip/script'
-
-module Patches
- extend self
-
- def patch(package_path)
- File.basename(package_path)[/(.+)-([a-zA-Z0-9]{32})$/]
- name, md5 = $1, $2
-
- method = "patch_#{name.downcase.gsub('-', '_')}".to_sym
-
- if respond_to?(method)
- patched_package_name = "#{name}-#{Rip.md5("#{md5}-patched")}"
- patched_package_path = "#{Rip.packages}/#{patched_package_name}"
-
- synchronize(patched_package_path) do
- if !File.exist?(patched_package_path)
- info "repairing #{name}"
- rip :'package-copy', package_path, patched_package_path
-
- cd(patched_package_path) do
- send(method)
- end
- end
- end
-
- patched_package_path
- else
- package_path
- end
- end
-
- def open(file)
- contents = yield File.read(file)
- File.open(file, 'w') { |f| f.write contents }
- end
-
- def read_version
- File.read('VERSION').chomp
- end
-
- def unrequire_rubygems(source)
- source.sub!(/^(\s*)require 'rubygems'$/, '')
- source.gsub!(/^(\s*)gem .+$/, '')
- source
- end
-
- # aws-s3 bin scripts rely on files outside the load path
- def patch_aws_s3
- Dir['bin/*'].each do |bin|
- rm bin
- end
- end
-
- def patch_capistrano
- open 'lib/capistrano/version.rb' do |file|
- file.sub /CURRENT = .+$/, "CURRENT = '#{read_version}'"
- end
-
- open 'lib/capistrano/ssh.rb' do |file|
- unrequire_rubygems file
- end
- end
-
- # Facets doesn't use the default lib, but lib/core and lib/more
- # Flatten it on install
- def patch_facets
- cp_r Dir.glob('lib/{core,more}/*'), 'lib'
- rm_r Dir.glob('lib/{core,more}')
- end
-
- def patch_kicker
- cp_r Dir.glob('vendor/*'), 'lib'
- end
-
- # Nokogiri's deps.rip for dev deps and installs incompatible deps
- def patch_nokogiri
- rm_rf "deps.rip"
- end
-
- def patch_ruby_debug
- open 'bin/rdebug' do |file|
- unrequire_rubygems file
- end
-
- mv 'cli', 'lib'
-
- mkdir_p 'man/man1'
- cp 'doc/rdebug.1', 'man/man1/rdebug.1'
- end
-
- def patch_ruby_debug_base
- rm 'lib/ChangeLog'
-
- open 'lib/ruby-debug-base.rb' do |file|
- unrequire_rubygems file
- end
- end
-
- # Accesses all sorts of assets outside lib/
- def patch_showoff
- open 'bin/showoff' do |file|
- file = file.sub(/\$LOAD_PATH\.unshift(.+)$/, '')
- unrequire_rubygems file
- end
-
- open 'lib/showoff.rb' do |file|
- file = file.gsub("File.dirname(__FILE__)", "#{Dir.pwd}/lib".inspect)
- unrequire_rubygems file
- end
- end
-end
-
-puts Patches.patch(ARGV[0])

0 comments on commit 9cbe235

Please sign in to comment.
Something went wrong with that request. Please try again.