trace_viewer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,7 +1,5 @@
1
+ Manifest
1
2
  Rakefile
2
3
  lib/trace_viewer.rb
3
4
  lib/trace_viewer/line_detail.rb
4
5
  lib/views/index.html.haml
5
- spec/spec_helper.rb
6
- spec/trace_viewer/trace_viewer_spec.rb
7
- Manifest
data/Rakefile CHANGED
@@ -2,11 +2,11 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('trace_viewer', '0.0.1') do |p|
6
- p.description = "Launches your web browser to view the functions in a stack trace in chronological order"
5
+ Echoe.new('trace_viewer', '0.0.2') do |p|
6
+ p.description = "Launches your web browser to view the functions of a stack trace in chronological order"
7
7
  p.url = "http://github.com/cj2/trace_viewer"
8
- p.author = "Chris Young"
9
- p.email = "beesucker @nospam@ gmail.com"
10
- p.ignore_pattern = ["tmp/*", "script/*"]
8
+ p.author = "Charles Grimes"
9
+ p.email = "cjgrimes@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*", "spec/**/*"]
11
11
  p.development_dependencies = []
12
12
  end
data/lib/trace_viewer.rb CHANGED
@@ -5,7 +5,7 @@ require 'trace_viewer/line_detail'
5
5
 
6
6
  module TraceViewer
7
7
  class << self
8
- def run
8
+ def run()
9
9
  trace = load_and_parse_trace
10
10
  loaded_trace = map_trace_to_line_details(trace)
11
11
  html = build_html(loaded_trace)
@@ -35,9 +35,15 @@ module TraceViewer
35
35
 
36
36
  def load_and_parse_trace
37
37
  trace_lines = filtered_trace
38
- trace_lines.map do |line|
38
+ mapped_lines = trace_lines.map {|line|
39
39
  parse_trace_line(line)
40
+ }.select {|line|
41
+ line.size == 2
42
+ }
43
+ mapped_lines.each do |line|
44
+ p line
40
45
  end
46
+ mapped_lines
41
47
  end
42
48
 
43
49
  def map_trace_to_line_details(parsed_trace)
@@ -58,7 +64,7 @@ module TraceViewer
58
64
 
59
65
  def filtered_trace
60
66
  caller.select {|line|
61
- # line !~ /\/trace_viewer\// &&
67
+ line !~ /\/trace_viewer/ &&
62
68
  line !~ /\/rspec/
63
69
  }
64
70
  end
@@ -74,6 +80,7 @@ module TraceViewer
74
80
  end
75
81
 
76
82
  def load_function(filename,line_number)
83
+ puts "loading parse tree for #{filename}"
77
84
  lines = File.read(filename)
78
85
  parser=RedParse.new(lines)
79
86
  tree=parser.parse
