public
Description: Ruby bindings for libcurl
Homepage: http://idle-hacking.com/
Clone URL: git://github.com/taf2/curb.git
Todd A. Fisher (author)
Wed Sep 23 08:34:02 -0700 2009
curb / doc.rb
100644 43 lines (33 sloc) 0.945 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'fileutils'
include FileUtils
 
begin
  incflags = File.read('ext/Makefile')[/INCFLAGS\s*=\s*(.*)$/,1]
rescue Errno::ENOENT
  $stderr.puts("No makefile found; run `rake ext/Makefile' first.")
end
 
pp_srcdir = 'ext'
 
rm_rf(tmpdir = '.doc-tmp')
mkdir(tmpdir)
 
begin
  if ARGV.include?('--cpp')
    begin
      if `cpp --version` =~ /\(GCC\)/
        # gnu cpp
        $stderr.puts "Running GNU cpp over source"
        
        Dir['ext/*.c'].each do |fn|
          system("cpp -DRDOC_NEVER_DEFINED -C #{incflags} -o " +
                 "#{File.join(tmpdir, File.basename(fn))} #{fn}")
        end
        
        pp_srcdir = tmpdir
      else
        $stderr.puts "Not running cpp (non-GNU)"
      end
    rescue
      # no cpp
      $stderr.puts "No cpp found"
    end
  end
 
  system("rdoc --title='Curb - libcurl bindings for ruby' --main=README #{pp_srcdir}/*.c README LICENSE lib/curb.rb")
ensure
  rm_rf(tmpdir)
end