Skip to content

Commit

Permalink
Cleanup the Uncompiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrous26 committed May 15, 2011
1 parent a9dd886 commit dc649dd
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions lib/rubygems-compile/uncompiler.rb
Expand Up @@ -2,8 +2,7 @@ class Gem::Uncompiler
include Gem::UserInteraction

def initialize
@current_directory = []
@config = Gem.configuration
@config = Gem.configuration
end

def uncompile gem
Expand All @@ -12,9 +11,9 @@ def uncompile gem
say uncompilation_message if @config.verbose

gem_files.each do |file|
say uncompile_file_msg(file) if @config.really_verbose
say "\tAsploded #{file}" if @config.really_verbose
absolute_file_path = File.join(@spec.full_gem_path, file)
FileUtils.rm file
FileUtils.rm absolute_file_path
end
end

Expand All @@ -24,22 +23,9 @@ def uncompilation_message
end

def gem_files
@spec.files.select { |file| File.extname(file) == '.rbo' }
end

def uncompile_file_msg file
name = File.basename(file)
dirs = file.chomp(name).split(File::SEPARATOR)
tabs = "\t" * dirs.count

dirs.each_with_index do |dir, index|
unless @current_directory[index] == dir
@current_directory[index] = dir
say( "\t" * (index + 1) + dir + File::SEPARATOR)
end
Dir.glob(File.join(@spec.full_gem_path, '**','*.rbo')).map do |file|
file.sub /#{@spec.full_gem_path}\//, ''
end

"Removing #{tabs}#{name}"
end

end

0 comments on commit dc649dd

Please sign in to comment.