request-log-analyzer 1.12.8 → 1.12.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,12 @@
1
1
  language: ruby
2
+ before_script:
3
+ - mysql -e 'create database rla_test;'
4
+ - psql -c 'create database rla_test;' -U postgres
2
5
  script: bundle exec rake
3
6
  rvm:
4
7
  - 1.8.7
5
- - 1.9.2
6
8
  - 1.9.3
9
+ - 2.0.0
7
10
  - ruby-head
8
11
  - ree
9
12
  - jruby-18mode
@@ -13,8 +16,6 @@ rvm:
13
16
  - rbx-19mode
14
17
  matrix:
15
18
  allow_failures:
16
- - rvm: jruby-19mode
17
- - rvm: rbx-19mode
18
19
  - rvm: jruby-head
19
20
  - rvm: ruby-head
20
21
  notifications:
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
data/Rakefile CHANGED
@@ -1,8 +1,11 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
1
4
  Dir[File.dirname(__FILE__) + "/tasks/*.rake"].each { |file| load(file) }
2
5
 
3
- # Create rake tasks for a gem manages by github. The tasks are created in the
4
- # gem namespace
5
- GithubGem::RakeTasks.new(:gem)
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.pattern = "./spec/**/*_spec.rb"
8
+ task.rspec_opts = ['--color']
9
+ end
6
10
 
7
- # Set the RSpec runner with specdoc output as default task.
8
- task :default => "spec:specdoc"
11
+ task :default => :spec
@@ -8,10 +8,6 @@ require 'other/ordered_hash'
8
8
  # The {RequestLogAnalyzer::VERSION} constant can be used to determine what version of request-log-analyzer
9
9
  # is running.
10
10
  module RequestLogAnalyzer
11
-
12
- # The current version of request-log-analyzer.
13
- # Do not change the value by hand; it will be updated automatically by the gem release script.
14
- VERSION = "1.12.8"
15
11
 
16
12
  # Convert a string/symbol in camelcase ({RequestLogAnalyzer::Controller}) to underscores
17
13
  # (<tt>request_log_analyzer/controller</tt>). This function can be used to load the file (using
@@ -34,6 +30,7 @@ module RequestLogAnalyzer
34
30
  end
35
31
  end
36
32
 
33
+ require 'request_log_analyzer/version'
37
34
  require 'request_log_analyzer/controller'
38
35
  require 'request_log_analyzer/aggregator'
39
36
  require 'request_log_analyzer/file_format'
@@ -106,11 +106,11 @@ class RequestLogAnalyzer::Database::Base < ActiveRecord::Base
106
106
  when :hash; :text
107
107
  when :text; :text
108
108
  when :string; :string
109
- when :sec; :double
110
- when :msec; :double
111
- when :duration; :double
112
- when :float; :double
113
- when :double; :double
109
+ when :sec; :float
110
+ when :msec; :float
111
+ when :duration; :float
112
+ when :float; :float
113
+ when :double; :float
114
114
  when :integer; :integer
115
115
  when :int; :int
116
116
  when :timestamp; :datetime
@@ -1,3 +1,5 @@
1
+ require 'request_log_analyzer/request'
2
+
1
3
  module RequestLogAnalyzer::FileFormat
2
4
 
3
5
  autoload :Rails, 'request_log_analyzer/file_format/rails'
@@ -204,36 +206,9 @@ module RequestLogAnalyzer::FileFormat
204
206
  # CLASS METHODS for format definition
205
207
  ####################################################################################
206
208
 
207
- # Registers the line definer instance for a subclass.
208
- def self.inherited(subclass)
209
- if subclass.superclass == RequestLogAnalyzer::FileFormat::Base
210
-
211
- # Create aline and report definer for this class
212
- subclass.class_eval do
213
- instance_variable_set(:@line_definer, RequestLogAnalyzer::LineDefinition::Definer.new)
214
- instance_variable_set(:@report_definer, RequestLogAnalyzer::Aggregator::Summarizer::Definer.new)
215
- class << self; attr_accessor :line_definer, :report_definer; end
216
- end
217
-
218
- # Create a custom Request class for this file format
219
- subclass.const_set('Request', Class.new(RequestLogAnalyzer::Request)) unless subclass.const_defined?('Request')
220
- else
221
-
222
- # Copy the line and report definer from the parent class.
223
- subclass.class_eval do
224
- instance_variable_set(:@line_definer, superclass.line_definer.clone)
225
- instance_variable_set(:@report_definer, superclass.report_definer.clone)
226
- class << self; attr_accessor :line_definer, :report_definer; end
227
- end
228
-
229
- # Create a custom Request class based on the superclass's Request class
230
- subclass.const_set('Request', Class.new(subclass.superclass::Request)) unless subclass.const_defined?('Request')
231
- end
232
- end
233
-
234
209
  # Specifies a single line defintions.
235
210
  def self.line_definition(name, &block)
