Class: Librarian::Puppet::Cli

Inherits:
Cli
  • Object
show all
Extended by:
Particularity
Includes:
Particularity
Defined in:
lib/librarian/puppet/cli.rb

Defined Under Namespace

Modules: Particularity

Instance Method Summary collapse

Methods included from Particularity

root_module

Constructor Details

#initializeCli

Returns a new instance of Cli.



10
11
12
13
# File 'lib/librarian/puppet/cli.rb', line 10

def initialize(*)
  super
  say "librarian-puppet-maestrodev gem is now deprecated in favor of librarian-puppet 0.9.11 and is no longer updated"
end

Instance Method Details

#initObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/librarian/puppet/cli.rb', line 26

def init
  copy_file environment.specfile_name

  if File.exists? ".gitignore"
    gitignore = File.read('.gitignore').split("\n")
  else
    gitignore = []
  end

  gitignore << ".tmp/" unless gitignore.include? ".tmp/"
  gitignore << "modules/" unless gitignore.include? "modules/"

  File.open(".gitignore", 'w') do |f|
    f.puts gitignore.join("\n")
  end
end

#installObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/librarian/puppet/cli.rb', line 52

def install

  unless File.exist?('Puppetfile')
    say "Could not find Puppetfile in #{Dir.pwd}", :red
    exit 1
  end

  ensure!
  clean! if options["clean"]
  unless options["destructive"].nil?
    environment.config_db.local['destructive'] = options['destructive'].to_s
  end
  if options.include?("strip-dot-git")
    strip_dot_git_val = options["strip-dot-git"] ? "1" : nil
    environment.config_db.local["install.strip-dot-git"] = strip_dot_git_val
  end
  if options.include?("path")
    environment.config_db.local["path"] = options["path"]
  end

  environment.config_db.local['mode'] = options['local'] ? 'local' : nil

  resolve!
  debug { "Install: dependencies resolved"}
  install!
end

#packageObject



87
88
89
90
# File 'lib/librarian/puppet/cli.rb', line 87

def package
  environment.vendor!
  install
end

#versionObject



92
93
94
# File 'lib/librarian/puppet/cli.rb', line 92

def version
  say "librarian-puppet-maestrodev v#{Librarian::Puppet::VERSION}"
end