def generate
      siba_file.run_this do
        file_path = @name.gsub /\.yml$/, ""
        file_path += ".yml"
        file_path = siba_file.file_expand_path file_path
        if siba_file.file_file?(file_path) || siba_file.file_directory?(file_path)
          raise Siba::Error, "Options file already exists: #{file_path}"
        end

        options_data = []
        Siba::Plugins::PLUGINS_HASH.each do |category, types|
          type = nil
          if types.size > 1
            max_type_length = types.keys.max do |a,b|
              a.length <=> b.length
            end.length + 5

            siba_kernel.puts "\nChoose #{category} plugin:"
            types.keys.each_index do |i|
              type = types.keys[i]
              siba_kernel.puts "  #{i+1}. #{Siba::Plugins.plugin_type_and_description(category, type, max_type_length)}"
            end

            type = Siba::Generator.get_plugin_user_choice types.keys
            if type.nil?
              siba_kernel.puts "Cancelled by user"
              return
            end

            unless Siba::InstalledPlugins.installed? category, type
              siba_kernel.puts Siba::InstalledPlugins.install_gem_message(category, type)
              return
            end
          else
            type = types.keys.first
          end

          options = Siba::Generator.load_plugin_yaml_content category, type
          unless options =~ /^\s*type:/
            options = "type: #{type}\n" + options
          end

          options.gsub! /^/, "  "
          options = "#{category}:\n" + options
          options_data << options
        end

        file_data = options_data.join("\n")
        file_data = "# SIBA options file\n" + file_data
        dest_dir = File.dirname file_path
        siba_file.file_utils_mkpath(dest_dir) unless siba_file.file_directory?(dest_dir)
        Siba::FileHelper.write file_path, file_data
        file_path
      end
    end
def generate
      siba_file.run_this do
        file_path = @name.gsub /\.yml$/, ""
        file_path += ".yml"
        file_path = siba_file.file_expand_path file_path
        if siba_file.file_file?(file_path) || siba_file.file_directory?(file_path)
          raise Siba::Error, "Options file already exists: #{file_path}"
        end

        options_data = []
        Siba::Plugins::PLUGINS_HASH.each do |category, types|
          type = nil
          if types.size > 1
            max_type_length = types.keys.max do |a,b|
              a.length <=> b.length
            end.length + 5

            siba_kernel.puts "\nChoose #{category} plugin:"
            types.keys.each_index do |i|
              type = types.keys[i]
              siba_kernel.puts "  #{i+1}. #{Siba::Plugins.plugin_type_and_description(category, type, max_type_length)}"
            end

            type = Siba::Generator.get_plugin_user_choice types.keys
            if type.nil?
              siba_kernel.puts "Cancelled by user"
              return
            end

            unless Siba::InstalledPlugins.installed? category, type
              siba_kernel.puts Siba::InstalledPlugins.install_gem_message(category, type)
              return
            end
          else
            type = types.keys.first
          end

          options = Siba::Generator.load_plugin_yaml_content category, type
          unless options =~ /^\s*type:/
            options = "type: #{type}\n" + options
          end

          options.gsub! /^/, "  "
          options = "#{category}:\n" + options
          options_data << options
        end

        file_data = options_data.join("\n")
        file_data = "# SIBA options file\n" + file_data
        dest_dir = File.dirname file_path
        siba_file.file_utils_mkpath(dest_dir) unless siba_file.file_directory?(dest_dir)
        Siba::FileHelper.write file_path, file_data
        file_path
      end
    end
Generates yaml options file and returns its path