define_inline_tasks (Hoe::Inline)

    # File lib/hoe/inline.rb, line 24
      def define_inline_tasks
        extra_deps  << 'RubyInline'
        clean_globs << File.expand_path("~/.ruby_inline")
        task :test => :clean

        if ENV['INLINE'] then
          s.platform = ENV['FORCE_PLATFORM'] || Gem::Platform::CURRENT

          # Try collecting Inline extensions for +name+
          if defined?(Inline) then
            directory 'lib/inline'

            dlext = Config::CONFIG['DLEXT']

            Inline.registered_inline_classes.each do |cls|
              name = cls.name # TODO: what about X::Y::Z?
              # name of the extension is CamelCase
              alternate_name = if name =~ /[A-Z]/ then
                                 name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
                               elsif name =~ /_/ then
                                 name.capitalize.gsub(/_([a-z])/) { $1.upcase }
                               end
              extensions = Dir.chdir(Inline::directory) {
                Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"]
              }

              extensions.each do |ext|
                # add the inlined extension to the spec files
                s.files += ["lib/inline/#{ext}"]

                # include the file in the tasks
                file "lib/inline/#{ext}" => ["lib/inline"] do
                  cp File.join(Inline::directory, ext), "lib/inline"
                end
              end
            end
          end
        end
      end