code_buddy 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/Gemfile.lock +3 -3
  2. data/code_buddy.gemspec +1 -1
  3. data/lib/code_buddy/app.rb +12 -5
  4. data/lib/code_buddy/middleware.rb +10 -41
  5. data/lib/code_buddy/rails2/monkey_patch_action_controller.rb +19 -0
  6. data/lib/code_buddy/rails2/templates/rescues/_request_and_response.erb +24 -0
  7. data/lib/code_buddy/rails2/templates/rescues/_trace.erb +26 -0
  8. data/lib/code_buddy/rails2/templates/rescues/diagnostics.erb +11 -0
  9. data/lib/code_buddy/rails2/templates/rescues/layout.erb +29 -0
  10. data/lib/code_buddy/{templates → rails2/templates}/rescues/missing_template.erb +0 -0
  11. data/lib/code_buddy/{templates → rails2/templates}/rescues/routing_error.erb +0 -0
  12. data/lib/code_buddy/rails2/templates/rescues/template_error.erb +21 -0
  13. data/lib/code_buddy/{templates → rails2/templates}/rescues/unknown_action.erb +0 -0
  14. data/lib/code_buddy/rails3/railtie.rb +22 -0
  15. data/lib/code_buddy/{templates → rails3/templates}/rescues/_request_and_response.erb +0 -0
  16. data/lib/code_buddy/{templates → rails3/templates}/rescues/_trace.erb +1 -1
  17. data/lib/code_buddy/{templates → rails3/templates}/rescues/diagnostics.erb +0 -0
  18. data/lib/code_buddy/{templates → rails3/templates}/rescues/layout.erb +0 -0
  19. data/lib/code_buddy/rails3/templates/rescues/missing_template.erb +2 -0
  20. data/lib/code_buddy/rails3/templates/rescues/routing_error.erb +10 -0
  21. data/lib/code_buddy/{templates → rails3/templates}/rescues/template_error.erb +0 -0
  22. data/lib/code_buddy/rails3/templates/rescues/unknown_action.erb +2 -0
  23. data/lib/code_buddy/version.rb +1 -1
  24. data/lib/code_buddy/views/banner.erb +2 -2
  25. data/lib/code_buddy/views/form.erb +1 -1
  26. data/lib/code_buddy/views/header.erb +5 -5
  27. data/lib/code_buddy/views/index.erb +1 -1
  28. data/lib/code_buddy.rb +14 -1
  29. data/spec/middleware_spec.rb +13 -8
  30. data/spec/spec_helper.rb +5 -0
  31. metadata +23 -35
  32. data/lib/code_buddy/views/orig.erb +0 -53
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code_buddy (0.0.2)
4
+ code_buddy (0.0.3)
5
5
  coderay (~> 0.9.6)
6
6
  json_pure (~> 1.4.6)
7
- rack (~> 1.2.0)
7
+ rack
8
8
  sinatra (~> 1.1.0)
9
9
 
10
10
  GEM
@@ -38,7 +38,7 @@ DEPENDENCIES
38
38
  coderay (~> 0.9.6)
39
39
  json_pure (~> 1.4.6)
40
40
  mocha (~> 0.9.10)
41
- rack (~> 1.2.0)
41
+ rack
42
42
  rake (~> 0.8.7)
43
43
  rspec (~> 2.2.0)
44
44
  sinatra (~> 1.1.0)
data/code_buddy.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency 'rack', '~> 1.2.0'
22
+ s.add_dependency 'rack'
23
23
  s.add_dependency 'sinatra', '~> 1.1.0'
24
24
  s.add_dependency 'json_pure', '~> 1.4.6'
25
25
  s.add_dependency 'coderay', '~> 0.9.6'
@@ -5,9 +5,11 @@ module CodeBuddy
5
5
 
6
6
  class << self
7
7
  attr_reader :stack
8
+ attr_reader :rails
8
9
 
