diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/bootstrap.rb | 4 | ||||
-rw-r--r-- | lib/leap_cli/core_ext/hash.rb | 19 | ||||
-rw-r--r-- | lib/leap_cli/leapfile.rb | 5 | ||||
-rw-r--r-- | lib/leap_cli/log.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/path.rb | 2 |
5 files changed, 24 insertions, 8 deletions
diff --git a/lib/leap_cli/bootstrap.rb b/lib/leap_cli/bootstrap.rb index f33aa42..75edf5b 100644 --- a/lib/leap_cli/bootstrap.rb +++ b/lib/leap_cli/bootstrap.rb @@ -159,7 +159,9 @@ module LeapCli # Yes, hacky. # def leapfile_optional?(argv) - if argv.include?('--version') + if TEST + return true + elsif argv.include?('--version') return true else without_flags = argv.select {|i| i !~ /^-/} diff --git a/lib/leap_cli/core_ext/hash.rb b/lib/leap_cli/core_ext/hash.rb index 7df33b2..4eb3af3 100644 --- a/lib/leap_cli/core_ext/hash.rb +++ b/lib/leap_cli/core_ext/hash.rb @@ -32,4 +32,23 @@ class Hash replace(deep_merge(other_hash)) end + # + # A recursive symbolize_keys + # + unless Hash.method_defined?(:symbolize_keys) + def symbolize_keys + self.inject({}) {|result, (key, value)| + new_key = case key + when String then key.to_sym + else key + end + new_value = case value + when Hash then symbolize_keys(value) + else value + end + result[new_key] = new_value + result + } + end + end end diff --git a/lib/leap_cli/leapfile.rb b/lib/leap_cli/leapfile.rb index 3dadf66..0b56b71 100644 --- a/lib/leap_cli/leapfile.rb +++ b/lib/leap_cli/leapfile.rb @@ -150,11 +150,6 @@ module LeapCli return search_dir end - # to be overridden - def validate - return true - end - def method_missing(method, *args) if method =~ /=$/ self.instance_variable_set('@' + method.to_s.sub('=',''), args.first) diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb index 203d92e..01d372c 100644 --- a/lib/leap_cli/log.rb +++ b/lib/leap_cli/log.rb @@ -89,7 +89,7 @@ module LeapCli if title title = title.to_s end - unless message && @log_level >= level + if @log_level < level || (title.nil? && message.nil?) return end diff --git a/lib/leap_cli/path.rb b/lib/leap_cli/path.rb index 11fc0f1..a78dbd2 100644 --- a/lib/leap_cli/path.rb +++ b/lib/leap_cli/path.rb @@ -3,7 +3,7 @@ require 'fileutils' module LeapCli; module Path def self.platform - @platform + @platform ||= nil end def self.provider_base |