Sha256: aef50980639a3919d49a84243ceab07004a6a17363cadb82ccff68f5231fea6e

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

# Author::    Marco Tessari  <marco.tessari@epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Authors.rb 24394 2006-07-10T07:38:58.276210Z ertai  $


module Uttk

  module Strategies

    # I check whether a student has well written his _AUTHORS_ file. I'm very
    # specific to the test of Epita's student tarballs.
    class Authors < Strategy
      include Concrete

      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

      attribute :author, 'the author to match', :mandatory
      attribute :dir, 'the directory where the AUTHORS file is located',
                      :mandatory
      attribute :file, 'the name of the AUTHORS file, appended to "dir" path',
                       'AUTHORS'

    end # class Authors

  end # module Strategies

end # module Uttk

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uttk-0.4.6.2 lib/uttk/strategies/Authors.rb
uttk-0.4.5.0 lib/uttk/strategies/Authors.rb
uttk-0.4.6.1 lib/uttk/strategies/Authors.rb