query_diet 0.5.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +86 -0
  3. data/lib/query_diet/active_record_ext.rb +6 -8
  4. data/lib/query_diet/rack/reset_logger.rb +2 -2
  5. data/lib/query_diet/version.rb +1 -1
  6. data/lib/query_diet/widget.rb +20 -5
  7. metadata +22 -172
  8. data/.gitignore +0 -4
  9. data/README.rdoc +0 -56
  10. data/Rakefile +0 -44
  11. data/query_diet.gemspec +0 -22
  12. data/spec/rails-2.3/Gemfile +0 -9
  13. data/spec/rails-2.3/Gemfile.lock +0 -60
  14. data/spec/rails-2.3/Rakefile +0 -11
  15. data/spec/rails-2.3/app_root/config/boot.rb +0 -114
  16. data/spec/rails-2.3/app_root/config/database.yml +0 -4
  17. data/spec/rails-2.3/app_root/config/environment.rb +0 -14
  18. data/spec/rails-2.3/app_root/config/environments/test.rb +0 -0
  19. data/spec/rails-2.3/app_root/config/routes.rb +0 -4
  20. data/spec/rails-2.3/app_root/log/.gitignore +0 -1
  21. data/spec/rails-2.3/spec.opts +0 -5
  22. data/spec/rails-2.3/spec_helper.rb +0 -27
  23. data/spec/rails-3.0/.rspec +0 -2
  24. data/spec/rails-3.0/Gemfile +0 -9
  25. data/spec/rails-3.0/Gemfile.lock +0 -116
  26. data/spec/rails-3.0/Rakefile +0 -10
  27. data/spec/rails-3.0/app_root/.gitignore +0 -4
  28. data/spec/rails-3.0/app_root/config/application.rb +0 -32
  29. data/spec/rails-3.0/app_root/config/boot.rb +0 -13
  30. data/spec/rails-3.0/app_root/config/database.yml +0 -4
  31. data/spec/rails-3.0/app_root/config/environment.rb +0 -5
  32. data/spec/rails-3.0/app_root/config/environments/test.rb +0 -35
  33. data/spec/rails-3.0/app_root/config/initializers/backtrace_silencers.rb +0 -7
  34. data/spec/rails-3.0/app_root/config/initializers/inflections.rb +0 -10
  35. data/spec/rails-3.0/app_root/config/initializers/mime_types.rb +0 -5
  36. data/spec/rails-3.0/app_root/config/initializers/secret_token.rb +0 -7
  37. data/spec/rails-3.0/app_root/config/initializers/session_store.rb +0 -8
  38. data/spec/rails-3.0/app_root/config/routes.rb +0 -58
  39. data/spec/rails-3.0/app_root/lib/tasks/.gitkeep +0 -0
  40. data/spec/rails-3.0/app_root/log/.gitkeep +0 -0
  41. data/spec/rails-3.0/app_root/script/rails +0 -6
  42. data/spec/rails-3.0/rcov.opts +0 -2
  43. data/spec/rails-3.0/spec_helper.rb +0 -31
  44. data/spec/rails-3.2/.rspec +0 -2
  45. data/spec/rails-3.2/Gemfile +0 -10
  46. data/spec/rails-3.2/Gemfile.lock +0 -127
  47. data/spec/rails-3.2/Rakefile +0 -10
  48. data/spec/rails-3.2/app_root/.gitignore +0 -4
  49. data/spec/rails-3.2/app_root/config/application.rb +0 -32
  50. data/spec/rails-3.2/app_root/config/boot.rb +0 -13
  51. data/spec/rails-3.2/app_root/config/database.yml +0 -4
  52. data/spec/rails-3.2/app_root/config/environment.rb +0 -5
  53. data/spec/rails-3.2/app_root/config/environments/test.rb +0 -35
  54. data/spec/rails-3.2/app_root/config/initializers/backtrace_silencers.rb +0 -7
  55. data/spec/rails-3.2/app_root/config/initializers/inflections.rb +0 -10
  56. data/spec/rails-3.2/app_root/config/initializers/mime_types.rb +0 -5
  57. data/spec/rails-3.2/app_root/config/initializers/secret_token.rb +0 -7
  58. data/spec/rails-3.2/app_root/config/initializers/session_store.rb +0 -8
  59. data/spec/rails-3.2/app_root/config/routes.rb +0 -58
  60. data/spec/rails-3.2/app_root/log/.gitignore +0 -1
  61. data/spec/rails-3.2/rcov.opts +0 -2
  62. data/spec/rails-3.2/spec_helper.rb +0 -31
  63. data/spec/shared/app_root/app/controllers/application_controller.rb +0 -2
  64. data/spec/shared/app_root/app/controllers/query_diet_controller.rb +0 -13
  65. data/spec/shared/app_root/app/models/movie.rb +0 -3
  66. data/spec/shared/app_root/app/views/layouts/screen.html.erb +0 -7
  67. data/spec/shared/app_root/app/views/query_diet/no_query.html.erb +0 -3
  68. data/spec/shared/app_root/app/views/query_diet/two_queries.html.erb +0 -3
  69. data/spec/shared/app_root/db/.gitignore +0 -1
  70. data/spec/shared/app_root/db/migrate/001_create_movies.rb +0 -14
  71. data/spec/shared/query_diet/helpers/widget_spec.rb +0 -32
  72. data/spec/shared/query_diet/integration/widget_spec.rb +0 -23
  73. data/spec/shared/query_diet/logger_spec.rb +0 -91
