Class: Rdepend::Trace

Inherits:
Object
  • Object
show all
Defined in:
lib/rdepend/trace.rb

Class Method Summary collapse

Class Method Details

.baseObject



45
46
47
# File 'lib/rdepend/trace.rb', line 45

def self.base
  File.basename($0)
end

.exec(&block) ⇒ Object



34
35
36
37
38
# File 'lib/rdepend/trace.rb', line 34

def self.exec(&block)
  self.init
  yield
  self.stop
end

.halt_with_messageObject



57
58
59
60
# File 'lib/rdepend/trace.rb', line 57

def self.halt_with_message
  puts "⏳  Exiting, but writing an Ꝛdepend graph first, so please wait!"
  self.stop
end

.init(paths = [Dir.pwd]) ⇒ Object



40
41
42
43
# File 'lib/rdepend/trace.rb', line 40

def self.init(paths = [Dir.pwd])
  @paths = paths
  RubyProf.start
end

.stopObject



49
50
51
52
53
54
55
# File 'lib/rdepend/trace.rb', line 49

def self.stop
  result = RubyProf.stop
  result.eliminate_methods!(@paths)
  puts "Writing Ꝛdepend graph to rdepend/#{base}.dot.svg"
  Dir.mkdir('rdepend') unless Dir.exist?('rdepend')
  Rdepend::Printer.new(result).print("rdepend/#{base}.dot")
end