Sha256: 16008521a6a5bd1b3bc752efb26e4696e7d96d4b5535bde6982d243c4f3581cb

Contents?: true

Size: 998 Bytes

Versions: 3

Compression:

Stored size: 998 Bytes

Contents

# Author::    Marco Tessari  <marco.tessari@epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: Authors.rb 567 2005-04-13 08:00:06Z polrop $


module TTK

  module Strategies

    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-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 TTK

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/strategies/Authors.rb
ttk-0.1.579 lib/ttk/strategies/Authors.rb
ttk-0.1.580 lib/ttk/strategies/Authors.rb