class Rigit::Commands::Install::InstallHandler
Internal class to handle rig installation for the {CommandLine} class.
Attributes
args[R]
repo[R]
rig_name[R]
Public Class Methods
new(args)
click to toggle source
# File lib/rigit/commands/install.rb, line 16 def initialize(args) @args = args @rig_name = args['RIG'] @repo = args['REPO'] end
Public Instance Methods
execute()
click to toggle source
# File lib/rigit/commands/install.rb, line 22 def execute verify_dirs install end
Private Instance Methods
install()
click to toggle source
# File lib/rigit/commands/install.rb, line 29 def install say "Installing !txtgrn!#{repo}" FileUtils.mkdir_p target_path unless Dir.exist? target_path success = Rigit::Git.clone repo, target_path if success say "Rig installed !txtgrn!successfully!txtrst! in !txtgrn!#{target_path}" say "To build a new project with this rig, run this in any empty directory:\n" say " !txtpur!rig build #{rig_name}\n" else # :nocov: say "!txtred!Install failed" # :nocov: end end
rig()
click to toggle source
# File lib/rigit/commands/install.rb, line 46 def rig @rig ||= Rigit::Rig.new rig_name end
target_path()
click to toggle source
# File lib/rigit/commands/install.rb, line 50 def target_path @target_path ||= rig.path end
verify_dirs()
click to toggle source
# File lib/rigit/commands/install.rb, line 54 def verify_dirs if rig.exist? say "Rig !txtgrn!#{rig_name}!txtrst! is already installed" say "In order to update it from the source repository, run:\n" say " !txtpur!rig update #{rig_name}\n" raise Rigit::Exit end end