who_called_me 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ rdoc
19
19
  pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
+
23
+ /Gemfile.lock
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use ree
data/CHANGELOG ADDED
@@ -0,0 +1,6 @@
1
+
2
+
3
+ - replaced Rubygems & Jeweler by Bundler
4
+
5
+ version 0.1.0
6
+ - initial version
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Alain Ravet
1
+ Copyright (c) 2011 Alain Ravet
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.markdown ADDED
@@ -0,0 +1,58 @@
1
+ Before refactoring/changing code, you need to locate the tests that will use this code. who\_called\_me helps you track those usages.
2
+
3
+
4
+ ## How to install :
5
+
6
+ gem install who_called_me
7
+
8
+
9
+ ## How to use :
10
+
11
+ ### 1° call 'who\_called\_me' in the method you want to track.
12
+
13
+ ..
14
+ def foo
15
+ who_called_me # <-- just insert this
16
+ ...
17
+ end
18
+ ..
19
+
20
+ ### 2° run the tests / the application
21
+
22
+ When the tests/application exits, a report is printed in the console that looks like :
23
+
24
+
25
+ ---------------------------------------------------------------------------------------------------
26
+ who_called_me report :
27
+ ======================
28
+
29
+ +----------------------------
30
+ | who_called_me
31
+ +----------------------------
32
+
33
+ /dev/my_project/spec/fixtures/foo_foo.rb:5:in `foo'
34
+ was called by :
35
+ . /dev/my_project/spec/fixtures/foo.rb:8:in `bar'
36
+
37
+ /dev/my_project/spec/fixtures/foo_foo.rb:6:in `foo'
38
+ was called by :
39
+ . /dev/my_project/spec/fixtures/foo.rb:5:in `foo'
40
+ . /dev/my_project/spec/fixtures/foo.rb:8:in `bar'
41
+
42
+ ---------------------------------------------------------------------------------------------------
43
+
44
+
45
+
46
+ == Note on Patches/Pull Requests
47
+
48
+ * Fork the project.
49
+ * Make your feature addition or bug fix.
50
+ * Add tests for it. This is important so I don't break it in a
51
+ future version unintentionally.
52
+ * Commit, do not mess with rakefile, version, or history.
53
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
54
+ * Send me a pull request. Bonus points for topic branches.
55
+
56
+ == Copyright
57
+
58
+ Copyright (c) 2010 Alain Ravet. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,45 +1,19 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ # encoding: UTF-8
2
+ require 'bundler'
3
+ Bundler::GemHelper.install_tasks
3
4
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "who_called_me"
8
- gem.summary = %Q{track and list the code lines that exercise a line}
9
- gem.description = %Q{track and list the code lines that exercise a line}
10
- gem.email = "alain.ravet+git@gmail.com"
11
- gem.homepage = "http://github.com/alainravet/who_called_me"
12
- gem.authors = ["Alain Ravet"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
- end
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
19
- end
5
+ require 'rake'
6
+ require 'rake/rdoctask'
20
7
 
21
8
  require 'spec/rake/spectask'
22
9
  Spec::Rake::SpecTask.new(:spec) do |spec|
23
10
  spec.libs << 'lib' << 'spec'
24
11
  spec.spec_files = FileList['spec/**/*_spec.rb']
25
12
  end
13
+ task :default => :spec
26
14
 
27
15
  Spec::Rake::SpecTask.new(:rcov) do |spec|
28
16
  spec.libs << 'lib' << 'spec'
29
17
  spec.pattern = 'spec/**/*_spec.rb'
30
18
  spec.rcov = true
31
19
  end
32
-
33
- task :spec => :check_dependencies
34
-
35
- task :default => :spec
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "who_called_me #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
data/doc/devnotes.txt ADDED
@@ -0,0 +1,7 @@
1
+
2
+ How to test the current features on embedded sample code ?
3
+ --------------------------------------------------------
4
+
5
+ $ cd <proj_notes>
6
+ $ ruby spec/live_testing/foo_foo_caller.rb
7
+
data/lib/who_called_me.rb CHANGED
@@ -1,17 +1,21 @@
1
- require File.dirname(__FILE__) + '/who_called_me/who_called_me.rb'
1
+ $:.push File.expand_path(File.dirname(__FILE__))
2
+
3
+ require 'who_called_me/who_called_me.rb'
4
+ Dir.glob("#{File.expand_path(File.dirname(__FILE__))}/**/utils/*.rb").each { |f| load(f) }
5
+
2
6
 
3
7
  module Kernel
4
- def who_called_me(msg=nil)
5
- nof_internal_methods_to_skim = 3 #this + WhoCalledMe._who_called_me + _fulltrace
6
- WhoCalledMe._who_called_me(msg, nof_internal_methods_to_skim)
8
+ def who_called_me(key=nil)
9
+ nof_internal_methods_to_skim = 3 #3 #this + WhoCalledMe._who_called_me + _fulltrace
10
+ WhoCalledMe.record_i_was_called(key, nof_internal_methods_to_skim)
7
11
  end
8
12
  def who_called_me_data(options={})
9
- WhoCalledMe._who_called_me_data(options)
13
+ WhoCalledMe._recorded_calls_data(options)
10
14
  end
11
15
  end
12
16
 
13
17
  at_exit do
14
18
  if !who_called_me_data.empty?
15
- WhoCalledMe.puts_formatted_traces
19
+ WhoCalledMe.puts_all_formatted_traces
16
20
  end
17
- end
21
+ end
@@ -0,0 +1,34 @@
1
+ module WhoCalledMe
2
+ module Utils
3
+ module ArrayUtils
4
+
5
+ def indent(array, options={:prefix => nil})
6
+ prefix = options[:prefix]
7
+ array.collect{|l| "#{prefix}#{l}"}
8
+ end
9
+
10
+ def first_elements_with_common_prefix(arr, pre_len_to_ignore=0)
11
+ arr.each_index do |i|
12
+ # exclude the n first characters from the comparison <- remove them
13
+ arr[i] = arr[i][pre_len_to_ignore..-1]
14
+ end
15
+
16
+ [].tap do |results|
17
+ first_line = arr.first
18
+ results << first_line
19
+ (0..arr.length-2).each do |i|
20
+ line, next_line = arr[i], arr[i+1]
21
+
22
+ next_line_in_same_code_tree = StringUtils.have_common_substring?(line, next_line)
23
+ next_line_in_same_code_tree ?
24
+ (results << next_line) :
25
+ break
26
+ end
27
+ end
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+
34
+ WhoCalledMe.send :extend, WhoCalledMe::Utils::ArrayUtils
@@ -0,0 +1,63 @@
1
+ module WhoCalledMe
2
+ module Utils
3
+ module CodeLinesUtils
4
+
5
+ # input = Users/ara//foo.rb:3:in `level_1'
6
+ # => ['/ara//foo.rb',3,"in `level_1'"]
7
+ def file_and_line_details(called_line)
8
+ file, line_nbr, context = called_line.split(':')
9
+ ['/'+file, line_nbr.to_i, context]
10
+ end
11
+
12
+
13
+ def boxed_code_snippet_around(called_line)
14
+ file, line_nbr, context = file_and_line_details(called_line)
15
+ formatted_code_snippet = numbered_lines_section_around(file, line_nbr)
16
+ #formatted_code_snippet = WhoCalledMe::Utils::FileUtils.numbered_lines_section_around(file, line_nbr)
17
+ formatted_code_snippet.flatten #TODO : fix the numbered_lines_section_around so that it returns a flat array
18
+ end
19
+
20
+
21
+ # Usage:
22
+ # puts numbered_lines_section_around('/todo.txt', 9).join("\n")
23
+ # puts numbered_lines_section_around('/todo.txt', 9, padding = 3).join("\n")
24
+ #
25
+ def numbered_lines_section_around(filename, center_line_number, padding = 1)
26
+ lines_range = range_around(center_line_number, padding)
27
+ max_digits = max_digits_in(lines_range)
28
+
29
+ all_lines = File.open(filename).readlines # TODO : optimize (don't read lines after the range limit)
30
+
31
+ filename_line = "| File : #{filename}"
32
+ hr = '+' + '-'*filename_line.length
33
+
34
+ [].tap do |formatted_lines|
35
+ formatted_lines << hr
36
+ formatted_lines << filename_line
37
+ formatted_lines << hr
38
+ formatted_lines << lines_range.collect { |nbr|
39
+ raw_line = all_lines[nbr-1].chomp
40
+ numbered_line = "| line %#{max_digits}s : %s" % [nbr, raw_line]
41
+ (center_line_number==nbr) ?
42
+ colour_current_line(numbered_line) :
43
+ numbered_line
44
+ }
45
+ formatted_lines << hr
46
+ end
47
+ end
48
+
49
+ private
50
+
51
+ def range_around(center_line_number, padding)
52
+ (center_line_number - padding..center_line_number + padding)
53
+ end
54
+
55
+ def max_digits_in(lines_range)
56
+ 1 + Math.log10(1+lines_range.last).to_int
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+
63
+ WhoCalledMe.send :extend, WhoCalledMe::Utils::CodeLinesUtils
@@ -0,0 +1,24 @@
1
+ module WhoCalledMe
2
+ module Utils
3
+ module ColourUtils
4
+ NO_COLOUR = "\033[0m"
5
+ RED = "\033[31m"
6
+ LRED = "\033[1;31m"
7
+ BLUE = "\033[34m"
8
+ GREEN = "\033[32m"
9
+ YELLOW = "\033[1;33m"
10
+
11
+ def red( str) [RED, str, NO_COLOUR].join end
12
+ def lred( str) [LRED, str, NO_COLOUR].join end
13
+ def blue( str) [BLUE, str, NO_COLOUR].join end
14
+ def green( str) [GREEN, str, NO_COLOUR].join end
15
+ def yellow(str) [YELLOW, str, NO_COLOUR].join end
16
+
17
+ def colour_current_line(str)
18
+ [YELLOW, str, NO_COLOUR].join
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ WhoCalledMe.send :extend, WhoCalledMe::Utils::ColourUtils
@@ -0,0 +1,9 @@
1
+ module WhoCalledMe
2
+ module Utils
3
+ module FileUtils
4
+
5
+
6
+ end
7
+ end
8
+ end
9
+ WhoCalledMe.send :extend, WhoCalledMe::Utils::FileUtils
@@ -1,7 +1,7 @@
1
1
  module WhoCalledMe
