define_spec (Hoe)

    # File lib/hoe.rb, line 327
      def define_spec
        self.spec = Gem::Specification.new do |s|
          dirs = Dir['{lib,ext}']

          s.name                 = name
          s.version              = version if version
          s.summary              = summary
          s.email                = email
          s.homepage             = Array(url).first
          s.rubyforge_project    = rubyforge_name
          s.description          = description
          s.files = files        = File.read_utf("Manifest.txt").split(/\r?\n\r?/)
          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.has_rdoc             = true
          s.post_install_message = post_install_message
          s.test_files           = Dir[*self.test_globs]

          missing "Manifest.txt" if files.empty?

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

          extra_deps.each do |dep|
            s.add_dependency(*dep)
          end

          extra_dev_deps.each do |dep|
            s.add_development_dependency(*dep)
          end

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

        end

        unless self.version then
          version = nil

          spec.files.each do |file|
            next unless File.exist? file
            version = File.read(file)[/VERSION += +([\"\'])([\d][\d\w\.]+)\1/, 2]
            break if version
          end

          spec.version = self.version = version if version

          unless self.version then
            spec.version = self.version = "0.borked"
            warn "** Add 'VERSION = \"x.y.z\"' to your code,"
            warn "   add a version to your hoe spec,"
            warn "   or fix your Manifest.txt"
          end
        end

        # Do any extra stuff the user wants
        spec_extras.each do |msg, val|
          case val
          when Proc
            val.call spec.send(msg)
          else
            spec.send "#{msg}=", val
          end
        end
      end