Class: Puppetfiler::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/puppetfiler/cli.rb

Instance Method Summary collapse

Instance Method Details

#check(puppetfile = 'Puppetfile') ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/puppetfiler/cli.rb', line 9

def check(puppetfile = 'Puppetfile')
    pf = Puppetfiler::Puppetfile.new(puppetfile)
    format = "% -#{pf.maxlen_name}s  % -#{pf.maxlen_ver}s  %s"

    puts sprintf(format, 'module', 'current', 'newest')

    pf.updates.each do |name, hash|
        puts sprintf(format, name, hash[:current], hash[:newest])
    end
end

#fixture(puppetfile = 'Puppetfile') ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/puppetfiler/cli.rb', line 22

def fixture(puppetfile = 'Puppetfile')
    f = Puppetfiler::Puppetfile.new(puppetfile).fixture.to_yaml

    if options[:stdout]
        puts f
    else
        File.write('.fixtures.yml', f)
    end
end

#versionObject



33
34
35
# File 'lib/puppetfiler/cli.rb', line 33

def version
    puts "puppetfiler v#{Puppetfiler::VERSION}"
end