2
2
  module StringUtils
3
3
 
4
- def self.common_substring?(a, b)
4
+ def self.have_common_substring?(a, b)
5
5
  1 <= common_substring(a, b).length
6
6
  end
7
7
 
@@ -0,0 +1,40 @@
1
+ module WhoCalledMe
2
+ module Utils
3
+ module TraceUtils
4
+
5
+ def fulltrace
6
+ raise
7
+ rescue
8
+ $!.backtrace
9
+ end
10
+
11
+ def formatted_trace(trace, processed_first_lines)
12
+ first_line, last_line = trace.first, trace.last
13
+ already_recorded_a_trace_for_this_target = processed_first_lines.include?(first_line)
14
+ trace.shift
15
+ res = []
16
+ res << "\n"
17
+
18
+ unless already_recorded_a_trace_for_this_target
19
+ processed_first_lines << first_line
20
+ short_form = already_recorded_a_trace_for_this_target
21
+ res += boxed_code_snippet_around(first_line) unless short_form
22
+ end
23
+ res << ' was called by :'
24
+ res += indented_call_trace(trace)
25
+ res += indent(boxed_code_snippet_around(last_line), :prefix => ' '*6)
26
+ res
27
+ end
28
+
29
+
30
+ def indented_call_trace(trace, base_padding=' ')
31
+ padding = ''
32
+ [].tap do |indented_trace|
33
+ trace.each_with_index { |line, i| indented_trace << " . #{base_padding*i}#{line}" }
34
+ end
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ WhoCalledMe.send :extend, WhoCalledMe::Utils::TraceUtils
@@ -1,77 +1,75 @@
1
- require File.dirname(__FILE__) + '/string_utils'
2
- require File.dirname(__FILE__) + '/array_utils'
3
- require File.dirname(__FILE__) + '/trace_utils'
4
-
5
1
  module WhoCalledMe