236
- @line_definer.define_line(name, &block)
211
+ line_definer.define_line(name, &block)
237
212
  end
238
213
 
239
214
  # Specifies multiple line definitions at once using a block
@@ -251,6 +226,19 @@ module RequestLogAnalyzer::FileFormat
251
226
  yield(self.report_definer)
252
227
  end
253
228
 
229
+ # Setup the default line definer.
230
+ def self.line_definer
231
+ @line_definer ||= ::RequestLogAnalyzer::LineDefinition::Definer.new
232
+ end
233
+
234
+ # Setup the default report definer.
235
+ def self.report_definer
236
+ @report_definer ||= ::RequestLogAnalyzer::Aggregator::Summarizer::Definer.new
237
+ end
238
+
239
+ # Setup the default Request class.
240
+ Request = ::RequestLogAnalyzer::Request
241
+
254
242
  ####################################################################################
255
243
  # Instantiation
256
244
  ####################################################################################
@@ -3,7 +3,7 @@ module RequestLogAnalyzer::FileFormat
3
3
  class Nginx < Apache
4
4
 
5
5
  def self.create(*args)
6
- super(:nginx, *args)
6
+ super(:combined, *args)
7
7
  end
8
8
  end
9
9
  end
@@ -32,8 +32,8 @@ module RequestLogAnalyzer::FileFormat
32
32
 
33
33
  # Parameters: {"action"=>"cached", "controller"=>"cached"}
34
34
  line_definition :parameters do |line|
35
- line.teaser = / Parameters:/
36
- line.regexp = / Parameters:\s+(\{.*\})/
35
+ line.teaser = /\bParameters:/
36
+ line.regexp = /\bParameters:\s+(\{.*\})/
37
37
  line.capture(:params).as(:eval)
38
38
  end
39
39
 
@@ -73,8 +73,8 @@ module RequestLogAnalyzer::FileFormat
73
73
  # Rendered queries/index.html.erb (0.6ms)
74
74
  line_definition :rendered do |line|
75
75
  line.compound = [:partial_duration]
76
- line.teaser = / Rendered /
77
- line.regexp = / Rendered ([a-zA-Z0-9_\-\/.]+(?:\/[a-zA-Z0-9_\-.]+)+)(?:\ within\ .*?)? \((\d+(?:\.\d+)?)ms\)/
76
+ line.teaser = /\bRendered /
77
+ line.regexp = /\bRendered ([a-zA-Z0-9_\-\/.]+(?:\/[a-zA-Z0-9_\-.]+)+)(?:\ within\ .*?)? \((\d+(?:\.\d+)?)ms\)/
78
78
  line.capture(:rendered_file)
79
79
  line.capture(:partial_duration).as(:duration, :unit => :msec)
80
80
  end
@@ -133,4 +133,4 @@ module RequestLogAnalyzer::FileFormat
133
133
  end
134
134
 
135
135
  end
136
- end
136
+ end
@@ -0,0 +1,3 @@
1
+ module RequestLogAnalyzer
2
+ VERSION = "1.12.9"
3
+ end
@@ -1,18 +1,20 @@
1
- Gem::Specification.new do |s|
2
- s.name = "request-log-analyzer"
3
-
4
- # Do not set the version and date field manually, this is done by the release script
5
- s.version = "1.12.8"
6
- s.date = "2013-01-22"
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'request_log_analyzer/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "request-log-analyzer"
8
+ gem.rubyforge_project = 'r-l-a'
7
9
 
8
- s.rubyforge_project = 'r-l-a'
10
+ gem.version = RequestLogAnalyzer::VERSION
9
11
 
10
- s.bindir = 'bin'
11
- s.executables = ['request-log-analyzer']
12
- s.default_executable = 'request-log-analyzer'
12
+ gem.authors = ['Willem van Bergen', 'Bart ten Brinke']
13
+ gem.email = ['willem@railsdoctors.com', 'bart@railsdoctors.com']
14
+ gem.homepage = 'http://railsdoctors.com'
13
15
 
14
- s.summary = "A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers"
15
- s.description = <<-eos
16
+ gem.summary = "A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers"
17
+ gem.description = <<-eos
16
18
  Request log analyzer's purpose is to find out how your web application is being used, how it performs and to
17
19
  focus your optimization efforts. This tool will parse all requests in the application's log file and aggregate the
18
20
  information. Once it is finished parsing the log file(s), it will show the requests that take op most server time
@@ -22,29 +24,31 @@ Gem::Specification.new do |s|
22
24
  easy to write log file format definition.
23
25
  eos
24
26
 
