~gandelman-a/ubuntu/precise/facter/merge922788

« back to all changes in this revision

Viewing changes to install.rb

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2011-10-18 10:32:42 UTC
  • mfrom: (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: package-import@ubuntu.com-20111018103242-ag8i8vejfp8v7b1b
Tags: upstream-1.6.1
ImportĀ upstreamĀ versionĀ 1.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    $haveman = false
59
59
end
60
60
 
 
61
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
 
62
require 'facter'
 
63
@operatingsystem = Facter[:operatingsystem].value
 
64
 
61
65
PREREQS = %w{openssl xmlrpc/client xmlrpc/server cgi}
62
66
 
63
67
InstallOptions = OpenStruct.new
119
123
        begin
120
124
            require pre
121
125
        rescue LoadError
122
 
            puts "Could not load %s; cannot install" % pre
 
126
            puts "Could not load #{pre} Ruby library; cannot install"
123
127
            exit -1
124
128
        end
125
129
    }
126
130
end
127
131
 
128
132
def is_windows?
129
 
  RUBY_PLATFORM.to_s.match(/mswin|win32|dos|cygwin|mingw/)
 
133
  @operatingsystem == 'windows'
130
134
end
131
135
 
132
136
##
256
260
 
257
261
    # To be deprecated once people move over to using --destdir option
258
262
    if (destdir = ENV['DESTDIR'])
259
 
        bindir = "#{destdir}#{bindir}"
260
 
        sbindir = "#{destdir}#{sbindir}"
261
 
        mandir = "#{destdir}#{mandir}"
262
 
        sitelibdir = "#{destdir}#{sitelibdir}"
 
263
        warn "DESTDIR is deprecated. Use --destdir instead."
 
264
        bindir = join(destdir, bindir)
 
265
        sbindir = join(destdir, sbindir)
 
266
        mandir = join(destdir, mandir)
 
267
        sitelibdir = join(destdir, sitelibdir)
263
268
 
264
269
        FileUtils.makedirs(bindir)
265
270
        FileUtils.makedirs(sbindir)
267
272
        FileUtils.makedirs(sitelibdir)
268
273
        # This is the new way forward
269
274
    elsif (destdir = InstallOptions.destdir)
270
 
        bindir = "#{destdir}#{bindir}"
271
 
        sbindir = "#{destdir}#{sbindir}"
272
 
        mandir = "#{destdir}#{mandir}"
273
 
        sitelibdir = "#{destdir}#{sitelibdir}"
 
275
        bindir = join(destdir, bindir)
 
276
        sbindir = join(destdir, sbindir)
 
277
        mandir = join(destdir, mandir)
 
278
        sitelibdir = join(destdir, sitelibdir)
274
279
 
275
280
        FileUtils.makedirs(bindir)
276
281
        FileUtils.makedirs(sbindir)
289
294
end
290
295
 
291
296
##
 
297
# Join two paths. On Windows, dir must be converted to a relative path,
 
298
# by stripping the drive letter, but only if the basedir is not empty.
 
299
#
 
300
def join(basedir, dir)
 
301
  return "#{basedir}#{dir[2..-1]}" if is_windows? and basedir.length > 0 and dir.length > 2
 
302
 
 
303
  "#{basedir}#{dir}"
 
304
end
 
305
 
 
306
##
292
307
# Build the rdoc documentation. Also, try to build the RI documentation.
293
308
#
294
309
def build_rdoc(files)
387
402
        end
388
403
    end
389
404
 
390
 
    if Config::CONFIG["target_os"] =~ /win/io and Config::CONFIG["target_os"] !~ /darwin/io
 
405
    if is_windows?
391
406
        installed_wrapper = false
392
407
 
393
408
        if File.exists?("#{from}.bat")