2
+ def self.puts_all_formatted_traces
3
+ return if _recorded_calls_data.empty?
4
+ return if @@__disable_puts
5
+ @processed_first_lines = []
6
+ _recorded_calls_data.keys.each do |key|
7
+ _recorded_calls_data[key].each do |trace|
8
+ puts formatted_trace(trace, @processed_first_lines).join("\n")
9
+ end
10
+ end
11
+ end
12
+ end
6
13
 
7
- @@__who_called_me_accumul_h = {}
8
- @@__disable_puts = false
9
-
10
- def self.disable_puts ; @@__disable_puts = true end
11
- def self.enable_puts ; @@__disable_puts = false end
12
-
14
+ class Accumulator
15
+ attr_reader :data
16
+ def initialize
17
+ @data = {}
18
+ end
13
19
 
14
- def self._who_called_me(msg=nil, nof_internal_methods_to_skim=1+1) # this + _fulltrace
15
- fulltrace = TraceUtils.fulltrace
16
- trace = ArrayUtils.first_elements_with_common_prefix(fulltrace, 1)
17
- trace = trace[nof_internal_methods_to_skim..-1]
18
- trace.reverse!
20
+ def keys
21
+ data.keys
22
+ end
19
23
 
20
- record(msg || :all, trace)
24
+ def data_only_top
25
+ {}.tap do |result|
26
+ keys.each do |key|
27
+ traces = data[key]
28
+ result[key] = traces.collect{|trace| trace.first }.uniq
29
+ end
30
+ end
31
+ end
21
32
 
