Permalink
Browse files

Fix a problem with Gem::Analyzer.check

  • Loading branch information...
1 parent c6daaf5 commit 8706b339bbd170aec9ab34c2f58f998428260365 @ferrous26 committed Feb 13, 2012
Showing with 7 additions and 16 deletions.
  1. +0 −10 lib/rubygems-compile/analyzer.rb
  2. +7 −6 lib/rubygems-compile/compiler.rb
@@ -11,16 +11,6 @@ class Gem::Analyzer < Ripper::SexpBuilder
attr_reader :warnings
- ##
- # Check the given string of code for potential issues when compiled.
- # Returns the analyzer instance afterwards.
-
- def self.check code
- @parser ||= Gem::Analyzer.new(code)
- @parser.parse
- @parser
- end
-
def parse
@warnings = []
super
@@ -29,10 +29,10 @@ def compile gem
gem_files.each do |file|
message = compile_file_message(file)
full_path = File.join(@spec.full_gem_path, file)
- if unsafe? full_path
- message << "\t\t\tSKIPPED: #{@parser.warnings.join(', ')}"
- else
+ if safe? full_path
MacRuby::Compiler.compile_file full_path
+ else
+ message << "\t\t\tSKIPPED: #{@analyzer.warnings.join(', ')}"
end
say message if really_verbose
end
@@ -42,9 +42,10 @@ def compile gem
# Uses the GemAnalyzer class to determine if a given file might have
# any potential issues when compiled.
- def unsafe? file
- @parser = Gem::Analyzer.check File.read(file)
- !@parser.warnings.empty?
+ def safe? file
+ @analyzer = Gem::Analyzer.new File.read(file)
+ @analyzer.parse
+ @analyzer.warnings.empty?
end
def gem_compilation_message

0 comments on commit 8706b33

Please sign in to comment.