Module: MM::Copyrights

Defined in:
lib/mmcopyrights.rb

Defined Under Namespace

Classes: SourceFile

Constant Summary collapse

ENDL =
$/

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.verboseObject

Returns the value of attribute verbose.



8
9
10
# File 'lib/mmcopyrights.rb', line 8

def verbose
  @verbose
end

Class Method Details

.process(dir, ext, prefix, copyright) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mmcopyrights.rb', line 60

def self.process(dir, ext, prefix, copyright)
  Dir.glob(File.join(dir, "**", "*.#{ext}")).each do |filename|
    source_file = SourceFile.new(filename, prefix)
    if source_file.has_copyright?
      if source_file.copyright != copyright
        say "updated copyright: #{filename}"
        source_file.remove_copyright
        source_file.add_copyright(copyright)
        source_file.save!
      else
        say "already has valid copyright: #{filename}"
      end
    else
      say "missing copyright: #{filename}"
      source_file.add_copyright(copyright)
     	source_file.save!
    end
  end
end