Module: BubbleWrap::Ext::ConfigTask

Defined in:
lib/bubble-wrap/ext/motion_project_config.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) included(base)



5
6
7
8
9
10
# File 'lib/bubble-wrap/ext/motion_project_config.rb', line 5

def self.included(base) 
  base.class_eval do
    alias_method :files_dependencies_without_bubblewrap, :files_dependencies
    alias_method :files_dependencies, :files_dependencies_with_bubblewrap
  end
end

Instance Method Details

- (Object) files_dependencies_with_bubblewrap(deps_hash)



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bubble-wrap/ext/motion_project_config.rb', line 16

def files_dependencies_with_bubblewrap(deps_hash)
  res_path = lambda do |x|
    path = path_matching_expression.match(x) ? x : File.join('.', x)
    unless @files.include?(path)
      Motion::Project::App.send(:fail, "Can't resolve dependency `#{x}' because #{path} is not in #{@files.inspect}")
    end
    path
  end
  deps_hash.each do |path, deps|
    deps = [deps] unless deps.is_a?(Array)
    @dependencies[res_path.call(path)] = deps.map(&res_path)
  end
end

- (Object) path_matching_expression



12
13
14
# File 'lib/bubble-wrap/ext/motion_project_config.rb', line 12

def path_matching_expression
  /^\.?\//
end