module Autorake::Rakefile
Public Instance Methods
compiler(*args)
click to toggle source
# File lib/autorake.rb, line 40 def compiler *args Compiler.new @autorake.incdirs, @autorake.macros, *args end
expand(dir)
click to toggle source
# File lib/autorake.rb, line 36 def expand dir @autorake.directories.expand dir end
extended(obj)
click to toggle source
# File lib/autorake.rb, line 13 def extended obj obj.load_autorake ENV[ "AUTORAKE_CONFIGURE"] Builder.verbose = true end
has?(name)
click to toggle source
# File lib/autorake.rb, line 28 def has? name @autorake.features[ name.to_sym] end
installer(under, files, destdir = nil, params = nil)
click to toggle source
# File lib/autorake.rb, line 49 def installer under, files, destdir = nil, params = nil not params and case destdir when nil, Hash then under, files, destdir, params = nil, under, files, destdir end destdir = @autorake.directories.expand destdir d = ENV[ "DESTDIR"] if d then d = File.expand_path d destdir = File.join d, destdir end files = case files when Array then files else [ files] end unless @autorake_install then task :install do install_targets end task :uninstall do uninstall_targets end @autorake_install = [] end p = {} p.update params if params @autorake_install.push [ under, files, destdir, p] end
linker(*args)
click to toggle source
# File lib/autorake.rb, line 44 def linker *args Linker.new @autorake.libdirs, @autorake.libs, *args end
load_autorake(filename = nil)
click to toggle source
# File lib/autorake.rb, line 74 def load_autorake filename = nil @autorake = YAML.load_file filename||Configuration::CONFIG_FILE @autorake.do_env end
method_missing(sym, *args, &block)
click to toggle source
Calls superclass method
# File lib/autorake.rb, line 19 def method_missing sym, *args, &block case sym when /\Ahas_(.*?)\??\z/ then has? $1 when /\Aparm_/ then parm[ $'.to_sym] when /\Aexpand_/ then expand $'.upcase else super end end
parm()
click to toggle source
# File lib/autorake.rb, line 32 def parm @autorake.parameters end
Private Instance Methods
dir_entries(dir)
click to toggle source
# File lib/autorake.rb, line 104 def dir_entries dir (Dir.entries dir) - %w(. ..) end
install(under, src, dir, params, depth)
click to toggle source
# File lib/autorake.rb, line 108 def install under, src, dir, params, depth paths_for_install under, src, dir, depth do |dst,here,there| install under, there, dir, params, 0 if there if File.directory? here or not File.exists? here then mkdir dst unless File.directory? dst if params[ :recursive] then (dir_entries here).each { |e| install under, (File.join src, e), dir, params, depth+1 } end elsif File.symlink? here then rm dst if File.exists? dst rdl = File.readlink here ln_s rdl, dst else cp here, dst end u = params[ :user] g = params[ :group] u, g = u.split ":" if u and not g chown u, g, dst if u or g m = params[ :mode] s = params[ :umask] m ||= s && (File.stat dst).mode & ~s & 0777 chmod m, dst if m end end
install_targets()
click to toggle source
# File lib/autorake.rb, line 81 def install_targets @autorake_install.each { |under,files,destdir,params| File.directory? destdir or mkdir_p destdir files.each { |f| install under, f, destdir, params, 0 } } end
paths_for_install(under, src, dir, depth) { |dst, here, there| ... }
click to toggle source
# File lib/autorake.rb, line 94 def paths_for_install under, src, dir, depth dst = File.join dir, src here = under ? (File.join under, src) : src if depth.zero? then there, = File.split src there = nil if there == "." end yield dst, here, there end
uninstall(under, src, dir, params, depth)
click to toggle source
# File lib/autorake.rb, line 136 def uninstall under, src, dir, params, depth paths_for_install under, src, dir, depth do |dst,here,there| if File.directory? dst then if params[ :recursive] then (dir_entries dst).each { |e| uninstall under, (File.join src, e), dir, params, depth+1 } end rmdir dst elsif File.exists? dst or File.symlink? dst then rm dst end uninstall under, there, dir, params, 0 if there end end
uninstall_targets()
click to toggle source
# File lib/autorake.rb, line 88 def uninstall_targets @autorake_install.reverse.each { |under,files,destdir,params| files.each { |f| uninstall under, f, destdir, params, 0 } } end