9
10
  def exception=(exception)
10
11
  @stack = Stack.new(exception)
12
+ @rails = true
11
13
  end
12
14
 
13
15
  def stack_string=(stack_string)
@@ -16,23 +18,24 @@ module CodeBuddy
16
18
  end
17
19
 
18
20
  get '/' do
19
- display_stack(0)
21
+ redirect "#{rails_prefix}/stack"
20
22
  end
21
23
 
22
24
  get '/new' do
23
25
  erb :form
24
26
  end
25
27
 
26
- post '/' do
28
+ post '/new' do
27
29
  self.class.stack_string = params[:stack]
28
- redirect '/'
30
+ redirect "#{rails_prefix}/stack"
29
31
  end
30
32
 
31
33
  get '/stack' do
32
34
  display_stack(0)
33
35
  end
34
36
 
35
- get '/:selected' do
37
+ get '/stack/:selected' do
38
+ @static_file_prefix = '../'
36
39
  display_stack(params[:selected].to_i)
37
40
  end
38
41
 
@@ -42,9 +45,13 @@ module CodeBuddy
42
45
  @stack.selected = selected_param
43
46
  erb :index
44
47
  else
45
- redirect '/new'
48
+ redirect "#{rails_prefix}/new"
46
49
  end
47
50
  end
48
51
 
52
+ def rails_prefix
53
+ self.class.rails ? '/code_buddy' : ''
54
+ end
55
+
49
56
  end
50
57
  end
@@ -1,47 +1,16 @@
1
- def rails_loaded
2
- Module.const_get('Rails')
3
- return true
4
- rescue NameError
5
- return false
6
- end
7
-
8
- if rails_loaded
9
- module CodeBuddy
10
- class Railtie < Rails::Railtie
11
- initializer "code_buddy.add_middleware" do |app|
12
- if app.config.action_dispatch.show_exceptions
13
- app.middleware.swap ActionDispatch::ShowExceptions, CodeBuddy::ShowExceptions
14
- end
15
- end
1
+ module CodeBuddy
2
+ class ShowApp
3
+ def initialize(app)
4
+ @app = app
16
5
  end
17
6
 
18
- class ShowExceptions < ActionDispatch::ShowExceptions
19
-
20
- CODEBUDDY_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates')
21
-
22
- def call(env)
23
- if env['PATH_INFO'] =~ /^\/code_buddy(.*)/
24
- env['PATH_INFO'] = $1
25
- App.new.call(env)
26
- else
27
- super
28
- end
29
- end
30
-
31
- def rescue_action_locally(request, exception)
32
- template = ActionView::Base.new([CODEBUDDY_TEMPLATE_PATH],
33
- :request => request,
34
- :exception => exception,
35
- :application_trace => application_trace(exception),
36
- :framework_trace => framework_trace(exception),
37
- :full_trace => full_trace(exception)
38
- )
39
- file = "rescues/#{@@rescue_templates[exception.class.name]}.erb"
40
- body = template.render(:file => file, :layout => 'rescues/layout.erb')
41
- App.exception = exception
42
- render(status_code(exception), body)
7
+ def call(env)
8
+ if env['PATH_INFO'] =~ /^\/code_buddy(.*)/
9
+ env['PATH_INFO'] = $1
10
+ App.new.call(env)
11
+ else
12
+ @app.call(env)
43
13
  end
44
-
45
14
  end
46
15
  end
47
16
  end