22
- trace
33
+ def record_trace(key, trace)
34
+ data[key] ||= []
35
+ data[key] << trace
23
36
  end
24
37
 
25
- def self.record(key, trace)
26
- @@__who_called_me_accumul_h[key] ||= []
27
- @@__who_called_me_accumul_h[key] << trace
38
+ def [](key)
39
+ data[key]
28
40
  end
29
41
 
42
+ end
30
43
 
44
+ module WhoCalledMe
31
45
 
32
- def self._who_called_me_data(options={})
33
- if options[:only_top]
34
- {}.tap do |result|
35
- @@__who_called_me_accumul_h.each do |key, traces|
36
- result[key] = traces.collect{|trace| trace.first }.uniq
37
- end
38
- end
39
- else
40
- @@__who_called_me_accumul_h
41
- end
42
- end
46
+ @@_accumulator = Accumulator.new
47
+ @@__disable_puts = false
43
48
 
49
+ def self.accumulator ; @@_accumulator end
44
50
 
45
- def self.puts_formatted_traces
46
- return if _who_called_me_data.empty?
47
- return if @@__disable_puts
48
- l0 = '-'*99
49
- puts l0
50
- puts 'who_called_me report :'
51
- puts '======================'
52
- _who_called_me_data.keys.each do |key|
53
- puts
54
- puts "+----------------------------"
55
- puts (key == :all) ? '| who_called_me' : "| who_called_me(#{key})"
56
- puts "+----------------------------"
57
- _who_called_me_data[key].each do |trace|
58
- puts
59
- puts trace.shift
60
- puts ' was called by :'
61
- padding = ''
62
- trace.each do |line|
63
- padding += ' '
64
- puts " .#{padding}#{line}"
65
- end
66
- end
67
- end
68
- puts
69
- puts l0
51
+ def self.disable_puts ; @@__disable_puts = true end
52
+ def self.enable_puts ; @@__disable_puts = false end
53
+
54
+ def self.record_i_was_called(key=:all, nof_internal_methods_to_skim=1+1) # this + _fulltrace
55
+ trace = first_elements_with_common_prefix(fulltrace, 1)
56
+ trace = trace[nof_internal_methods_to_skim..-1]
57
+ accumulator.record_trace(key, trace)
58
+ end
59
+
60
+ def self._recorded_calls_data(options={})
61
+ options[:only_top] ?
62
+ accumulator.data_only_top :
63
+ accumulator.data
70
64
  end
71
65
 
72
66
  # used by tests only
73
- def self.reset
74
- @@__who_called_me_accumul_h = {}
67
+ def self.reset_for_next_test
68
+ reset_accumulator_for_next_test
75
69
  @@__disable_puts = false
