fiveruns_tuneup 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.8.9. Fixed broken rendering of TuneUp stack information when serving xhtml strict pages with a content-type of application/xhtml+xml.
2
+
1
3
  v0.8.8. Fixed login broken when serving pages as xhtml strict. Filtered params logged to tuneup.log. TuneUp partials now rendered with exlicit extensions (.html.erb).
2
4
 
3
5
  v0.8.7. Sandboxed javascript for non-Prototype apps (Thanks, Howard Rauscher). The tuneup.log now written explicitly to RAILS_ROOT/log. Removed History.rdoc in favor of CHANGELOG.
@@ -1,16 +1,16 @@
1
1
 
2
- # Gem::Specification for Fiveruns_tuneup-0.8.8
2
+ # Gem::Specification for Fiveruns_tuneup-0.8.9
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{fiveruns_tuneup}
7
- s.version = "0.8.8"
7
+ s.version = "0.8.9"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["FiveRuns Development Team"]
13
- s.date = %q{2008-06-18}
13
+ s.date = %q{2008-06-27}
14
14
  s.default_executable = %q{fiveruns_tuneup}
15
15
  s.description = %q{Instrumentation for the FiveRuns TuneUp product.}
16
16
  s.email = %q{dev@fiveruns.com}
@@ -2,6 +2,14 @@ module Fiveruns::Tuneup
2
2
 
3
3
  class Configuration
4
4
 
5
+ attr_writer :log_directory
6
+ def log_directory
7
+ @log_directory ||= begin
8
+ rails_log = RAILS_DEFAULT_LOGGER.instance_eval { @log.path rescue @logdev.filename }
9
+ File.dirname(rails_log)
10
+ end
11
+ end
12
+
5
13
  def environments
6
14
  @environments ||= %w(development)
7
15
  end
@@ -15,7 +15,7 @@ module Fiveruns
15
15
  end
16
16
 
17
17
  def rails_version
18
- ::Rails::VERSION::STRING rescue 'unknown Rails version'
18
+ Fiveruns::Tuneup::Version.rails.to_s
19
19
  end
20
20
 
21
21
  def application_name
@@ -42,7 +42,12 @@ module Fiveruns
42
42
  options = args.first || {}
43
43
  path = case options
44
44
  when String
45
- "Render #{options}"
45
+ # Pre-Rails 2.1, don't record this as it causes duplicate records
46
+ if Fiveruns::Tuneup::Version.rails < Fiveruns::Tuneup::Version.new(2,1,0)
47
+ record = false
48
+ else
49
+ "Render #{options}"
50
+ end
46
51
  when :update
47
52
  name = block.to_s.split('/').last.split(':').first rescue ''
48
53
  "Render page update #{name}"
@@ -50,8 +55,13 @@ module Fiveruns
50
55
  if options[:file]
51
56
  "Render #{options[:file]}"
52
57
  elsif options[:partial]
53
- # Don't record this as it causes duplicate records
54
- record = false
58
+ # Pre-Rails 2.1, don't record this as it causes duplicate records
59
+ if Fiveruns::Tuneup::Version.rails < Fiveruns::Tuneup::Version.new(2,1,0)
60
+ record = false
61
+ else
62
+ # TODO: normalize this partial path
63
+ "Render partial #{options[:partial]}"
64
+ end
55
65
  elsif options[:inline]
56
66
  "Render inline"
57
67
  elsif options[:text]
@@ -30,11 +30,20 @@ module Fiveruns
30
30
  # +tiny+ (or +patch+) number.
31
31
  class Version
32
32
 
33
+ include Comparable
34
+
33
35
  # A convenience method for instantiating a new Version instance with the
34
36
  # given +major+, +minor+, and +tiny+ components.
35
37
  def self.[](major, minor, tiny)
36
38
  new(major, minor, tiny)
37
39
  end
40
+
41
+ def self.rails
42
+ @rails ||= begin
43
+ # handle ::Rails::VERSION not being set
44
+ Version.new(::Rails::VERSION::MAJOR, ::Rails::VERSION::MINOR, ::Rails::VERSION::TINY) rescue Version.new(0,0,0)
45
+ end
46
+ end
38
47
 
39
48
  attr_reader :major, :minor, :tiny
40
49
 
@@ -66,7 +75,7 @@ module Fiveruns
66
75
 
67
76
  MAJOR = 0
68
77
  MINOR = 8
69
- TINY = 8
78
+ TINY = 9
70
79
 
