Sha256: c3c5408cbe5c5012b0b74837980af94d3d663df368109afb606b892d269f085e
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
require 'knife-solo/knife_solo_error' module KnifeSolo module KitchenCommand class OutOfKitchenError < KnifeSoloError def message "This command must be run inside a Chef solo kitchen." end end def self.required_files %w(solo.rb) end def run raise OutOfKitchenError.new unless required_files_present? end def required_files_present? KitchenCommand.required_files.inject(true) do |m, f| check = File.exists?(f) warn_for_required_file(f) unless check m && check end end def warn_for_required_file(file) Chef::Log.warn "#{file} is a required file/directory" end def first_cli_arg_is_a_hostname? @name_args.first =~ /\A([^@]+(?>@)[^@]+|[^@]+?(?!@))\z/ end def validate_first_cli_arg_is_a_hostname!(error_class) unless first_cli_arg_is_a_hostname? ui.msg opt_parser.help raise error_class.new "need to pass atleast a [user@]hostname as the first argument" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knife-solo-0.0.14 | lib/knife-solo/kitchen_command.rb |