76
70
  end
77
- end
71
+
72
+ def self.reset_accumulator_for_next_test
73
+ @@_accumulator ||= Accumulator.new
74
+ end
75
+ end
data/spec/fixtures/foo.rb CHANGED
@@ -1,10 +1,8 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/who_called_me')
2
-
3
1
  class Foo
4
- def foo
5
- bar
2
+ def level_1
3
+ level_0 # -1
6
4
  end
7
- def bar
5
+ def level_0
8
6
  who_called_me
9
7
  end
10
8
 
@@ -2,8 +2,8 @@ require File.expand_path(File.dirname(__FILE__) + '/foo')
2
2
 
3
3
  class FooFoo
4
4
  def foofoo
5
- Foo.new.bar
6
- Foo.new.foo
5
+ Foo.new.level_0
6
+ Foo.new.level_1
7
7
  end
8
8
 
9
9
  def self.point_1
@@ -0,0 +1,9 @@
1
+ $:.push File.expand_path("../../../lib", __FILE__)
2
+ $:.push File.expand_path("../../fixtures", __FILE__)
3
+
4
+ require 'who_called_me'
5
+ require 'foo_foo'
6
+
7
+ FooFoo.new.foofoo
8
+ #FooFoo.point_1
9
+ Foo.point_1
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ require 'spec/autorun'
6
6
 
7
7
  Spec::Runner.configure do |config|
8
8
  config.before(:each) do
9
- WhoCalledMe.reset
9
+ WhoCalledMe.reset_for_next_test
10
10
  end
11
11
 
12
12
  end
