Class: Uttk::Strategies::Authors

Inherits:
Strategy show all
Includes:
Concrete
Defined in:
lib/uttk/strategies/Authors.rb

Overview

I check whether a student has well written his AUTHORS file. I’m very specific to the test of Epita’s student tarballs.

Instance Attribute Summary

Attributes inherited from Strategy

#status

Instance Method Summary collapse

Methods inherited from Strategy

#abort, #assign, #clean_instance_variables, #display_unexpected_exc, #display_unexpected_synflow_exc, #fail, #initialize, #initialize_flow_factory, #name=, #pass, #raise_error, #reject, #run, #running?, #skip, #skip_if_cached, #skip_wrt_rpath_and_rpath_exclude, #strategy, #strategy=, #symbols=, #symtbl, #symtbl=, #testify, #timeout=, to_form, #to_s, to_yaml_type, #wclass=

Constructor Details

This class inherits a constructor from Uttk::Strategies::Strategy

Instance Method Details

#run_implObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/uttk/strategies/Authors.rb', line 16

def run_impl
  author = "#{@dir}/#{@file}"

  unless File.exists?(author)
    fail "No '#{author}' file found"
  end

  authors = []
  IO.foreach(author) do |line|
    authors << $1 if line =~ /^\* ([-a-z]{1,6}_[-_a-zA-Z\d]).*$/
    end

  unless authors.include?(@author)
    fail "AUTHORS not well formatted"
  end

  pass
end