Module: Autorake::Rakefile

Defined in:
lib/autorake.rb

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/autorake.rb', line 29

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

Class Method Details

.extended(obj) ⇒ Object



23
24
25
26
# File 'lib/autorake.rb', line 23

def extended obj
  obj.load_autorake ENV[ "AUTORAKE_CONFIGURE"].notempty?
  Builder.verbose = true
end

Instance Method Details

#compiler(*args) ⇒ Object



50
51
52
# File 'lib/autorake.rb', line 50

def compiler *args
  Compiler.new @autorake.incdirs, @autorake.macros, *args
end

#expand(dir, file = nil) ⇒ Object



46
47
48
# File 'lib/autorake.rb', line 46

def expand dir, file = nil
  @autorake.directories.expand dir, file
end

#has?(name) ⇒ Boolean



38
39
40
# File 'lib/autorake.rb', line 38

def has? name
  @autorake.features[ name.to_sym]
end

#installer(under, files, destdir = nil, params = nil) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/autorake.rb', line 59

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 = expand destdir
  d = ENV[ "DESTDIR"]
  if d then
    d = File.expand_path d
    destdir = File.join d, destdir
  end
  case files
    when Array then
    when nil   then files = []
    else            files = [ 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) ⇒ Object



54
55
56
# File 'lib/autorake.rb', line 54

def linker *args
  Linker.new @autorake.libdirs, @autorake.libs, *args
end

#load_autorake(filename = nil) ⇒ Object



85
86
87
88
# File 'lib/autorake.rb', line 85

def load_autorake filename = nil
  @autorake = YAML.load_file filename||Configuration::CONFIG_FILE
  @autorake.do_env
end

#parmObject



42
43
44
# File 'lib/autorake.rb', line 42

def parm
  @autorake.parameters
end