Class: Pfu

Inherits:
Object
  • Object
show all
Defined in:
lib/pfu.rb,
lib/pfu/version.rb

Defined Under Namespace

Classes: Generator, Parser

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Pfu

Returns a new instance of Pfu.



6
7
8
9
# File 'lib/pfu.rb', line 6

def initialize(options)
  @filenames = options[:filenames]
  @namespace = options[:namespace]
end

Instance Method Details

#refactor!Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pfu.rb', line 11

def refactor!
  @filenames.each do |path|
    data = Pfu::Parser.parse(path)
    data[:namespace] = @namespace
    Pfu::Generator.write(data)
  end

  $logger.info "Functions generated. Please inspect for suitability and then"
  $logger.info "update any Puppet code with the new function names."
  $logger.info "See https://puppet.com/docs/puppet/latest/custom_functions_ruby.html"
  $logger.info "for more information about Puppet's modern Ruby function API."
end