class ItamaeMitsurin::Mitsurin::CLI

Constants

CREATE_TARGETS

Public Instance Methods

create(target, layer, name) click to toggle source
# File lib/itamae-mitsurin/mitsurin/cli.rb, line 26
def create(target, layer, name)
  name = layer + '/' + name
  validate_create_target!('create', target)

  creator = Creators.find(target).new
  creator.destination_root = File.join("site-cookbooks", name)
  creator.copy_files
end
destroy(target, layer, name) click to toggle source
# File lib/itamae-mitsurin/mitsurin/cli.rb, line 37
def destroy(target, layer, name)
  name = layer + '/' + name
  validate_create_target!('destroy', target)

  creator = Creators.find(target).new
  creator.destination_root = File.join("site-cookbooks", name)
  creator.remove_files
end
init() click to toggle source
# File lib/itamae-mitsurin/mitsurin/cli.rb, line 18
def init
  creator = Creators::Project.new
  creator.destination_root
  creator.invoke_all
end
version() click to toggle source
# File lib/itamae-mitsurin/mitsurin/cli.rb, line 13
def version
  puts "manaita(itamae-mitsurin) v#{ItamaeMitsurin::VERSION}"
end

Private Instance Methods

validate_create_target!(command, target) click to toggle source
# File lib/itamae-mitsurin/mitsurin/cli.rb, line 47
def validate_create_target!(command, target)
  unless CREATE_TARGETS.include?(target)
    msg = %Q!ERROR: "manaita #{command}" was called with "#{target}" !
    msg << "but expected to be in #{CREATE_TARGETS.inspect}"
    fail InvocationError, msg
  end
end