class Monolith::Command

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/monolith/commands.rb, line 32
def initialize(*args)
  super(*args)

  Monolith.formatter.quiet = @options[:quiet]
  Monolith.formatter.debug = @options[:debug]
end

Public Instance Methods

clean(path = File.join(Dir.pwd, "cookbooks")) click to toggle source
# File lib/monolith/commands.rb, line 63
def clean(path = File.join(Dir.pwd, "cookbooks"))
  berksfile = Monolith::Berksfile.new(options.dup)
  # This is counter-intuitive given we're actually getting rid of the
  # cookbooks. This performs the dependency resolution needed to work out
  # what we need to remove.
  berksfile.install
  gitpath = File.expand_path('../.git', berksfile.berksfile.filepath)
  gitexclude = GitExclude.new(gitpath, options)
  berksfile.cookbooks(path) do |cookbook, dep, destination|
    changed = berksfile.monolith_action(:clean, cookbook, dep, destination)
    gitexclude.remove(destination) if changed
  end
  gitexclude.update
end
install(path = File.join(Dir.pwd, "cookbooks")) click to toggle source
# File lib/monolith/commands.rb, line 40
def install(path = File.join(Dir.pwd, "cookbooks"))
  berksfile = Monolith::Berksfile.new(options.dup)
  berksfile.install # We need to run berks install first
  gitpath = File.expand_path('../.git', berksfile.berksfile.filepath)
  gitexclude = GitExclude.new(gitpath, options)
  berksfile.cookbooks(path) do |cookbook, dep, destination|
    changed = berksfile.monolith_action(:install, cookbook, dep, destination)

    gitexclude.add(destination) if changed
  end
  gitexclude.update
end
update(path = File.join(Dir.pwd, "cookbooks")) click to toggle source
# File lib/monolith/commands.rb, line 54
def update(path = File.join(Dir.pwd, "cookbooks"))
  berksfile = Monolith::Berksfile.new(options.dup)
  berksfile.install # We need to run berks install first
  berksfile.cookbooks(path) do |cookbook, dep, destination|
    berksfile.monolith_action(:update, cookbook, dep, destination)
  end
end
version() click to toggle source
# File lib/monolith/commands.rb, line 79
def version
  puts Monolith::VERSION
end