data/Rakefile DELETED
@@ -1,44 +0,0 @@
1
- require 'rake'
2
- require 'bundler/gem_tasks'
3
-
4
- desc 'Default: Run all specs.'
5
- task :default => 'all:spec'
6
-
7
- namespace :all do
8
-
9
- desc "Run specs on all spec apps"
10
- task :spec do
11
- for_each_directory_of('spec/**/Rakefile') do |directory|
12
- env = "SPEC=../../#{ENV['SPEC']} " if ENV['SPEC']
13
- system("cd #{directory} && #{env} bundle exec rake spec")
14
- end
15
- end
16
-
17
- namespace :bundle do
18
-
19
- desc "Bundle all spec apps"
20
- task :install do
21
- for_each_directory_of('spec/**/Gemfile') do |directory|
22
- system("cd #{directory} && bundle install")
23
- end
24
- end
25
-
26
- desc "Update a gem given by the GEM environment variable"
27
- task :update do
28
- gem = ENV['GEM'] or raise "Name the gem you wish to update by setting a environment variable GEM"
29
- for_each_directory_of('spec/**/Gemfile') do |directory|
30
- system("cd #{directory} && bundle update #{gem}")
31
- end
32
- end
33
-
34
- end
35
-
36
- end
37
-
38
- def for_each_directory_of(path, &block)
39
- Dir[path].sort.each do |rakefile|
40
- directory = File.dirname(rakefile)
41
- puts '', "\033[44m#{directory}\033[0m", ''
42
- block.call(directory)
43
- end
44
- end
@@ -1,22 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $: << File.expand_path('../lib', __FILE__)
3
- require 'query_diet/version'
4
-
5
- Gem::Specification.new do |gem|
6
- gem.authors = ["Henning Koch", "Tobias Kraze"]
7
- gem.email = "github@makandra.de"
8
- gem.description = "Rails database query counter that stays out of your way"
9
- gem.summary = gem.description
10
- gem.homepage = "https://github.com/makandra/query_diet"
11
- gem.license = 'MIT'
12
-
13
- gem.files = `git ls-files`.split($\)
14
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
- gem.name = "query_diet"
17
- gem.require_paths = ["lib"]
18
- gem.version = QueryDiet::VERSION
19
-
20
- gem.post_install_message = "Remember to put <%= query_diet_widget if Rails.env.development? %> into your app layout."
21
- end
22
-
@@ -1,9 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'rails', '~> 2.3'
4
- gem 'rspec', '~> 1.3'
5
- gem 'rspec-rails', '~> 1.3'
6
- gem 'sqlite3'
7
- gem 'query_diet', :path => '../..'
8
- gem 'ruby-debug'
9
- gem 'webrat'
@@ -1,60 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- query_diet (0.5.3)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- actionmailer (2.3.14)
10
- actionpack (= 2.3.14)
11
- actionpack (2.3.14)
12
- activesupport (= 2.3.14)
13
- rack (~> 1.1.0)
14
- activerecord (2.3.14)
15
- activesupport (= 2.3.14)
16
- activeresource (2.3.14)
17
- activesupport (= 2.3.14)
18
- activesupport (2.3.14)
19
- columnize (0.3.6)
20
- linecache (0.46)
21
- rbx-require-relative (> 0.0.4)
22
- nokogiri (1.5.5)
23
- rack (1.1.3)
24
- rack-test (0.6.2)
25
- rack (>= 1.0)
26
- rails (2.3.14)
27
- actionmailer (= 2.3.14)
28
- actionpack (= 2.3.14)
29
- activerecord (= 2.3.14)
30
- activeresource (= 2.3.14)
31
- activesupport (= 2.3.14)
32
- rake (>= 0.8.3)
33
- rake (0.9.2.2)
34
- rbx-require-relative (0.0.9)
35
- rspec (1.3.2)
36
- rspec-rails (1.3.4)
37
- rack (>= 1.0.0)
38
- rspec (~> 1.3.1)
39
- ruby-debug (0.10.4)
40
- columnize (>= 0.1)
41
- ruby-debug-base (~> 0.10.4.0)
42
- ruby-debug-base (0.10.4)
43
- linecache (>= 0.3)
44
- sqlite3 (1.3.6)
45
- webrat (0.7.3)
46
- nokogiri (>= 1.2.0)
47
- rack (>= 1.0)
48
- rack-test (>= 0.5.3)
49
-
50
- PLATFORMS
51
- ruby
52
-
53
- DEPENDENCIES
54
- query_diet!
55
- rails (~> 2.3)
56
- rspec (~> 1.3)
57
- rspec-rails (~> 1.3)
58
- ruby-debug
59
- sqlite3
60
- webrat
@@ -1,11 +0,0 @@
1
- require 'rake'
2
- require 'spec/rake/spectask'
3
-
4
- desc 'Default: Run all specs for a specific rails version.'
5
- task :default => :spec
6
-
7
- desc "Run all specs for a specific rails version"
8
- Spec::Rake::SpecTask.new() do |t|
9
- t.spec_opts = ['--options', "\"spec.opts\""]
10
- t.spec_files = defined?(SPEC) ? SPEC : FileList['**/*_spec.rb', '../shared/**/*_spec.rb']
11
- end
@@ -1,114 +0,0 @@
1
- # Allow customization of the rails framework path
2
- RAILS_FRAMEWORK_ROOT = (ENV['RAILS_FRAMEWORK_ROOT'] || "#{File.dirname(__FILE__)}/../../../../../../vendor/rails") unless defined?(RAILS_FRAMEWORK_ROOT)
3
-
4
- # Don't change this file!
5
- # Configure your app in config/environment.rb and config/environments/*.rb
6
-
7
- RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
8
-
9
- module Rails
10
- class << self
11
- def boot!
12
- unless booted?
13
- preinitialize
14
- pick_boot.run
15
- end
16
- end
17
-
18
- def booted?
19
- defined? Rails::Initializer
20
- end
21
-
22
- def pick_boot
23
- (vendor_rails? ? VendorBoot : GemBoot).new
24
- end
25
-
26
- def vendor_rails?
27
- File.exist?(RAILS_FRAMEWORK_ROOT)
28
- end
29
-
30
- def preinitialize
31
- load(preinitializer_path) if File.exist?(preinitializer_path)
32
- end
33
-
34
- def preinitializer_path
35
- "#{RAILS_ROOT}/config/preinitializer.rb"
36
- end
37
- end
38
-
39
- class Boot
40
- def run
41
- load_initializer
42
- Rails::Initializer.run(:set_load_path)
43
- end
44
- end
45
-
46
- class VendorBoot < Boot
47
- def load_initializer
48
- require "#{RAILS_FRAMEWORK_ROOT}/railties/lib/initializer"
49
- Rails::Initializer.run(:install_gem_spec_stubs)
50
- end
51
- end
52
-
53
- class GemBoot < Boot
54
- def load_initializer
55
- self.class.load_rubygems
56
- load_rails_gem
57
- require 'initializer'
58
- end
59
-
60
- def load_rails_gem
61
- if version = self.class.gem_version
62
- gem 'rails', version
63
- else
64
- gem 'rails'
65
- end
66
- rescue Gem::LoadError => load_error
67
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
68
- exit 1
69
- end
70
-
71
- class << self
72
- def rubygems_version
73
- Gem::RubyGemsVersion rescue nil
74
- end
75
-
76
- def gem_version
77
- if defined? RAILS_GEM_VERSION
78
- RAILS_GEM_VERSION
79
- elsif ENV.include?('RAILS_GEM_VERSION')
80
- ENV['RAILS_GEM_VERSION']
81
- else
82
- parse_gem_version(read_environment_rb)
83
- end
84
- end
85
-
86
- def load_rubygems
87
- require 'rubygems'
88
- min_version = '1.1.1'
89
- unless rubygems_version >= min_version
90
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
91
- exit 1
92
- end
93
-
94
- rescue LoadError
95
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
96
- exit 1
97
- end
98
-
99
- def parse_gem_version(text)
100
- $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
101
- end
102
-
103
- private
104
- def read_environment_rb
105
- environment_rb = "#{RAILS_ROOT}/config/environment.rb"
106
- environment_rb = "#{HELPER_RAILS_ROOT}/config/environment.rb" unless File.exists?(environment_rb)
107
- File.read(environment_rb)
108
- end
109
- end
110
- end
111
- end
112
-
113
- # All that for this:
114
- Rails.boot!
@@ -1,4 +0,0 @@
1
- test:
2
- adapter: sqlite3
3
- database: db/query_diet_test.db
4
- verbosity: quiet
@@ -1,14 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'boot')
2
-
3
- Rails::Initializer.run do |config|
4
- config.cache_classes = false
5
- config.whiny_nils = true
6
- config.action_controller.session = { :key => "_myapp_session", :secret => "gwirofjweroijger8924rt2zfwehfuiwehb1378rifowenfoqwphf23" }
7
- config.plugin_locators.unshift(
8
- Class.new(Rails::Plugin::Locator) do
9
- def plugins
10
- [Rails::Plugin.new(File.expand_path('.'))]
11
- end
12
- end
13
- ) unless defined?(PluginTestHelper::PluginLocator)
14
- end
@@ -1,4 +0,0 @@
1
- ActionController::Routing::Routes.draw do |map|
2
- map.connect ':controller/:action/:id'
3
- map.connect ':controller/:action/:id.:format'
4
- end
@@ -1 +0,0 @@
1
- *.log
@@ -1,5 +0,0 @@
1
- --colour
2
- --format progress
3
- --loadby mtime
4
- --reverse
5
- --debugger
@@ -1,27 +0,0 @@
1
- $LOAD_PATH << File.expand_path('../../lib', __FILE__)
2
-
3
- ENV['RAILS_ENV'] ||= 'test'
4
-
5
- # Load the Rails environment and testing framework
6
- require File.expand_path('../app_root/config/environment', __FILE__)
7
- require 'query_diet'
8
-
9
- MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1] # Ruby 1.9 vs Rails 2.3 fix
10
-
11
- require 'spec/rails'
12
- require 'webrat/integrations/rspec-rails'
13
-
14
- # Undo changes to RAILS_ENV
15
- silence_warnings {RAILS_ENV = ENV['RAILS_ENV']}
16
-
17
- FileUtils.rm(Dir.glob("#{Rails.root}/db/*.db"), :force => true)
18
-
19
- # Run the migrations
20
- ActiveRecord::Migration.verbose = false
21
- ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
22
-
23
- Spec::Runner.configure do |config|
24
- config.use_transactional_fixtures = true
25
- config.use_instantiated_fixtures = false
26
- config.include(Webrat::Matchers, :type => [:integration])
27
- end
@@ -1,2 +0,0 @@
1
- --colour
2
- --format progress
@@ -1,9 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'sqlite3'
4
- gem 'rails', '=3.0.17'
5
- gem 'rspec'
6
- gem 'rspec-rails'
7
- gem 'ruby-debug'
8
- gem 'query_diet', :path => '../..'
9
- gem 'webrat'
@@ -1,116 +0,0 @@
1
- PATH
2
- remote: ../..
3
- specs:
4
- query_diet (0.5.3)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- abstract (1.0.0)
10
- actionmailer (3.0.17)
11
- actionpack (= 3.0.17)
12
- mail (~> 2.2.19)
13
- actionpack (3.0.17)
14
- activemodel (= 3.0.17)
15
- activesupport (= 3.0.17)
16
- builder (~> 2.1.2)
17
- erubis (~> 2.6.6)
18
- i18n (~> 0.5.0)
19
- rack (~> 1.2.5)
20
- rack-mount (~> 0.6.14)
21
- rack-test (~> 0.5.7)
22
- tzinfo (~> 0.3.23)
23
- activemodel (3.0.17)
24
- activesupport (= 3.0.17)
25
- builder (~> 2.1.2)
26
- i18n (~> 0.5.0)
27
- activerecord (3.0.17)
28
- activemodel (= 3.0.17)
29
- activesupport (= 3.0.17)
30
- arel (~> 2.0.10)
31
- tzinfo (~> 0.3.23)
32
- activeresource (3.0.17)
33
- activemodel (= 3.0.17)
34
- activesupport (= 3.0.17)
35
- activesupport (3.0.17)
36
- arel (2.0.10)
37
- builder (2.1.2)
38
- columnize (0.3.6)
39
- diff-lcs (1.1.3)
40
- erubis (2.6.6)
41
- abstract (>= 1.0.0)
42
- i18n (0.5.0)
43
- json (1.7.5)
44
- linecache (0.46)
45
- rbx-require-relative (> 0.0.4)
46
- mail (2.2.19)
47
- activesupport (>= 2.3.6)
48
- i18n (>= 0.4.0)
49
- mime-types (~> 1.16)
50
- treetop (~> 1.4.8)
51
- mime-types (1.19)
52
- nokogiri (1.5.5)
53
- polyglot (0.3.3)
54
- rack (1.2.5)
55
- rack-mount (0.6.14)
56
- rack (>= 1.0.0)
57
- rack-test (0.5.7)
58
- rack (>= 1.0)
59
- rails (3.0.17)
60
- actionmailer (= 3.0.17)
61
- actionpack (= 3.0.17)
62
- activerecord (= 3.0.17)
63
- activeresource (= 3.0.17)
64
- activesupport (= 3.0.17)
65
- bundler (~> 1.0)
66
- railties (= 3.0.17)
67
- railties (3.0.17)
68
- actionpack (= 3.0.17)
69
- activesupport (= 3.0.17)
70
- rake (>= 0.8.7)
71
- rdoc (~> 3.4)
72
- thor (~> 0.14.4)
73
- rake (0.9.2.2)
74
- rbx-require-relative (0.0.9)
75
- rdoc (3.12)
76
- json (~> 1.4)
77
- rspec (2.11.0)
78
- rspec-core (~> 2.11.0)
79
- rspec-expectations (~> 2.11.0)
80
- rspec-mocks (~> 2.11.0)
81
- rspec-core (2.11.1)
82
- rspec-expectations (2.11.3)
83
- diff-lcs (~> 1.1.3)
84
- rspec-mocks (2.11.3)
85
- rspec-rails (2.11.4)
86
- actionpack (>= 3.0)
87
- activesupport (>= 3.0)
88
- railties (>= 3.0)
89
- rspec (~> 2.11.0)
90
- ruby-debug (0.10.4)
91
- columnize (>= 0.1)
92
- ruby-debug-base (~> 0.10.4.0)
93
- ruby-debug-base (0.10.4)
94
- linecache (>= 0.3)
95
- sqlite3 (1.3.6)
96
- thor (0.14.6)
97
- treetop (1.4.12)
98
- polyglot
99
- polyglot (>= 0.3.1)
100
- tzinfo (0.3.34)
101
- webrat (0.7.3)
102
- nokogiri (>= 1.2.0)
103
- rack (>= 1.0)
104
- rack-test (>= 0.5.3)
105
-
106
- PLATFORMS
107
- ruby
108
-
109
- DEPENDENCIES
110
- query_diet!
111
- rails (= 3.0.17)
112
- rspec
113
- rspec-rails
114
- ruby-debug
115
- sqlite3
116
- webrat