25
- s.rdoc_options << '--title' << s.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
26
- s.extra_rdoc_files = ['README.rdoc']
27
-
28
- s.requirements << "To use the database inserter, ActiveRecord and an appropriate database adapter are required."
29
-
30
- s.add_development_dependency('rake')
31
- s.add_development_dependency('rspec', '~> 2.8')
32
-
33
- s.add_development_dependency('activerecord')
27
+ gem.rdoc_options << '--title' << gem.name << '--main' << 'README.rdoc' << '--line-numbers' << '--inline-source'
28
+ gem.extra_rdoc_files = ['README.rdoc']
34
29
 
30
+ gem.requirements << "To use the database inserter, ActiveRecord and an appropriate database adapter are required."
31
+ gem.add_development_dependency('rake')
32
+ gem.add_development_dependency('rspec', '~> 2.13')
33
+ gem.add_development_dependency('activerecord')
35
34
  if defined?(JRUBY_VERSION)
36
- s.add_development_dependency('jdbc-sqlite3')
37
- s.add_development_dependency('activerecord-jdbcsqlite3-adapter')
35
+ gem.add_development_dependency('jdbc-sqlite3')
36
+ gem.add_development_dependency('jdbc-mysql')
37
+ gem.add_development_dependency('jdbc-postgres')
38
+ gem.add_development_dependency('activerecord-jdbcsqlite3-adapter')
39
+ gem.add_development_dependency('activerecord-jdbcmysql-adapter')
40
+ gem.add_development_dependency('activerecord-jdbcpostgresql-adapter')
38
41
  else
39
- s.add_development_dependency('sqlite3')
42
+ gem.add_development_dependency('sqlite3')
43
+ gem.add_development_dependency('mysql2')
44
+ gem.add_development_dependency('pg')
40
45
  end
41
46
 
42
- s.authors = ['Willem van Bergen', 'Bart ten Brinke']
43
- s.email = ['willem@railsdoctors.com', 'bart@railsdoctors.com']
44
- s.homepage = 'http://railsdoctors.com'
47
+ gem.files = `git ls-files`.split($/)
48
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
45
49
 
46
- # The files and test_files directives are set automatically by the release script.
47
- # Do not change them by hand, but make sure to add the files to the git repository.
48
- s.files = %w(.gitignore .infinity_test .travis.yml DESIGN.rdoc Gemfile LICENSE README.rdoc Rakefile bin/request-log-analyzer lib/cli/command_line_arguments.rb lib/cli/database_console.rb lib/cli/database_console_init.rb lib/cli/progressbar.rb lib/cli/tools.rb lib/other/ordered_hash.rb lib/request_log_analyzer.rb lib/request_log_analyzer/aggregator.rb lib/request_log_analyzer/aggregator/database_inserter.rb lib/request_log_analyzer/aggregator/echo.rb lib/request_log_analyzer/aggregator/summarizer.rb lib/request_log_analyzer/controller.rb lib/request_log_analyzer/database.rb lib/request_log_analyzer/database/base.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/database/request.rb lib/request_log_analyzer/database/source.rb lib/request_log_analyzer/database/warning.rb lib/request_log_analyzer/file_format.rb lib/request_log_analyzer/file_format/amazon_s3.rb lib/request_log_analyzer/file_format/apache.rb lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/file_format/delayed_job2.rb lib/request_log_analyzer/file_format/delayed_job21.rb lib/request_log_analyzer/file_format/delayed_job3.rb lib/request_log_analyzer/file_format/haproxy.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/file_format/mysql.rb lib/request_log_analyzer/file_format/nginx.rb lib/request_log_analyzer/file_format/oink.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/file_format/rack.rb lib/request_log_analyzer/file_format/rails.rb lib/request_log_analyzer/file_format/rails3.rb lib/request_log_analyzer/file_format/rails_development.rb lib/request_log_analyzer/file_format/w3c.rb lib/request_log_analyzer/filter.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/filter/timespan.rb lib/request_log_analyzer/line_definition.rb lib/request_log_analyzer/log_processor.rb lib/request_log_analyzer/mailer.rb lib/request_log_analyzer/output.rb lib/request_log_analyzer/output/fixed_width.rb lib/request_log_analyzer/output/html.rb lib/request_log_analyzer/request.rb lib/request_log_analyzer/source.rb lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/tracker.rb lib/request_log_analyzer/tracker/duration.rb lib/request_log_analyzer/tracker/frequency.rb lib/request_log_analyzer/tracker/hourly_spread.rb lib/request_log_analyzer/tracker/numeric_value.rb lib/request_log_analyzer/tracker/timespan.rb lib/request_log_analyzer/tracker/traffic.rb request-log-analyzer.gemspec spec/database.yml spec/fixtures/apache_combined.log spec/fixtures/apache_common.log spec/fixtures/decompression.log spec/fixtures/decompression.log.bz2 spec/fixtures/decompression.log.gz spec/fixtures/decompression.log.zip spec/fixtures/decompression.tar.gz spec/fixtures/decompression.tgz spec/fixtures/header_and_footer.log spec/fixtures/merb.log spec/fixtures/merb_prefixed.log spec/fixtures/multiple_files_1.log spec/fixtures/multiple_files_2.log spec/fixtures/mysql_slow_query.log spec/fixtures/oink_22.log spec/fixtures/oink_22_failure.log spec/fixtures/postgresql.log spec/fixtures/rails.db spec/fixtures/rails_1x.log spec/fixtures/rails_22.log spec/fixtures/rails_22_cached.log spec/fixtures/rails_3_partials.log spec/fixtures/rails_unordered.log spec/fixtures/s3_logs/2012-10-05-16-18-11-F9AAC5D1A55AEBAD spec/fixtures/s3_logs/2012-10-05-16-26-06-15314AF7F0651839 spec/fixtures/sinatra.log spec/fixtures/syslog_1x.log spec/fixtures/test_file_format.log spec/fixtures/test_language_combined.log spec/fixtures/test_order.log spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/lib/helpers.rb spec/lib/macros.rb spec/lib/matchers.rb spec/lib/mocks.rb spec/lib/testing_format.rb spec/spec_helper.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job3_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb tasks/github-gem.rake tasks/request_log_analyzer.rake)
49
- s.test_files = %w(spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job3_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb)
50
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
51
+ gem.default_executable = 'request-log-analyzer'
52
+ gem.bindir = 'bin'
53
+ gem.require_paths = ["lib"]
50
54
  end
