Class: Taeval::Plagium::Runner
- Inherits:
-
Object
- Object
- Taeval::Plagium::Runner
- Defined in:
- lib/taeval/plagium/runner.rb
Instance Method Summary collapse
-
#initialize(config, output, reporter) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(config, output, reporter) ⇒ Runner
Returns a new instance of Runner.
9 10 11 12 13 |
# File 'lib/taeval/plagium/runner.rb', line 9 def initialize(config, output, reporter) @config = Config.new(config) @output = output @reporter = reporter end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/taeval/plagium/runner.rb', line 15 def run moss = MossRuby.new(@config.id) # Set options -- the options will already have these default values moss.[:max_matches] = @config.max_matches moss.[:show_num_matches] = @config.show_num_matches moss.[:comment] = @config.comment moss.[:language] = @config.language @output.print "checking similarity" to_check = MossRuby.empty_file_hash solutions = Dir.glob("#{@config.solutions}/**/*.#{@config.language}") .reject { |file| @config.reject.any? { |pattern| file.include?(pattern) } } solutions.each do |file| MossRuby.add_file(to_check, file) end # Get server to process files url = moss.check(to_check) @output.print "url: #{url}" @config.output.puts(@config.comment) @config.output.puts(url) end |