# File lib/hoe.rb, line 508
  def define_spec
    self.spec = Gem::Specification.new do |s|
      dirs = Dir["lib"]

      manifest = read_manifest

      abort [
             "Manifest is missing or couldn't be read.",
             "The Manifest is kind of a big deal.",
             "Maybe you're using a gem packaged by a linux project.",
             "It seems like they enjoy breaking other people's code.",
             ].join "\n" unless manifest

      s.name                 = name
      s.version              = version if version
      s.summary              = summary
      s.email                = email
      s.homepage             = case urls
                               when Hash then
                                 urls["home"] || urls.values.first
                               when Array then
                                 urls.first
                               else
                                 raise "unknown urls format: #{urls.inspect}"
                               end
      s.description          = description
      s.files                = manifest
      s.executables          = s.files.grep(/^bin/) { |f| File.basename(f) }
      s.bindir               = "bin"
      s.require_paths        = dirs unless dirs.empty?
      s.rdoc_options         = ["--main", readme_file]
      s.post_install_message = post_install_message

      missing "Manifest.txt" if s.files.empty?

      case author
      when Array
        s.authors = author
      else
        s.author  = author
      end

      s.extra_rdoc_files += s.files.grep(/\.(txt|rdoc|md)$/)
      s.extra_rdoc_files.reject! { |f| f =~ %r%^(test|spec|vendor|template|data|tmp)/% }
      s.extra_rdoc_files += @extra_rdoc_files
    end

    check_for_version

    if licenses.empty?
      warn "Defaulting gemspec to MIT license."
      warn "Call license in hoe spec to change."
      license "MIT"
    end

    spec.licenses = licenses

    run_spec_extras
  end