@@ -0,0 +1,19 @@
1
+ # For Rails 2.3.x we need to monkey patch action controller to alter the exception templates
2
+
3
+ module ActionController
4
+ class Base
5
+ silence_warnings do
6
+ ActionController::Base::RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates')
7
+ end
8
+ def rescue_action_locally(exception)
9
+ CodeBuddy::App.exception = exception
10
+ code_buddy_rescue_templates_path = ActionView::Template::EagerPath.new_and_loaded(File.join(File.dirname(__FILE__), "templates"))
11
+ @template.instance_variable_set("@exception", exception)
12
+ @template.instance_variable_set("@rescues_path", code_buddy_rescue_templates_path)
13
+ @template.instance_variable_set("@contents",
14
+ @template.render(:file => template_path_for_local_rescue(exception)))
15
+ response.content_type = Mime::HTML
16
+ render_for_file(rescues_path("layout"), response_code_for_rescue(exception))
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ <% unless @exception.blamed_files.blank? %>
2
+ <% if (hide = @exception.blamed_files.length > 8) %>
3
+ <a href="#" onclick="document.getElementById('blame_trace').style.display='block'; return false;">Show blamed files</a>
4
+ <% end %>
5
+ <pre id="blame_trace" <%='style="display:none"' if hide %>><code><%=h @exception.describe_blame %></code></pre>
6
+ <% end %>
7
+
8
+ <%
9
+ clean_params = request.parameters.clone
10
+ clean_params.delete("action")
11
+ clean_params.delete("controller")
12
+
13
+ request_dump = clean_params.empty? ? 'None' : clean_params.inspect.gsub(',', ",\n")
14
+ %>
15
+
16
+ <h2 style="margin-top: 30px">Request</h2>
17
+ <p><b>Parameters</b>: <pre><%=h request_dump %></pre></p>
18
+
19
+ <p><a href="#" onclick="document.getElementById('session_dump').style.display='block'; return false;">Show session dump</a></p>
20
+ <div id="session_dump" style="display:none"><%= debug(request.session.instance_variable_get("@data")) %></div>
21
+
22
+
23
+ <h2 style="margin-top: 30px">Response</h2>
24
+ <p><b>Headers</b>: <pre><%=h response ? response.headers.inspect.gsub(',', ",\n") : 'None' %></pre></p>
@@ -0,0 +1,26 @@
1
+ <%
2
+ traces = [
3
+ ["Application Trace", @exception.application_backtrace],
4
+ ["Framework Trace", @exception.framework_backtrace],
5
+ ["Full Trace", @exception.clean_backtrace]
6
+ ]
7
+ names = traces.collect {|name, trace| name}
8
+ %>
9
+
10
+ <p><code>RAILS_ROOT: <%= defined?(RAILS_ROOT) ? RAILS_ROOT : "unset" %></code></p>
11
+
12
+ <div id="traces">
13
+ <% names.each do |name| %>
14
+ <%
15
+ show = "document.getElementById('#{name.gsub /\s/, '-'}').style.display='block';"
16
+ hide = (names - [name]).collect {|hide_name| "document.getElementById('#{hide_name.gsub /\s/, '-'}').style.display='none';"}
17
+ %>
18
+ <a href="#" onclick="<%= hide.join %><%= show %>; return false;"><%= name %></a> <%= '|' unless names.last == name %>
19
+ <% end %>
20
+
21
+ <% traces.each do |name, trace| %>
22
+ <div id="<%= name.gsub /\s/, '-' %>" style="display: <%= name == "Application Trace" ? 'block' : 'none' %>;">
23
+ <pre><code><%= trace.enum_with_index.collect { |line, index| link_to line, "code_buddy/stack/#{index}" }.join("\n").html_safe -%></code></pre>
24
+ </div>
25
+ <% end %>
26
+ </div>
@@ -0,0 +1,11 @@
1
+ <h1>
2
+ <%=h @exception.class.to_s %>
3
+ <% if request.parameters['controller'] %>
4
+ in <%=h request.parameters['controller'].humanize %>Controller<% if request.parameters['action'] %>#<%=h request.parameters['action'] %><% end %>
5
+ <% end %>
6
+ </h1>
7
+ <pre><%=h @exception.clean_message %></pre>
8
+
9
+ <%= render :file => @rescues_path["rescues/_trace.erb"] %>
10
+
11
+ <%= render :file => @rescues_path["rescues/_request_and_response.erb"] %>
@@ -0,0 +1,29 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml">
2
+ <head>
3
+ <title>Action Controller: Exception caught</title>
4
+ <style>
5
+ body { background-color: #fff; color: #333; }
6
+
7
+ body, p, ol, ul, td {
8
+ font-family: verdana, arial, helvetica, sans-serif;
9
+ font-size: 13px;
10
+ line-height: 18px;
11
+ }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px;
17
+ }
18
+
19
+ a { color: #000; }
20
+ a:visited { color: #666; }
21
+ a:hover { color: #fff; background-color:#000; }
22
+ </style>
23
+ </head>
24
+ <body>
25
+
26
+ <%= @contents %>
27
+
28
+ </body>
29
+ </html>
@@ -0,0 +1,21 @@
1
+ <h1>
2
+ <%=h @exception.original_exception.class.to_s %> in
3
+ <%=h request.parameters["controller"].capitalize if request.parameters["controller"]%>#<%=h request.parameters["action"] %>
4
+ </h1>
5
+
6
+ <p>
7
+ Showing <i><%=h @exception.file_name %></i> where line <b>#<%=h @exception.line_number %></b> raised:
8
+ <pre><code><%=h @exception.message %></code></pre>
9
+ </p>
10
+
11
+ <p>Extracted source (around line <b>#<%=h @exception.line_number %></b>):
12
+ <pre><code><%=h @exception.source_extract %></code></pre></p>
13
+
14
+ <p><%=h @exception.sub_template_message %></p>
15
+
16
+ <% @real_exception = @exception
17
+ @exception = @exception.original_exception || @exception %>
18
+ <%= render :file => @rescues_path["rescues/_trace.erb"] %>
19
+ <% @exception = @real_exception %>
20
+
21
+ <%= render :file => @rescues_path["rescues/_request_and_response.erb"] %>
@@ -0,0 +1,22 @@
1
+ module CodeBuddy
2
+ class Railtie < Rails::Railtie
3
+ initializer "code_buddy.add_middleware" do |app|
4
+ if app.config.action_dispatch.show_exceptions
5
+ app.middleware.swap ActionDispatch::ShowExceptions, CodeBuddy::ShowExceptions
6
+ app.middleware.use CodeBuddy::ShowApp
7
+ end
8
+ end
9
+ end
10
+
11
+ class ShowExceptions < ActionDispatch::ShowExceptions
12
+
13
+ silence_warnings do
14
+ ActionDispatch::ShowExceptions::RESCUES_TEMPLATE_PATH = File.join(File.dirname(__FILE__), 'templates')
15
+ end
16
+
17
+ def rescue_action_locally(request, exception)
18
+ App.exception = exception
19
+ super
20
+ end
21
+ end
22
+ end
@@ -20,7 +20,7 @@
20
20
 
21
21
  <% traces.each do |name, trace| %>
22
22
  <div id="<%= name.gsub /\s/, '-' %>" style="display: <%= name == "Application Trace" ? 'block' : 'none' %>;">
23
- <pre><code><%= trace.enum_with_index.collect { |line, index| link_to line, "code_buddy/#{index}" }.join("\n").html_safe -%></code></pre>
23
+ <pre><code><%= trace.enum_with_index.collect { |line, index| link_to line, "code_buddy/stack/#{index}" }.join("\n").html_safe -%></code></pre>
24
24
  </div>
25
25
  <% end %>
26
26
  </div>
@@ -0,0 +1,2 @@
1
+ <h1>Template is missing</h1>
2
+ <p><%=h @exception.message %></p>
@@ -0,0 +1,10 @@
1
+ <h1>Routing Error</h1>
2
+ <p><pre><%=h @exception.message %></pre></p>
3
+ <% unless @exception.failures.empty? %><p>
4
+ <h2>Failure reasons:</h2>
5
+ <ol>
6
+ <% @exception.failures.each do |route, reason| %>
7
+ <li><code><%=h route.inspect.gsub('\\', '') %></code> failed because <%=h reason.downcase %></li>
8
+ <% end %>
9
+ </ol>
10
+ </p><% end %>
@@ -0,0 +1,2 @@
1
+ <h1>Unknown action</h1>
2
+ <p><%=h @exception.message %></p>
@@ -1,3 +1,3 @@
1
1
  module CodeBuddy
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  <div class="banner">
2
- <div class="item"><img src="images/buddy.jpeg" class="buddy"/></div>
2
+ <div class="item"><img src="<%= @static_file_prefix %>images/buddy.jpeg" class="buddy"/></div>
3
3
  <div class="item"><span class="title">CodeBuddy</span><br/>a friendly place to see your code</div>
4
4
  <div class="link"><a href="http://github.com/patshaughnessy/code_buddy">about</a></div>
5
- <div class="link"><a href="new">paste stack</a></div>
5
+ <div class="link"><a href="<%= @static_file_prefix %>new">paste stack</a></div>
6
6
  </div>
@@ -4,7 +4,7 @@
4
4
  <%= erb :banner %>
5
5
  <div class="form">
6
6
  Paste your stack:
7
- <form action="/" method="post">
7
+ <form method="post">
8
8
  <textarea name="stack" rows="40" cols="130" class="stack_form"></textarea><br/>
9
9
  <input type="submit" value="submit"/>
10
10
  </form>
@@ -1,8 +1,8 @@
1
1
  <head>
2
2
  <title>Code Buddy</title>
3
- <link href="stylesheets/code_buddy.css" media="screen" rel="stylesheet" type="text/css" />
4
- <link href="stylesheets/coderay.css" media="screen" rel="stylesheet" type="text/css" />
5
- <script src="javascripts/jquery.js" type="text/javascript"></script>
6
- <script src="javascripts/underscore.js" type="text/javascript"></script>
7
- <script src="javascripts/backbone.js" type="text/javascript"></script>
3
+ <link href="<%= @static_file_prefix %>stylesheets/code_buddy.css" media="screen" rel="stylesheet" type="text/css" />
4
+ <link href="<%= @static_file_prefix %>stylesheets/coderay.css" media="screen" rel="stylesheet" type="text/css" />
5
+ <script src="<%= @static_file_prefix %>javascripts/jquery.js" type="text/javascript"></script>
6
+ <script src="<%= @static_file_prefix %>javascripts/underscore.js" type="text/javascript"></script>
7
+ <script src="<%= @static_file_prefix %>javascripts/backbone.js" type="text/javascript"></script>
8
8
  </head>
@@ -12,7 +12,7 @@
12
12
  </div>
13
13
  <ul id="stack"></ul>
14
14
  <div id='code'></div>
15
- <script src="javascripts/code_buddy.js" type="text/javascript"></script>
15
+ <script src="<%= @static_file_prefix %>javascripts/code_buddy.js" type="text/javascript"></script>
16
16
  <script>
17
17
  var stack = new Stack(<%= @stack.to_json %>);
18
18
  var stackView = new StackView({model: stack});
data/lib/code_buddy.rb CHANGED
@@ -3,7 +3,20 @@ require 'coderay'
3
3
  require 'json'
4
4
  require 'json/add/rails'
5
5
 
6
- require 'code_buddy/middleware'
7
6
  require 'code_buddy/app'
8
7
  require 'code_buddy/stack'
9
8
  require 'code_buddy/stack_frame'
9
+ require 'code_buddy/middleware'
10
+
11
+ def rails_version
12
+ Rails::VERSION::MAJOR
13
+ rescue NameError
14
+ nil
15
+ end
16
+
17
+ case rails_version
18
+ when 2:
19
+ require 'code_buddy/rails2/monkey_patch_action_controller'
20
+ when 3:
21
+ require 'code_buddy/rails3/railtie.rb'
22
+ end
@@ -1,36 +1,41 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe CodeBuddy::ShowExceptions do
4
- subject { CodeBuddy::ShowExceptions.new }
4
+ let (:app) { mock }
5
+ subject { CodeBuddy::ShowApp.new(app) }
5
6
 
6
7
  describe 'Non code_buddy URLs' do
7
8
  it 'should not call the Sinatra app when a non code_buddy URL is found' do
8
9
  CodeBuddy::App.expects(:new).never
9
10
  env = { 'PATH_INFO' => '/some_other_path' }
11
+ app.expects(:call).with(env)
10
12
  subject.call(env)
11
13
  end
12
14
 
13
15
  it 'should not call the Sinatra app when code_buddy is found later in the URL' do
14
16
  CodeBuddy::App.expects(:new).never
15
17
  env = { 'PATH_INFO' => '/some_other_path/code_buddy' }
18
+ app.expects(:call).with(env)
16
19
  subject.call(env)
17
20
  end
18
21
  end
19
22
 
20
23
  describe 'code_buddy URLs' do
21
24
  it 'should call the Sinatra app when a code_buddy URL is found and pass in the remaining path only' do
22
- app = mock
23
- CodeBuddy::App.expects(:new).returns(app)
24
- app.expects(:call).with({ 'PATH_INFO' => '/12' })
25
+ code_buddy_app = mock
26
+ CodeBuddy::App.expects(:new).returns(code_buddy_app)
27
+ code_buddy_app.expects(:call).with({ 'PATH_INFO' => '/12' })
25
28
  env = { 'PATH_INFO' => '/code_buddy/12' }
29
+ app.expects(:new).never
26
30
  subject.call(env)
27
31
  end
28
32
 
29
- it 'should call the Sinatra app when a code_buddy URL is found and pass in the remaining path only' do
30
- app = mock
31
- CodeBuddy::App.expects(:new).returns(app)
32
- app.expects(:call).with({ 'PATH_INFO' => '' })
33
+ it 'should call the Sinatra app with a null path when the code_buddy root URL is found' do
34
+ code_buddy_app = mock
35
+ CodeBuddy::App.expects(:new).returns(code_buddy_app)
36
+ code_buddy_app.expects(:call).with({ 'PATH_INFO' => '' })
33
37
  env = { 'PATH_INFO' => '/code_buddy' }
38
+ app.expects(:new).never
34
39
  subject.call(env)
35
40
  end
36
41
  end
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,9 @@ module Rails
8
8
  class Railtie
9
9
  def self.initializer(name); end
10
10
  end
11
+ class VERSION
12
+ MAJOR = 3
13
+ end
11
14
  end
12
15
  module ActionDispatch
13
16
  class ShowExceptions
@@ -15,6 +18,8 @@ module ActionDispatch
15
18
  end
16
19
  end
17
20
 
21
+ def silence_warnings; end
22
+
18
23
  require 'code_buddy'
19
24
 
20
25
  # Requires supporting ruby files with custom matchers and macros, etc,
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_buddy
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 2
10
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Pat Shaughnessy, Alex Rothenberg, Daniel Higginbotham
@@ -22,27 +21,21 @@ dependencies:
22
21
  name: rack
23
22
  prerelease: false
24
23
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
24
  requirements:
27
- - - ~>
25
+ - - ">="
28
26
  - !ruby/object:Gem::Version
29
- hash: 31
30
27
  segments:
31
- - 1
32
- - 2
33
28
  - 0
34
- version: 1.2.0
29
+ version: "0"
35
30
  type: :runtime
36
31
  version_requirements: *id001
37
32
  - !ruby/object:Gem::Dependency
38
33
  name: sinatra
39
34
  prerelease: false
40
35
  requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
36
  requirements:
43
37
  - - ~>
44
38
  - !ruby/object:Gem::Version
45
- hash: 19
46
39
  segments:
47
40
  - 1
48
41
  - 1
@@ -54,11 +47,9 @@ dependencies:
54
47
  name: json_pure
55
48
  prerelease: false
56
49
  requirement: &id003 !ruby/object:Gem::Requirement
57
- none: false
58
50
  requirements:
59
51
  - - ~>
60
52
  - !ruby/object:Gem::Version
61
- hash: 11
62
53
  segments:
63
54
  - 1
64
55
  - 4
@@ -70,11 +61,9 @@ dependencies:
70
61
  name: coderay
71
62
  prerelease: false
72
63
  requirement: &id004 !ruby/object:Gem::Requirement
73
- none: false
74
64
  requirements:
75
65
  - - ~>
76
66
  - !ruby/object:Gem::Version
77
- hash: 55
78
67
  segments:
79
68
  - 0
80
69
  - 9
@@ -86,11 +75,9 @@ dependencies:
86
75
  name: rake
87
76
  prerelease: false
88
77
  requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
78
  requirements:
91
79
  - - ~>
92
80
  - !ruby/object:Gem::Version
93
- hash: 49
94
81
  segments:
95
82
  - 0
96
83
  - 8
@@ -102,11 +89,9 @@ dependencies:
102
89
  name: rspec
103
90
  prerelease: false
104
91
  requirement: &id006 !ruby/object:Gem::Requirement
105
- none: false
106
92
  requirements:
107
93
  - - ~>
108
94
  - !ruby/object:Gem::Version
109
- hash: 7
110
95
  segments:
111
96
  - 2
112
97
  - 2
@@ -118,11 +103,9 @@ dependencies:
118
103
  name: mocha
119
104
  prerelease: false
120
105
  requirement: &id007 !ruby/object:Gem::Requirement
121
- none: false
122
106
  requirements:
123
107
  - - ~>
124
108
  - !ruby/object:Gem::Version
125
- hash: 47
126
109
  segments:
127
110
  - 0
128
111
  - 9
@@ -159,22 +142,31 @@ files:
159
142
  - lib/code_buddy/public/javascripts/underscore.js
160
143
  - lib/code_buddy/public/stylesheets/code_buddy.css
161
144
  - lib/code_buddy/public/stylesheets/coderay.css
145
+ - lib/code_buddy/rails2/monkey_patch_action_controller.rb
146
+ - lib/code_buddy/rails2/templates/rescues/_request_and_response.erb
147
+ - lib/code_buddy/rails2/templates/rescues/_trace.erb
148
+ - lib/code_buddy/rails2/templates/rescues/diagnostics.erb
149
+ - lib/code_buddy/rails2/templates/rescues/layout.erb
150
+ - lib/code_buddy/rails2/templates/rescues/missing_template.erb
151
+ - lib/code_buddy/rails2/templates/rescues/routing_error.erb
152
+ - lib/code_buddy/rails2/templates/rescues/template_error.erb
153
+ - lib/code_buddy/rails2/templates/rescues/unknown_action.erb
154
+ - lib/code_buddy/rails3/railtie.rb
155
+ - lib/code_buddy/rails3/templates/rescues/_request_and_response.erb
156
+ - lib/code_buddy/rails3/templates/rescues/_trace.erb
157
+ - lib/code_buddy/rails3/templates/rescues/diagnostics.erb
158
+ - lib/code_buddy/rails3/templates/rescues/layout.erb
159
+ - lib/code_buddy/rails3/templates/rescues/missing_template.erb
160
+ - lib/code_buddy/rails3/templates/rescues/routing_error.erb
161
+ - lib/code_buddy/rails3/templates/rescues/template_error.erb
162
+ - lib/code_buddy/rails3/templates/rescues/unknown_action.erb
162
163
  - lib/code_buddy/stack.rb
163
164
  - lib/code_buddy/stack_frame.rb
164
- - lib/code_buddy/templates/rescues/_request_and_response.erb
165
- - lib/code_buddy/templates/rescues/_trace.erb
166
- - lib/code_buddy/templates/rescues/diagnostics.erb
167
- - lib/code_buddy/templates/rescues/layout.erb
168
- - lib/code_buddy/templates/rescues/missing_template.erb
169
- - lib/code_buddy/templates/rescues/routing_error.erb
170
- - lib/code_buddy/templates/rescues/template_error.erb
171
- - lib/code_buddy/templates/rescues/unknown_action.erb
172
165
  - lib/code_buddy/version.rb
173
166
  - lib/code_buddy/views/banner.erb
174
167
  - lib/code_buddy/views/form.erb
175
168
  - lib/code_buddy/views/header.erb
176
169
  - lib/code_buddy/views/index.erb
177
- - lib/code_buddy/views/orig.erb
178
170
  - spec/app_spec.rb
179
171
  - spec/middleware_spec.rb
180
172
  - spec/spec_helper.rb
@@ -190,27 +182,23 @@ rdoc_options: []
190
182
  require_paths:
191
183
  - lib
192
184
  required_ruby_version: !ruby/object:Gem::Requirement
193
- none: false
194
185
  requirements:
195
186
  - - ">="
196
187
  - !ruby/object:Gem::Version
197
- hash: 3
198
188
  segments:
199
189
  - 0
200
190
  version: "0"
201
191
  required_rubygems_version: !ruby/object:Gem::Requirement
202
- none: false
203
192
  requirements:
204
193
  - - ">="
205
194
  - !ruby/object:Gem::Version
206
- hash: 3
207
195
  segments:
208
196
  - 0
209
197
  version: "0"
210
198
  requirements: []
211
199
 
212
200
  rubyforge_project: code_buddy
213
- rubygems_version: 1.3.7
201
+ rubygems_version: 1.3.6
214
202
  signing_key:
215
203
  specification_version: 3
216
204
  summary: See the Ruby code running in your app.
@@ -1,53 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Code Buddy</title>
4
- <link href="stylesheets/code_buddy.css" media="screen" rel="stylesheet" type="text/css" />
5
- <link href="stylesheets/coderay.css" media="screen" rel="stylesheet" type="text/css" />
6
- <script src="javascripts/jquery.js" type="text/javascript"></script>
7
- <script src="javascripts/underscore.js" type="text/javascript"></script>
8
- <script src="javascripts/backbone.js" type="text/javascript"></script>
9
- </head>
10
- <body>
11
- <img src="images/buddy.jpeg"/>
12
- <div class="banner">
13
- <h1>CodeBuddy</h1>
14
- <h2>a friendly place to see your code</h2>
15
- </div>
16
-
17
- <div class="legend">
18
- <div>&#8593; move up the stack</div>
19
- <div>&#8595; move down the stack</div>
20
- </div>
21
-
22
- </div>
23
-
24
- <div class="code_buddy">
25
- <ul id="stack"></ul>
26
- <div id='code'></div>
27
- </div>
28
-
29
- <script src="javascripts/code_buddy.js" type="text/javascript"></script>
30
- <script>
31
-
32
- var stack = new Stack(<%= @stack.to_json %>);
33
-
34
- var stackView = new StackView({model: stack});
35
- stackView.render();
36
-
37
- // Why don't backbone events work???
38
- $(document).keydown(function(event) {
39
- var ret = stack.view.changeSelectionOnArrow(event)
40
- var offset = $(stack.selectedAddress().view.el).offset().top
41
- var windowHeight = $(window).height()
42
- if (offset > windowHeight + $(window).scrollTop()) {
43
- $('html,body').animate({scrollTop: offset - 200}, 500);
44
- } else if (offset < $(window).scrollTop()) {
45
- $('html,body').animate({scrollTop: offset - 500}, 500);
46
- }
47
- return ret;
48
- })
49
-
50
-
51
- </script>
52
- </body>
53
- </html>