Module: Aws::Cfn::Dsl::Maintainer

Included in:
Base
Defined in:
lib/aws/cfn/dsl/mixins/maintainer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



35
36
37
# File 'lib/aws/cfn/dsl/mixins/maintainer.rb', line 35

def self.included(includer)

end

Instance Method Details

#i_am_maintainer(file) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/aws/cfn/dsl/mixins/maintainer.rb', line 22

def i_am_maintainer(file)
  # mod = module_name 2
  if File.exists?(file)
    src = IO.read(file)
    mtc = src.match(%r'#{maintainer 2}')
    iam = (not mtc.nil? or src.match(%r'#\s*maintainer:').nil?)
    ovr = @config[:overwrite]
    iam or ovr
  else
    true
  end
end

#maintainer(parts = -1)) ⇒ Object



6
7
8
# File 'lib/aws/cfn/dsl/mixins/maintainer.rb', line 6

def maintainer(parts=-1)
  "maintainer: #{module_name parts}"
end

#maintainer_comment(indent = ' ') ⇒ Object



10
11
12
13
14
15
16
# File 'lib/aws/cfn/dsl/mixins/maintainer.rb', line 10

def maintainer_comment(indent='  ')
  "#{indent}# WARNING: This code is generated. Your changes may be overwritten!\n" +
      "#{indent}# Remove this message and/or set the 'maintainer: <author name>' when you need your changes to survive.\n" +
      "#{indent}# Abscence of the 'maintainer: ' will be considered conscent to overwrite.\n" +
      "#{indent}# #{maintainer 3}\n" +
      "#\n"
end


18
19
20
# File 'lib/aws/cfn/dsl/mixins/maintainer.rb', line 18

def print_maintainer(indent='  ')
  writeln maintainer_comment(indent)
end