class Dependency

Attributes

include[R]
scope[R]

Public Class Methods

new(map, path_mode = :absolute) click to toggle source
# File lib/simple-make/dependency.rb, line 7
def initialize map, path_mode = :absolute
  raise wrong_format_msg(map) if !(map.is_a? Hash) or map[:include].nil? or map[:lib].nil?

  @include = get_path(path_mode, map[:include])
  @lib = get_path(path_mode, map[:lib])
  @scope = map[:scope] || :compile
end

Public Instance Methods

lib_name() click to toggle source
# File lib/simple-make/dependency.rb, line 15
def lib_name
  if @lib_name.nil?
    matches = @lib.match /.*\/lib([^\/]*)\.a/
    raise "lib name format is wrong, it should be [libxxx.a]" if matches.nil?
    @lib_name = matches[1]
    raise "lib name format is wrong, it should be [libxxx.a], and the xxx should not be empty" if @lib_name.empty?
  end
  @lib_name
end
lib_path() click to toggle source
# File lib/simple-make/dependency.rb, line 25
def lib_path
  if @lib_path.nil?
    matches = @lib.match /(.*\/)[^\/]*/
    @lib_path = matches[1]
  end
  @lib_path
end

Private Instance Methods

wrong_format_msg(map) click to toggle source
# File lib/simple-make/dependency.rb, line 34
def wrong_format_msg(map)
  "#{map.inspect} is not a map, please present dependencies in format {include: <include_path>, lib: <lib_file_name>}"
end