@@ -8,16 +8,12 @@ sqlite3:
8
8
  adapter: "sqlite3"
9
9
  database: ":memory:"
10
10
 
11
- # mysql:
12
- # adapter: "mysql"
13
- # host: "localhost"
14
- # username: "root"
15
- # password:
16
- # database: "rla_test"
11
+ mysql:
12
+ adapter: "mysql2"
13
+ username: "root"
14
+ database: "rla_test"
17
15
 
18
- # postgresql:
19
- # adapter: "postgresql"
20
- # host: "localhost"
21
- # username: "rla"
22
- # password: "rla"
23
- # database: "rla_test"
16
+ postgresql:
17
+ adapter: "postgresql"
18
+ username: "postgres"
19
+ database: "rla_test"
@@ -167,7 +167,7 @@ describe RequestLogAnalyzer::Database::Base do
167
167
  end
168
168
 
169
169
  it "should create a field of the correct type for every provided field" do
170
- @database.connection.table_creator.should_receive(:column).with(:evaluated_field, :double)
170
+ @database.connection.table_creator.should_receive(:column).with(:evaluated_field, :float)
171
171
  @klass.create_table!
172
172
  end
173
173
  end
@@ -56,6 +56,11 @@ describe RequestLogAnalyzer::FileFormat::Rails3 do
56
56
  subject.should parse_line(line).as(:parameters).and_capture(:params => {:action => 'cached', :controller => 'cached'})
57
57
  end
58
58
 
59
+ it "should parse a :parameters line with no indentation correctly" do
60
+ line = 'Parameters: {"action"=>"cached", "controller"=>"cached"}'
61
+ subject.should parse_line(line).as(:parameters).and_capture(:params => {:action => 'cached', :controller => 'cached'})
62
+ end
63
+
59
64
  it "should parse :completed lines correctly" do
60
65
  line = 'Completed 200 OK in 170ms (Views: 78.0ms | ActiveRecord: 48.2ms)'
