Class: Lake::Target

Inherits:
Struct
  • Object
show all
Defined in:
lib/lake.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#depsObject

Returns the value of attribute deps

Returns:

  • (Object)

    the current value of deps



5
6
7
# File 'lib/lake.rb', line 5

def deps
  @deps
end

#flagsObject

Returns the value of attribute flags

Returns:

  • (Object)

    the current value of flags



5
6
7
# File 'lib/lake.rb', line 5

def flags
  @flags
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



5
6
7
# File 'lib/lake.rb', line 5

def name
  @name
end

#procObject

Returns the value of attribute proc

Returns:

  • (Object)

    the current value of proc



5
6
7
# File 'lib/lake.rb', line 5

def proc
  @proc
end

Instance Method Details

#build(rec = true) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/lake.rb', line 6

def build(rec=true)
  if need_build? then
    puts "[INFO] Building #{name}"
    deps.each{
      |e|
      $targets[e.to_s].build if rec or $targets[e.to_s].flags[:unchecked]
    }
    proc.call if proc
  else
    puts "[INFO] #{name} is already built"
  end
end

#need_build?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lake.rb', line 19

def need_build?
  for dep in deps do
    #return true if not $targets[dep.to_s] and not File.exists? dep.to_s

    #return true if $targets[dep.to_s] and $targets[dep.to_s].need_build?

    if $targets[dep.to_s] then
      return true if $targets[dep.to_s].need_build?
    else
      return true unless File.exists? dep.to_s
    end
  end
  return true if flags[:unchecked]
  if flags[:virtual] then
    return false
  else
    return ! File.exists?(name.to_s)
  end
end