class Rigit::Commands::NewRig::NewRigHandler

Internal class to handle the creation of a new rig template for the {CommandLine} class.

Attributes

args[R]
name[R]

Public Class Methods

new(args) click to toggle source
# File lib/rigit/commands/new_rig.rb, line 18
def initialize(args)
  @args = args
  @name = args['NAME']
end

Public Instance Methods

execute() click to toggle source
# File lib/rigit/commands/new_rig.rb, line 23
def execute
  verify_presence
  Rigit::Rig.create name
  say "Rig template created in !txtgrn!#{rig.path}"
end

Private Instance Methods

rig() click to toggle source
# File lib/rigit/commands/new_rig.rb, line 31
def rig
  @rig ||= Rigit::Rig.new name
end
verify_presence() click to toggle source
# File lib/rigit/commands/new_rig.rb, line 35
def verify_presence
  if rig.exist?
    say "Rig !txtgrn!#{name}!txtrst! already exists, choose a different name"
    raise Rigit::Exit
  end
end