Class: Taglob::Rake::CheckTagsTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/taglob/rake/check_tags_task.rb

Overview

end

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :check_tags) {|_self| ... } ⇒ CheckTagsTask

Returns a new instance of CheckTagsTask.

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
24
# File 'lib/taglob/rake/check_tags_task.rb', line 20

def initialize(name = :check_tags)
  @name = name
  yield self if block_given?
  define
end

Instance Attribute Details

#patternObject

Returns the value of attribute pattern.



17
18
19
# File 'lib/taglob/rake/check_tags_task.rb', line 17

def pattern
  @pattern
end

#valid_tag_sourceObject

Returns the value of attribute valid_tag_source.



18
19
20
# File 'lib/taglob/rake/check_tags_task.rb', line 18

def valid_tag_source
  @valid_tag_source
end

Instance Method Details

#defineObject



26
27
28
29
30
31
32
# File 'lib/taglob/rake/check_tags_task.rb', line 26

def define
  task @name do
    invalid_tags = Taglob.invalid_tags(pattern,valid_tag_list)
    invalid_tags.each {|file,tags| $stderr.puts "Invalid tags: #{tags.join(',')} found in #{file}." }
    exit 1 if !invalid_tags.empty?
  end
end

#valid_tag_listObject



34
35
36
# File 'lib/taglob/rake/check_tags_task.rb', line 34

def valid_tag_list
  var = File.readlines(valid_tag_source).collect {|line| line.chomp }
end