File: doc.rb

package info (click to toggle)
ruby-curb 0.8.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 604 kB
  • ctags: 880
  • sloc: ansic: 4,242; ruby: 2,768; makefile: 3
file content (42 lines) | stat: -rw-r--r-- 945 bytes parent folder | download | duplicates (6)
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
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