Sha256: a2be1fc7c267a4a479962935144dfbb864a0d3187d988ef878222053e934c8b8

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

module KnifeSolo
  module KitchenCommand
    def self.required_files
      %w(solo.rb)
    end

    def validate_kitchen!
      unless required_files_present?
        ui.fatal "This command must be run inside a Chef solo kitchen."
        exit 1
      end
    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)
      ui.error "#{file} is a required file/directory"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
knife-solo-0.2.0 lib/knife-solo/kitchen_command.rb
knife-solo-0.2.0.pre1 lib/knife-solo/kitchen_command.rb
knife-solo-0.1.0 lib/knife-solo/kitchen_command.rb
knife-solo-0.1.0.pre1 lib/knife-solo/kitchen_command.rb