File: post-install.rb

package info (click to toggle)
ruby-rmagick 2.13.2-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,620 kB
  • ctags: 1,785
  • sloc: ansic: 16,759; ruby: 9,717; makefile: 14; sh: 14
file content (50 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download | duplicates (4)
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
44
45
46
47
48
49
50
# install RMagick documentation

require 'fileutils'
require 'find'

if defined?(Installer) && self.class == Installer

    BUILD_HTMLDOC = get_config('disable-htmldoc') != 'yes'

    $docdir = nil

    # Where to install the documentation
    def docdir
        return $docdir if $docdir
        dir = get_config('doc-dir')+'/'
        dir.sub!(/\A$prefix/, get_config('prefix'))
        $docdir = dir
    end
else

    BUILD_HTMLDOC = true

    def docdir
        return ARGV[0]
    end
end

if BUILD_HTMLDOC

    puts "\npost-install.rb: installing documentation..."

    Find.find('doc') do |file|
        next if FileTest.directory? file
        target = file.sub(/^doc\//,docdir())
        unless FileTest.exists? File.dirname(target)
            FileUtils.mkdir_p(File.dirname(target), :verbose => true)
            # Mark this directory as one we created so
            # that uninstall.rb knows it's okay to delete
            FileUtils.touch("#{File.dirname(target)}/.rmagick")
        end
        FileUtils.install(file, target, :mode => 0644)
    end

else

    puts "\npost-install.rb: --disable-htmldoc specified. No documentation will be installed."

end

exit