61
66
  subject.should parse_line(line).as(:completed).and_capture(
@@ -91,6 +96,11 @@ describe RequestLogAnalyzer::FileFormat::Rails3 do
91
96
  line = " Rendered queries/index.html.erb (0.6ms)"
92
97
  subject.should parse_line(line).as(:rendered).and_capture(:partial_duration => [0.0006])
93
98
  end
99
+
100
+ it "should parse :rendered lines with no identation as an array" do
101
+ line = "Rendered queries/index.html.erb (0.6ms)"
102
+ subject.should parse_line(line).as(:rendered).and_capture(:partial_duration => [0.0006])
103
+ end
94
104
  end
95
105
 
96
106
  describe '#parse_io' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: request-log-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.8
4
+ version: 1.12.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-22 00:00:00.000000000 Z
13
+ date: 2013-05-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -35,7 +35,7 @@ dependencies:
35
35
  requirements:
36
36
  - - ~>
37
37
  - !ruby/object:Gem::Version
38
- version: '2.8'
38
+ version: '2.13'
39
39
  type: :development
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  requirements:
44
44
  - - ~>
45
45
  - !ruby/object:Gem::Version
46
- version: '2.8'
46
+ version: '2.13'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activerecord
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +76,38 @@ dependencies:
76
76
  - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
+ - !ruby/object:Gem::Dependency
80
+ name: mysql2
81
+ requirement: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :development
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: pg
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
79
111
  description: ! " Request log analyzer's purpose is to find out how your web application
80
112
  is being used, how it performs and to\n focus your optimization efforts. This
81
113
  tool will parse all requests in the application's log file and aggregate the \n
@@ -96,7 +128,6 @@ extra_rdoc_files:
96
128
  - README.rdoc
97
129
  files:
98
130
  - .gitignore
99
- - .infinity_test
100
131
  - .travis.yml
101
132
  - DESIGN.rdoc
102
133
  - Gemfile
@@ -160,6 +191,7 @@ files:
160
191
  - lib/request_log_analyzer/tracker/numeric_value.rb
161
192
  - lib/request_log_analyzer/tracker/timespan.rb
162
193
  - lib/request_log_analyzer/tracker/traffic.rb
194
+ - lib/request_log_analyzer/version.rb
163
195
  - request-log-analyzer.gemspec
164
196
  - spec/database.yml
165
197
  - spec/fixtures/apache_combined.log
@@ -242,7 +274,6 @@ files:
242
274
  - spec/unit/tracker/timespan_tracker_spec.rb
243
275
  - spec/unit/tracker/tracker_api_spec.rb
244
276
  - spec/unit/tracker/traffic_tracker_spec.rb
245
- - tasks/github-gem.rake
246
277
  - tasks/request_log_analyzer.rake
247
278
  homepage: http://railsdoctors.com
248
279
  licenses: []
@@ -262,12 +293,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
293
  - - ! '>='
263
294
  - !ruby/object:Gem::Version
264
295
  version: '0'
296
+ segments:
297
+ - 0
298
+ hash: 4176554289530285347
265
299
  required_rubygems_version: !ruby/object:Gem::Requirement
266
300
  none: false
267
301
  requirements:
268
302
  - - ! '>='
269
303
  - !ruby/object:Gem::Version
270
304
  version: '0'
305
+ segments:
306
+ - 0
307
+ hash: 4176554289530285347
271
308
  requirements:
272
309
  - To use the database inserter, ActiveRecord and an appropriate database adapter are
273
310
  required.
@@ -278,10 +315,47 @@ specification_version: 3
278
315
  summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL
279
316
  and other web application servers
280
317
  test_files:
318
+ - spec/database.yml
319
+ - spec/fixtures/apache_combined.log
320
+ - spec/fixtures/apache_common.log
321
+ - spec/fixtures/decompression.log
322
+ - spec/fixtures/decompression.log.bz2
323
+ - spec/fixtures/decompression.log.gz
324
+ - spec/fixtures/decompression.log.zip
325
+ - spec/fixtures/decompression.tar.gz
326
+ - spec/fixtures/decompression.tgz
327
+ - spec/fixtures/header_and_footer.log
328
+ - spec/fixtures/merb.log
329
+ - spec/fixtures/merb_prefixed.log
330
+ - spec/fixtures/multiple_files_1.log
331
+ - spec/fixtures/multiple_files_2.log
332
+ - spec/fixtures/mysql_slow_query.log
333
+ - spec/fixtures/oink_22.log
334
+ - spec/fixtures/oink_22_failure.log
335
+ - spec/fixtures/postgresql.log
336
+ - spec/fixtures/rails.db
337
+ - spec/fixtures/rails_1x.log
338
+ - spec/fixtures/rails_22.log
339
+ - spec/fixtures/rails_22_cached.log
340
+ - spec/fixtures/rails_3_partials.log
341
+ - spec/fixtures/rails_unordered.log
342
+ - spec/fixtures/s3_logs/2012-10-05-16-18-11-F9AAC5D1A55AEBAD
343
+ - spec/fixtures/s3_logs/2012-10-05-16-26-06-15314AF7F0651839
344
+ - spec/fixtures/sinatra.log
345
+ - spec/fixtures/syslog_1x.log
346
+ - spec/fixtures/test_file_format.log
347
+ - spec/fixtures/test_language_combined.log
348
+ - spec/fixtures/test_order.log
281
349
  - spec/integration/command_line_usage_spec.rb
282
350
  - spec/integration/mailer_spec.rb
283
351
  - spec/integration/munin_plugins_rails_spec.rb
284
352
  - spec/integration/scout_spec.rb
353
+ - spec/lib/helpers.rb
354
+ - spec/lib/macros.rb
355
+ - spec/lib/matchers.rb
356
+ - spec/lib/mocks.rb
357
+ - spec/lib/testing_format.rb
358
+ - spec/spec_helper.rb
285
359
  - spec/unit/aggregator/database_inserter_spec.rb
286
360
  - spec/unit/aggregator/summarizer_spec.rb
287
361
  - spec/unit/controller/controller_spec.rb
@@ -1,8 +0,0 @@
1
- infinity_test do
2
-
3
- use :rubies => %w(1.8.7 1.9.2 ree), :test_framework => :rspec # jruby rbx
4
-
5
- before(:each_ruby) do |environment|
6
- environment.system('bundle install')
7
- end
8
- end
@@ -1,367 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/tasklib'
4
- require 'date'
5
- require 'set'
6
-
7
- module GithubGem
8
-
9
- # Detects the gemspc file of this project using heuristics.
10
- def self.detect_gemspec_file
11
- FileList['*.gemspec'].first
12
- end
13
-
14
- # Detects the main include file of this project using heuristics
15
- def self.detect_main_include
16
- if File.exist?(File.expand_path("../lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb", detect_gemspec_file))
17
- "lib/#{File.basename(detect_gemspec_file, '.gemspec').gsub(/-/, '/')}.rb"
18
- elsif FileList['lib/*.rb'].length == 1
19
- FileList['lib/*.rb'].first
20
- else
21
- nil
22
- end
23
- end
24
-
25
- class RakeTasks
26
-
27
- include Rake::DSL if Rake.const_defined?('DSL')
28
-
29
- attr_reader :gemspec, :modified_files
30
- attr_accessor :gemspec_file, :task_namespace, :main_include, :root_dir, :spec_pattern, :test_pattern, :remote, :remote_branch, :local_branch
31
-
32
- # Initializes the settings, yields itself for configuration
33
- # and defines the rake tasks based on the gemspec file.
34
- def initialize(task_namespace = :gem)
35
- @gemspec_file = GithubGem.detect_gemspec_file
36
- @task_namespace = task_namespace
37
- @main_include = GithubGem.detect_main_include
38
- @modified_files = Set.new
39
- @root_dir = Dir.pwd
40
- @test_pattern = 'test/**/*_test.rb'
41
- @spec_pattern = 'spec/**/*_spec.rb'
42
- @local_branch = 'master'
43
- @remote = 'origin'
44
- @remote_branch = 'master'
45
-
46
- yield(self) if block_given?
47
-
48
- load_gemspec!
49
- define_tasks!
50
- end
51
-
52
- protected
53
-
54
- def git
55
- @git ||= ENV['GIT'] || 'git'
56
- end
57
-
58
- # Define Unit test tasks
59
- def define_test_tasks!
60
- require 'rake/testtask'
61
-
62
- namespace(:test) do
63
- Rake::TestTask.new(:basic) do |t|
64
- t.pattern = test_pattern
65
- t.verbose = true
66
- t.libs << 'test'
67
- end
68
- end
69
-
70
- desc "Run all unit tests for #{gemspec.name}"
71
- task(:test => ['test:basic'])
72
- end
73
-
74
- # Defines RSpec tasks
75
- def define_rspec_tasks!
76
- require 'rspec/core/rake_task'
77
-
78
- namespace(:spec) do
79
- desc "Verify all RSpec examples for #{gemspec.name}"
80
- RSpec::Core::RakeTask.new(:basic) do |t|
81
- t.pattern = spec_pattern
82
- end
83
-
84
- desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
85
- RSpec::Core::RakeTask.new(:specdoc) do |t|
86
- t.pattern = spec_pattern
87
- t.rspec_opts = ['--format', 'documentation', '--color']
88
- end
89
-
90
- desc "Run RCov on specs for #{gemspec.name}"
91
- RSpec::Core::RakeTask.new(:rcov) do |t|
92
- t.pattern = spec_pattern
93
- t.rcov = true
94
- t.rcov_opts = ['--exclude', '"spec/*,gems/*"', '--rails']
95
- end
96
- end
97
-
98
- desc "Verify all RSpec examples for #{gemspec.name} and output specdoc"
99
- task(:spec => ['spec:specdoc'])
100
- end
101
-
102
- # Defines the rake tasks
103
- def define_tasks!
104
-
105
- define_test_tasks! if has_tests?
106
- define_rspec_tasks! if has_specs?
107
-
108
- namespace(@task_namespace) do
109
- desc "Updates the filelist in the gemspec file"
110
- task(:manifest) { manifest_task }
111
-
112
- desc "Builds the .gem package"
113
- task(:build => :manifest) { build_task }
114
-
115
- desc "Sets the version of the gem in the gemspec"
116
- task(:set_version => [:check_version, :check_current_branch]) { version_task }
117
- task(:check_version => :fetch_origin) { check_version_task }
118
-
119
- task(:fetch_origin) { fetch_origin_task }
120
- task(:check_current_branch) { check_current_branch_task }
121
- task(:check_clean_status) { check_clean_status_task }
122
- task(:check_not_diverged => :fetch_origin) { check_not_diverged_task }
123
-
124
- checks = [:check_current_branch, :check_clean_status, :check_not_diverged, :check_version]
125
- checks.unshift('spec:basic') if has_specs?
126
- checks.unshift('test:basic') if has_tests?
127
- # checks.push << [:check_rubyforge] if gemspec.rubyforge_project
128
-
129
- desc "Perform all checks that would occur before a release"
130
- task(:release_checks => checks)
131
-
132
- release_tasks = [:release_checks, :set_version, :build, :github_release, :gemcutter_release]
133
- # release_tasks << [:rubyforge_release] if gemspec.rubyforge_project
134
-
135
- desc "Release a new version of the gem using the VERSION environment variable"
136
- task(:release => release_tasks) { release_task }
137
-
138
- namespace(:release) do
139
- desc "Release the next version of the gem, by incrementing the last version segment by 1"
140
- task(:next => [:next_version] + release_tasks) { release_task }
141
-
142
- desc "Release the next version of the gem, using a patch increment (0.0.1)"
143
- task(:patch => [:next_patch_version] + release_tasks) { release_task }
144
-
145
- desc "Release the next version of the gem, using a minor increment (0.1.0)"
146
- task(:minor => [:next_minor_version] + release_tasks) { release_task }
147
-
148
- desc "Release the next version of the gem, using a major increment (1.0.0)"
149
- task(:major => [:next_major_version] + release_tasks) { release_task }
150
- end
151
-
152
- # task(:check_rubyforge) { check_rubyforge_task }
153
- # task(:rubyforge_release) { rubyforge_release_task }
154
- task(:gemcutter_release) { gemcutter_release_task }
155
- task(:github_release => [:commit_modified_files, :tag_version]) { github_release_task }
156
- task(:tag_version) { tag_version_task }
157
- task(:commit_modified_files) { commit_modified_files_task }
158
-
159
- task(:next_version) { next_version_task }
160
- task(:next_patch_version) { next_version_task(:patch) }
161
- task(:next_minor_version) { next_version_task(:minor) }
162
- task(:next_major_version) { next_version_task(:major) }
163
-
164
- desc "Updates the gem release tasks with the latest version on Github"
165
- task(:update_tasks) { update_tasks_task }
166
- end
167
- end
168
-
169
- # Updates the files list and test_files list in the gemspec file using the list of files
170
- # in the repository and the spec/test file pattern.
171
- def manifest_task
172
- # Load all the gem's files using "git ls-files"
173
- repository_files = `#{git} ls-files`.split("\n")
174
- test_files = Dir[test_pattern] + Dir[spec_pattern]
175
-
176
- update_gemspec(:files, repository_files)
177
- update_gemspec(:test_files, repository_files & test_files)
178
- end
179
-
180
- # Builds the gem
181
- def build_task
182
- sh "gem build -q #{gemspec_file}"
183
- Dir.mkdir('pkg') unless File.exist?('pkg')
184
- sh "mv #{gemspec.name}-#{gemspec.version}.gem pkg/#{gemspec.name}-#{gemspec.version}.gem"
185
- end
186
-
187
- def newest_version
188
- `#{git} tag`.split("\n").map { |tag| tag.split('-').last }.compact.map { |v| Gem::Version.new(v) }.max || Gem::Version.new('0.0.0')
189
- end
190
-
191
- def next_version(increment = nil)
192
- next_version = newest_version.segments
193
- increment_index = case increment
194
- when :micro then 3
195
- when :patch then 2
196
- when :minor then 1
197
- when :major then 0
198
- else next_version.length - 1
199
- end
200
-
201
- next_version[increment_index] ||= 0
202
- next_version[increment_index] = next_version[increment_index].succ
203
- ((increment_index + 1)...next_version.length).each { |i| next_version[i] = 0 }
204
-
205
- Gem::Version.new(next_version.join('.'))
206
- end
207
-
208
- def next_version_task(increment = nil)
209
- ENV['VERSION'] = next_version(increment).version
210
- puts "Releasing version #{ENV['VERSION']}..."
211
- end
212
-
213
- # Updates the version number in the gemspec file, the VERSION constant in the main
214
- # include file and the contents of the VERSION file.
215
- def version_task
216
- update_gemspec(:version, ENV['VERSION']) if ENV['VERSION']
217
- update_gemspec(:date, Date.today)
218
-
219
- update_version_file(gemspec.version)
220
- update_version_constant(gemspec.version)
221
- end
222
-
223
- def check_version_task
224
- raise "#{ENV['VERSION']} is not a valid version number!" if ENV['VERSION'] && !Gem::Version.correct?(ENV['VERSION'])
225
- proposed_version = Gem::Version.new((ENV['VERSION'] || gemspec.version).dup)
226
- raise "This version (#{proposed_version}) is not higher than the highest tagged version (#{newest_version})" if newest_version >= proposed_version
227
- end
228
-
229
- # Checks whether the current branch is not diverged from the remote branch
230
- def check_not_diverged_task
231
- raise "The current branch is diverged from the remote branch!" if `#{git} rev-list HEAD..#{remote}/#{remote_branch}`.split("\n").any?
232
- end
233
-
234
- # Checks whether the repository status ic clean
235
- def check_clean_status_task
236
- raise "The current working copy contains modifications" if `#{git} ls-files -m`.split("\n").any?
237
- end
238
-
239
- # Checks whether the current branch is correct
240
- def check_current_branch_task
241
- raise "Currently not on #{local_branch} branch!" unless `#{git} branch`.split("\n").detect { |b| /^\* / =~ b } == "* #{local_branch}"
242
- end
243
-
244
- # Fetches the latest updates from Github
245
- def fetch_origin_task
246
- sh git, 'fetch', remote
247
- end
248
-
249
- # Commits every file that has been changed by the release task.
250
- def commit_modified_files_task
251
- really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split("\n")
252
- if really_modified.any?
253
- really_modified.each { |file| sh git, 'add', file }
254
- sh git, 'commit', '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
255
- end
256
- end
257
-
258
- # Adds a tag for the released version
259
- def tag_version_task
260
- sh git, 'tag', '-a', "#{gemspec.name}-#{gemspec.version}", '-m', "Released #{gemspec.name} gem version #{gemspec.version}."
261
- end
262
-
263
- # Pushes the changes and tag to github
264
- def github_release_task
265
- sh git, 'push', '--tags', remote, remote_branch
266
- end
267
-
268
- def gemcutter_release_task
269
- sh "gem", 'push', "pkg/#{gemspec.name}-#{gemspec.version}.gem"
270
- end
271
-
272
- # Gem release task.
273
- # All work is done by the task's dependencies, so just display a release completed message.
274
- def release_task
275
- puts
276
- puts "Release successful."
277
- end
278
-
279
- private
280
-
281
- # Checks whether this project has any RSpec files
282
- def has_specs?
283
- FileList[spec_pattern].any?
284
- end
285
-
286
- # Checks whether this project has any unit test files
287
- def has_tests?
288
- FileList[test_pattern].any?
289
- end
290
-
291
- # Loads the gemspec file
292
- def load_gemspec!
293
- @gemspec = eval(File.read(@gemspec_file))
294
- end
295
-
296
- # Updates the VERSION file with the new version
297
- def update_version_file(version)
298
- if File.exists?('VERSION')
299
- File.open('VERSION', 'w') { |f| f << version.to_s }
300
- modified_files << 'VERSION'
301
- end
302
- end
303
-
304
- # Updates the VERSION constant in the main include file if it exists
305
- def update_version_constant(version)
306
- if main_include && File.exist?(main_include)
307
- file_contents = File.read(main_include)
308
- if file_contents.sub!(/^(\s+VERSION\s*=\s*)[^\s].*$/) { $1 + version.to_s.inspect }
309
- File.open(main_include, 'w') { |f| f << file_contents }
310
- modified_files << main_include
311
- end
312
- end
313
- end
314
-
315
- # Updates an attribute of the gemspec file.
316
- # This function will open the file, and search/replace the attribute using a regular expression.
317
- def update_gemspec(attribute, new_value, literal = false)
318
-
319
- unless literal
320
- new_value = case new_value
321
- when Array then "%w(#{new_value.join(' ')})"
322
- when Hash, String then new_value.inspect
323
- when Date then new_value.strftime('%Y-%m-%d').inspect
324
- else raise "Cannot write value #{new_value.inspect} to gemspec file!"
325
- end
326
- end
327
-
328
- spec = File.read(gemspec_file)
329
- regexp = Regexp.new('^(\s+\w+\.' + Regexp.quote(attribute.to_s) + '\s*=\s*)[^\s].*$')
330
- if spec.sub!(regexp) { $1 + new_value }
331
- File.open(gemspec_file, 'w') { |f| f << spec }
332
- modified_files << gemspec_file
333
-
334
- # Reload the gemspec so the changes are incorporated
335
- load_gemspec!
336
-
337
- # Also mark the Gemfile.lock file as changed because of the new version.
338
- modified_files << 'Gemfile.lock' if File.exist?(File.join(root_dir, 'Gemfile.lock'))
339
- end
340
- end
341
-
342
- # Updates the tasks file using the latest file found on Github
343
- def update_tasks_task
344
- require 'net/https'
345
- require 'uri'
346
-
347
- uri = URI.parse('https://raw.github.com/wvanbergen/github-gem/master/tasks/github-gem.rake')
348
- http = Net::HTTP.new(uri.host, uri.port)
349
- http.use_ssl = true
350
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
351
- response = http.request(Net::HTTP::Get.new(uri.path))
352
-
353
- if Net::HTTPSuccess === response
354
- open(__FILE__, "w") { |file| file.write(response.body) }
355
- relative_file = File.expand_path(__FILE__).sub(%r[^#{@root_dir}/], '')
356
- if `#{git} ls-files -m #{relative_file}`.split("\n").any?
357
- sh git, 'add', relative_file
358
- sh git, 'commit', '-m', "Updated to latest gem release management tasks."
359
- else
360
- puts "Release managament tasks already are at the latest version."
361
- end
362
- else
363
- raise "Download failed with HTTP status #{response.code}!"
364
- end
365
- end
366
- end
367
- end