lib/quality/quality_checker.rb in quality-6.0.0 vs lib/quality/quality_checker.rb in quality-7.0.0
- old
+ new
@@ -1,7 +1,8 @@
require_relative 'command_output_processor'
require_relative 'process_runner'
+require_relative 'ruby_spawn'
# XXX: Should add *.gemspec to glob
module Quality
# Runs a quality-checking, command, checks it agaist the existing
# number of violations for that command, and decreases that number
@@ -12,13 +13,17 @@
count_io: IO,
command_output_processor_class:
Quality::CommandOutputProcessor,
count_dir: Dir,
process_runner_class: ProcessRunner)
- @count_file, @count_io, @command_output_processor_class, @count_dir =
- count_file, count_io, command_output_processor_class, count_dir
- @cmd, @command_options, @verbose = cmd, command_options, verbose
+ @count_file = count_file
+ @count_io = count_io
+ @command_output_processor_class = command_output_processor_class
+ @count_dir = count_dir
+ @cmd = cmd
+ @command_options = command_options
+ @verbose = verbose
@count_dir.mkdir(output_dir) unless @count_file.exists?(output_dir)
@filename = File.join(output_dir, "#{cmd}_high_water_mark")
@process_runner_class = process_runner_class
end
@@ -87,24 +92,10 @@
def full_cmd
args = @command_options[:args]
args ||= ''
@found_output = false
- if args.size > 0
- "#{cmd_with_ruby_hack_prefix} #{args}"
- else
- "#{cmd_with_ruby_hack_prefix}"
- end
- end
-
- def cmd_with_ruby_hack_prefix
- if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'jruby')
- "jruby -S #{@cmd}"
- elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
- "#{@cmd}.bat"
- else
- @cmd
- end
+ RubySpawn.new(@cmd, args).invocation
end
def write_violations(new_violations)
@count_file.open(@filename, 'w') do |file|
file.write(new_violations.to_s + "\n")