From a327a0544bb725c668b7bca5bf6618c40a9c9cd2 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 22 May 2014 00:01:04 -0700 Subject: added 'try {}' macro. --- lib/leap_cli/config/macros.rb | 11 +++++++++++ lib/leap_cli/version.rb | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/leap_cli/config/macros.rb b/lib/leap_cli/config/macros.rb index 2eabdd0..30381ee 100644 --- a/lib/leap_cli/config/macros.rb +++ b/lib/leap_cli/config/macros.rb @@ -415,5 +415,16 @@ module LeapCli; module Config end end + # + # wrap something that might fail in `try`. e.g. + # + # "= try{ nodes[:services => 'tor'].first.ip_address } " + # + def try(&block) + yield + rescue NoMethodError + nil + end + end end; end diff --git a/lib/leap_cli/version.rb b/lib/leap_cli/version.rb index 7c39e05..5ec2523 100644 --- a/lib/leap_cli/version.rb +++ b/lib/leap_cli/version.rb @@ -1,6 +1,6 @@ module LeapCli unless defined?(LeapCli::VERSION) - VERSION = '1.5.4' + VERSION = '1.5.5' COMPATIBLE_PLATFORM_VERSION = '0.5.2'..'1.99' SUMMARY = 'Command line interface to the LEAP platform' DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.' -- cgit v1.2.3