@@ -1,46 +1,18 @@
1
1
  %script(type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js")
2
2
 
3
3
  :css
4
- body {
5
- font-size: 14px;
6
- }
7
- a {
8
- text-decoration: none;
9
- color: #000;
10
- }
4
+ body { font-size: 14px; }
5
+ a { text-decoration: none; color: #000; }
11
6
  .clear { clear: both; }
12
7
 
13
- #controls ul {
14
- margin: 20px 0 20px 10px;
15
- font-size: 16px;
16
- list-style-type: none;
17
- padding: 0px;
18
- }
19
- #controls li {
20
- float: left; margin: 0 30px 10px 0; padding: 0;
21
- }
22
- .box, #controls {
23
- margin: auto;
24
- width: 1000px;
25
- }
26
- .box {
27
- border: 1px dashed #000;
28
- margin-bottom: 15px;
29
- }
30
- .filename {
31
- padding: 5px 10px;
32
- background-color: #eef;
33
- }
34
- .line_numbers {
35
- float: left;
36
- background-color: #eee;
37
- }
38
- .code, .line_numbers {
39
- padding: 0px 10px;
40
- }
41
- .code {
42
- overflow: hidden;
43
- }
8
+ #controls ul { margin: 20px 0 20px 10px; font-size: 16px; list-style-type: none; padding: 0px; }
9
+ #controls li { float: left; margin: 0 30px 10px 0; padding: 0; }
10
+ .box, #controls { margin: auto; width: 1000px; }
11
+ .box { border: 1px dashed #000; margin-bottom: 15px; }
12
+ .filename { padding: 5px 10px; background-color: #eef; }
13
+ .line_numbers { float: left; background-color: #eee; }
14
+ .code, .line_numbers { padding: 0px 10px; }
15
+ .code { overflow: hidden; }
44
16
 
45
17
  #controls
46
18
  %ul
data/trace_viewer.gemspec CHANGED
@@ -2,21 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{trace_viewer}
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Chris Young"]
8
+ s.authors = ["Charles Grimes"]
9
9
  s.date = %q{2010-10-18}
10
- s.description = %q{Launches your web browser to view the functions in a stack trace in chronological order}
11
- s.email = %q{beesucker @nospam@ gmail.com}
10
+ s.description = %q{Launches your web browser to view the functions of a stack trace in chronological order}
11
+ s.email = %q{cjgrimes@gmail.com}
12
12
  s.extra_rdoc_files = ["lib/trace_viewer.rb", "lib/trace_viewer/line_detail.rb", "lib/views/index.html.haml"]
13
- s.files = ["Rakefile", "lib/trace_viewer.rb", "lib/trace_viewer/line_detail.rb", "lib/views/index.html.haml", "spec/spec_helper.rb", "spec/trace_viewer/trace_viewer_spec.rb", "Manifest", "trace_viewer.gemspec"]
13
+ s.files = ["Manifest", "Rakefile", "lib/trace_viewer.rb", "lib/trace_viewer/line_detail.rb", "lib/views/index.html.haml", "trace_viewer.gemspec"]
14
14
  s.homepage = %q{http://github.com/cj2/trace_viewer}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Trace_viewer"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{trace_viewer}
18
18
  s.rubygems_version = %q{1.3.7}
19
- s.summary = %q{Launches your web browser to view the functions in a stack trace in chronological order}
19
+ s.summary = %q{Launches your web browser to view the functions of a stack trace in chronological order}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
metadata CHANGED
@@ -5,11 +5,11 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
- - Chris Young
12
+ - Charles Grimes
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
@@ -18,8 +18,8 @@ date: 2010-10-18 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: Launches your web browser to view the functions in a stack trace in chronological order
22
- email: beesucker @nospam@ gmail.com
21
+ description: Launches your web browser to view the functions of a stack trace in chronological order
22
+ email: cjgrimes@gmail.com
23
23
  executables: []
24
24
 
25
25
  extensions: []
@@ -29,13 +29,11 @@ extra_rdoc_files:
29
29
  - lib/trace_viewer/line_detail.rb
30
30
  - lib/views/index.html.haml
31
31
  files:
32
+ - Manifest
32
33
  - Rakefile
33
34
  - lib/trace_viewer.rb
34
35
  - lib/trace_viewer/line_detail.rb
35
36
  - lib/views/index.html.haml
36
- - spec/spec_helper.rb
37
- - spec/trace_viewer/trace_viewer_spec.rb
38
- - Manifest
39
37
  - trace_viewer.gemspec
40
38
  has_rdoc: true
41
39
  homepage: http://github.com/cj2/trace_viewer
@@ -72,6 +70,6 @@ rubyforge_project: trace_viewer
72
70
  rubygems_version: 1.3.7
73
71
  signing_key:
74
72
  specification_version: 3
75
- summary: Launches your web browser to view the functions in a stack trace in chronological order
73
+ summary: Launches your web browser to view the functions of a stack trace in chronological order
76
74
  test_files: []
77
75
 
data/spec/spec_helper.rb DELETED
@@ -1,88 +0,0 @@
1
- unless $spec_helper_loaded
2
- $spec_helper_loaded = true
3
-
4
- $LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
5
- SPEC_TMP_DIR = File.expand_path('tmp', File.dirname(__FILE__))
6
- require 'spork'
7
- require 'stringio'
8
- require 'fileutils'
9
- require 'rspec'
10
- require 'trace_viewer'
11
-
12
- RSpec.configure do |config|
13
- config.before(:each) do
14
- $test_stdout = StringIO.new
15
- $test_stderr = StringIO.new
16
- @current_dir = nil
17
- end
18
-
19
- config.after(:each) do
20
- FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)
21
-
22
- end
23
-
24
- def create_file(filename, contents)
25
- FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)
26
-
27
- in_current_dir do
28
- FileUtils.mkdir_p(File.dirname(filename))
29
- File.open(filename, 'wb') { |f| f << contents }
30
- end
31
- end
32
-
33
- def create_helper_file(test_framework = FakeFramework)
34
- create_file(test_framework.helper_file, "# stub spec helper file")
35
- end
36
-
37
- def in_current_dir(&block)
38
- Dir.chdir(current_dir, &block)
39
- end
40
-
41
- def current_dir
42
- @current_dir ||= SPEC_TMP_DIR
43
- end
44
-
45
- def change_current_dir(sub_path)
46
- @current_dir = File.expand_path(sub_path, SPEC_TMP_DIR)
47
- end
48
-
49
- def windows?
50
- ENV['OS'] == 'Windows_NT'
51
- end
52
- end
53
-
54
-
55
- module RSpec
56
- module Matchers
57
- class IncludeAStringLike
58
- def initialize(substring_or_regex)
59
- case substring_or_regex
60
- when String
61
- @regex = Regexp.new(Regexp.escape(substring_or_regex))
62
- when Regexp
63
- @regex = substring_or_regex
64
- else
65
- raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
66
- end
67
- end
68
-
69
- def matches?(list_of_strings)
70
- @list_of_strings = list_of_strings
71
- @list_of_strings.any? { |s| s =~ @regex }
72
- end
73
- def failure_message
74
- "#{@list_of_strings.inspect} expected to include a string like #{@regex.inspect}"
75
- end
76
- def negative_failure_message
77
- "#{@list_of_strings.inspect} expected to not include a string like #{@regex.inspect}, but did"
78
- end
79
- end
80
-
81
- def include_a_string_like(substring_or_regex)
82
- IncludeAStringLike.new(substring_or_regex)
83
- end
84
- end
85
- end
86
-
87
- Dir.glob(File.dirname(__FILE__) + "/support/*.rb").each { |f| require(f) }
88
- end
@@ -1,10 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe TraceViewer do
4
- describe "run" do
5
- TraceViewer.run
6
- end
7
-
8
- describe "load_and_parse_trace" do
9
- end
10
- end