lib/dbt.rb in dbt-1.0.7 vs lib/dbt.rb in dbt-1.1.0
- old
+ new
@@ -1,15 +1,15 @@
# coding: utf-8
-Motion::Project::App.setup do |app|
- def app.analyze
+module DBT
+ def analyze(app)
debugger_cmds_output = "#------> Creado por el DBT <------#\n"
dependers = Hash.new { |hash,key| hash[key] = [] }
providers = {}
- files.uniq!
- files.each do |filename|
+ files = app.files.flatten.uniq
+ files.flatten.each do |filename|
File.open(filename, 'r') do |file|
file.each_line do |line|
command = false
if line =~ /^#--+>/
@@ -48,16 +48,24 @@
dependers.each do |filename, dependencies|
if dep = dependencies.find { |dep| ! providers.include? dep }
puts "\033[1m!NO HAY!\033[0m \033[1;31m#{dep}\033[0m"
raise "#{filename} could not find a provider for #{dep}"
else
- self.files_dependencies filename => dependencies.map{|dep| providers[dep] }
+ app.files_dependencies filename => dependencies.map { |dep| providers[dep] }
end
end
unless debugger_cmds_output.empty?
File.open('debugger_cmds', 'w') do |file|
file.write debugger_cmds_output
end
end
+ end
+end
+
+
+Motion::Project::App.setup do |app|
+ def app.analyze
+ puts("\033[1mcalling `app.analyze` is deprecated. Use DBT.analyze(app) instead (non-polluting)\033[0m")
+ DBT.analyze(self)
end
end