71
80
  # The current version as a Version instance
72
81
  CURRENT = new(MAJOR, MINOR, TINY)
@@ -7,9 +7,7 @@ require File.dirname(__FILE__) << '/tuneup/step'
7
7
 
8
8
  module Fiveruns
9
9
  module Tuneup
10
-
11
- LOGGER = Logger.new(File.join(RAILS_ROOT || '', "log/tuneup.log"))
12
-
10
+
13
11
  class << self
14
12
 
15
13
  include Fiveruns::Tuneup::Urls
@@ -23,6 +21,13 @@ module Fiveruns
23
21
  attr_accessor :running
24
22
  attr_reader :trend
25
23
 
24
+ def logger
25
+ @logger ||= returning Logger.new(log_file) do |l|
26
+ RAILS_DEFAULT_LOGGER.info(log_format % "Logging in #{log_file}")
27
+ l.level = Logger::INFO
28
+ end
29
+ end
30
+
26
31
  def run(controller, request)
27
32
  @running = (!controller.is_a?(TuneupController) && !request.xhr?)
28
33
  result = nil
@@ -90,10 +95,10 @@ module Fiveruns
90
95
  load_configuration_file
91
96
  if configuration.instrument?
92
97
  yield
93
- log :info, "Starting..."
94
98
  install_instrumentation
95
99
  log :debug, "Using collector at #{collector_url}"
96
100
  log :debug, "Using frontend at #{frontend_url}"
101
+ log :info, "Started."
97
102
  else
98
103
  log :warn, "Not configured to run in #{RAILS_ENV} environment, aborting."
99
104
  end
@@ -101,14 +106,22 @@ module Fiveruns
101
106
  end
102
107
 
103
108
  def log(level, text)
104
- message = "FiveRuns TuneUp (v#{Fiveruns::Tuneup::Version::STRING}): #{text}"
105
- LOGGER.send(level, message)
109
+ message = log_format % text
110
+ logger.send(level, message)
106
111
  STDERR.puts message if level == :error
107
112
  end
108
113
 
109
114
  #######
110
115
  private
111
116
  #######
117
+
118
+ def log_file
119
+ File.join(configuration.log_directory, "tuneup.log")
120
+ end
121
+
122
+ def log_format
123
+ "FiveRuns TuneUp (v#{Fiveruns::Tuneup::Version::STRING}): %s"
124
+ end
112
125
 
113
126
  def configuration_file
114
127
  File.join(RAILS_ROOT, 'config/tuneup.rb')
data/lib/tuneup_helper.rb CHANGED
@@ -83,7 +83,9 @@ module TuneupHelper #:nodoc:
83
83
  end
84
84
 
85
85
  def sql_link(step)
86
- link_to_function(image_tag('/images/tuneup/magnify.png', :alt => 'Query'), :class => 'tuneup-sql tuneup-halo', :title => 'View Query') { |p| p[dom_id(step, :sql)].toggle }
86
+ link_to_function(image_tag('/images/tuneup/magnify.png', :alt => 'Query'), :class => 'tuneup-sql tuneup-halo', :title => 'View Query') do |page|
87
+ page << %(TuneUpSandbox.$("#{dom_id(step, :sql)}").toggle(); return false;)
88
+ end
87
89
  end
88
90
 
89
91
  def link_to_schema(text, table, html_options={})
@@ -1,7 +1,7 @@
1
1
  <div id='tuneup-schema' style='display:none;'>
2
2
  <% Fiveruns::Tuneup.schemas.each do |table, schema| %>
3
3
  <div id='tuneup-schema-table-<%= table %>' class='tuneup-schema-table' style='display:none;'>
4
- <h3>Schema for &ldquo;<%= table %>&rdquo;</h3>
4
+ <h3>Schema for '<%= table %>'</h3>
5
5
  <table>
6
6
  <tr>
7
7
  <th>Name</th><th>Type</th>
@@ -1,4 +1,4 @@
1
1
  <div id='tuneup-panel'>
2
- <%= render(:partial => 'data') if !tuneup_data.blank? && tuneup_collecting? %>
3
- <%= render :partial => 'link' %>
2
+ <%= render(:partial => 'data.html.erb') if !tuneup_data.blank? && tuneup_collecting? %>
3
+ <%= render :partial => 'link.html.erb' %>
4
4
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiveruns_tuneup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - FiveRuns Development Team
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-18 00:00:00 -05:00
12
+ date: 2008-06-27 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency