Class: R::TargetHelp

Inherits:
C::TargetTag show all
Defined in:
lib/rub/help.rb

Constant Summary collapse

@@tag =
nil

Instance Attribute Summary

Attributes inherited from C::TargetTag

#description, #input, #output, #tag

Instance Method Summary collapse

Methods inherited from C::TargetTag

#require

Methods inherited from Target

#clean?, #description, #hash_input, #hash_output, #hash_outputs, #hash_self, #input, #output, #register

Constructor Details

#initialize(t) ⇒ TargetHelp

Returns a new instance of TargetHelp.



55
56
57
58
59
# File 'lib/rub/help.rb', line 55

def initialize(t)
  super t.to_sym
  
  register
end

Instance Method Details

#buildObject



83
84
85
# File 'lib/rub/help.rb', line 83

def build
  gen_help
end

#gen_helpObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rub/help.rb', line 31

def gen_help
  @@tag and return
  
  @@tag = Set.new
  @@bld = Set.new
  @@ins = Set.new
  @@src = Set.new
  
  R.targets.each do |p, t|
    if p.is_a? Symbol
      @@tag << [p, t]
    elsif p.to_s.start_with?(R::Env.out_dir.to_s)
      @@bld << [p, t]
    elsif (
        p.to_s.start_with?(D[:prefix].to_s+'/') ||
         !p.to_s.start_with?(R::Env.src_dir.to_s)
        )
      @@ins << [p, t]
    else
      @@src << [p, t]
    end
  end
end


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/rub/help.rb', line 61

def print_target(ta)
  p, t = ta
  ps = if p.is_a? Symbol
    #p.inspect
    ":#{p}"
  else
    p.to_s
  end
  
  if t.description
    printf "  %-20s - %s\n", ps, t.description
  else
    printf "  %s\n", ps
  end
end


77
78
79
80
81
# File 'lib/rub/help.rb', line 77

def print_targets(tm)
  tm.each do |t|
    print_target t
  end
end