@@ -1,65 +1,26 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
5
2
 
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{who_called_me}
8
- s.version = "0.1.0"
6
+ s.name = 'who_called_me'
7
+ s.version = "0.1.1"
8
+ s.date = Time.now.utc.strftime("%Y-%m-%d")
9
+ s.homepage = %q{http://github.com/alainravet/who_called_me}
9
10
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Alain Ravet"]
12
- s.date = %q{2010-08-23}
11
+ s.summary = %q{track and list the code lines that exercise a line}
13
12
  s.description = %q{track and list the code lines that exercise a line}
14
- s.email = %q{alain.ravet+git@gmail.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/who_called_me.rb",
27
- "lib/who_called_me/array_utils.rb",
28
- "lib/who_called_me/string_utils.rb",
29
- "lib/who_called_me/trace_utils.rb",
30
- "lib/who_called_me/who_called_me.rb",
31
- "spec/fixtures/foo.rb",
32
- "spec/fixtures/foo_foo.rb",
33
- "spec/fixtures/foo_foo_caller.rb",
34
- "spec/spec.opts",
35
- "spec/spec_helper.rb",
36
- "spec/who_called_me_spec.rb",
37
- "who_called_me.gemspec"
38
- ]
39
- s.homepage = %q{http://github.com/alainravet/who_called_me}
13
+
14
+ s.authors = ["Alain Ravet"]
15
+ s.email = %q{alain.ravet+git@gmail.com}
16
+ s.extra_rdoc_files = %w(LICENSE README.markdown)
40
17
  s.rdoc_options = ["--charset=UTF-8"]
41
18
  s.require_paths = ["lib"]
42
- s.rubygems_version = %q{1.3.7}
43
- s.summary = %q{track and list the code lines that exercise a line}
44
- s.test_files = [
45
- "spec/fixtures/foo.rb",
46
- "spec/fixtures/foo_foo.rb",
47
- "spec/fixtures/foo_foo_caller.rb",
48
- "spec/spec_helper.rb",
49
- "spec/who_called_me_spec.rb"
50
- ]
51
19
 
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
20
+ s.files = `git ls-files`.split("\n")
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.require_paths = ["lib"]
55
23
 
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
58
- else
59
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
60
- end
61
- else
62
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
63
- end
24
+ s.add_development_dependency 'rspec', '>=2.6.0'
64
25
  end
65
26
 
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: who_called_me
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
4
+ prerelease:
5
+ version: 0.1.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Alain Ravet
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-08-23 00:00:00 +02:00
13
+ date: 2011-05-29 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,12 +21,7 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 13
30
- segments:
31
- - 1
32
- - 2
33
- - 9
34
- version: 1.2.9
24
+ version: 2.6.0
35
25
  type: :development
36
26
  version_requirements: *id001
37
27
  description: track and list the code lines that exercise a line
@@ -42,22 +32,29 @@ extensions: []
42
32
 
43
33
  extra_rdoc_files:
44
34
  - LICENSE
45
- - README.rdoc
35
+ - README.markdown
46
36
  files:
47
37
  - .document
48
38
  - .gitignore
39
+ - .rvmrc
40
+ - CHANGELOG
41
+ - Gemfile
49
42
  - LICENSE
50
- - README.rdoc
43
+ - README.markdown
51
44
  - Rakefile
52
45
  - VERSION
46
+ - doc/devnotes.txt
53
47
  - lib/who_called_me.rb
54
- - lib/who_called_me/array_utils.rb
55
- - lib/who_called_me/string_utils.rb
56
- - lib/who_called_me/trace_utils.rb
48
+ - lib/who_called_me/utils/array_utils.rb
49
+ - lib/who_called_me/utils/code_lines_utils.rb
50
+ - lib/who_called_me/utils/colour_utils.rb
51
+ - lib/who_called_me/utils/file_utils.rb
52
+ - lib/who_called_me/utils/string_utils.rb
53
+ - lib/who_called_me/utils/trace_utils.rb
57
54
  - lib/who_called_me/who_called_me.rb
58
55
  - spec/fixtures/foo.rb
59
56
  - spec/fixtures/foo_foo.rb
60
- - spec/fixtures/foo_foo_caller.rb
57
+ - spec/live_testing/foo_foo_caller.rb
61
58
  - spec/spec.opts
62
59
  - spec/spec_helper.rb
63
60
  - spec/who_called_me_spec.rb
@@ -76,29 +73,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
73
  requirements:
77
74
  - - ">="
78
75
  - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
76
  version: "0"
83
77
  required_rubygems_version: !ruby/object:Gem::Requirement
84
78
  none: false
85
79
  requirements:
86
80
  - - ">="
87
81
  - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
82
  version: "0"
92
83
  requirements: []
93
84
 
94
85
  rubyforge_project:
95
- rubygems_version: 1.3.7
86
+ rubygems_version: 1.6.2
96
87
  signing_key:
97
88
  specification_version: 3
98
89
  summary: track and list the code lines that exercise a line
99
90
  test_files:
100
91
  - spec/fixtures/foo.rb
101
92
  - spec/fixtures/foo_foo.rb
102
- - spec/fixtures/foo_foo_caller.rb
93
+ - spec/live_testing/foo_foo_caller.rb
94
+ - spec/spec.opts
103
95
  - spec/spec_helper.rb
104
96
  - spec/who_called_me_spec.rb
data/README.rdoc DELETED
@@ -1,17 +0,0 @@
1
- = who_called_me
2
-
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 Alain Ravet. See LICENSE for details.
@@ -1,25 +0,0 @@
1
- module WhoCalledMe
2
- module ArrayUtils
3
-
4
- def self.first_elements_with_common_prefix(arr, pre_len_to_ignore=0)
5
- arr.each_index do |i|
6
- # exclude the n first characters from the comparison <- remove them
7
- arr[i] = arr[i][pre_len_to_ignore..-1]
8
- end
9
-
10
- [].tap do |results|
11
- first_line = arr.first
12
- results << first_line
13
- (0..arr.length-2).each do |i|
14
- line, next_line = arr[i], arr[i+1]
15
-
16
- next_line_not_in_same_code_tree = !StringUtils.common_substring?(line, next_line)
17
- next_line_not_in_same_code_tree ?
18
- break :
19
- (results << next_line)
20
- end
21
- end
22
- end
23
-
24
- end
25
- end
@@ -1,11 +0,0 @@
1
- module WhoCalledMe
2
- module TraceUtils
3
-
4
- def self.fulltrace
5
- raise
6
- rescue
7
- $!.backtrace
8
- end
9
-
10
- end
11
- end
@@ -1,4 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/foo_foo')
2
- FooFoo.new.foofoo
3
- FooFoo.point_1
4
- Foo.point_1